publ-echo-test 0.0.129 → 0.0.130

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.
@@ -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, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, formatCbIdToBlockId, getBlockSpecificType, zIndexMap } from "./group";
40
+ import { findAllChildrenCbIds, findBlockByBlockId, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, 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";
@@ -50,6 +50,7 @@ var ReactGridLayout = function (_a) {
50
50
  } : _w, // TODO fix
51
51
  _x = props.resizeHandles, // TODO fix
52
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';
53
54
  var _2 = useState(), activeDrag = _2[0], setActiveDrag = _2[1];
54
55
  var _3 = useState(), oldDragItem = _3[0], setOldDragItem = _3[1];
55
56
  var _4 = useState(), oldLayout = _4[0], setOldLayout = _4[1];
@@ -57,6 +58,7 @@ var ReactGridLayout = function (_a) {
57
58
  var _6 = useState(), droppingDOMNode = _6[0], setDroppingDOMNode = _6[1];
58
59
  var _7 = useState(), droppingPosition = _7[0], setDroppingPosition = _7[1];
59
60
  var _8 = useState(false), isMounted = _8[0], setIsMounted = _8[1];
61
+ var editorMode = props.isDraggable && props.isResizable ? 'EDIT' : 'VIEW';
60
62
  var editableBlockIds = blockStructure ? findDirectChildrenCbIds(blockStructure, editingGroupBlock) : [];
61
63
  var editingGroupAllChildren = (blockStructure && editingGroupBlock) ? findAllChildrenCbIds(blockStructure, editingGroupBlock).map(function (i) { return i.toString(); }) : [];
62
64
  var _9 = useState([]), oldGroupChildren = _9[0], setOldGroupChildren = _9[1];
@@ -527,6 +529,7 @@ var ReactGridLayout = function (_a) {
527
529
  * @return {Element} Element wrapped in draggable and properly placed.
528
530
  */
529
531
  var processGridItem = function (child, isDroppingItem) {
532
+ var _a;
530
533
  if (!child || !child.key)
531
534
  return;
532
535
  var l = getLayoutItem(layout, String(child.key));
@@ -546,9 +549,19 @@ var ReactGridLayout = function (_a) {
546
549
  var z = l.z || 0;
547
550
  var isInBulk = blockStructure && (bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(formatCbIdToBlockId(Number(activeDrag === null || activeDrag === void 0 ? void 0 : activeDrag.i))));
548
551
  var isRoot = editingGroupBlock === 'ROOT';
549
- var baseZ = function () {
550
- if (isInBulk) {
551
- return zIndexMap.BULK;
552
+ var block = blockStructure ? findBlockByBlockId(blockStructure, formatCbIdToBlockId(Number(l.i))) : undefined;
553
+ if (!block) {
554
+ return _jsx(_Fragment, { children: "NO-BLOCK-FOUND" });
555
+ }
556
+ var zOrder = (_a = block[device === 'DESKTOP' ? 'zOrderDesktopInternal' : 'zOrderMobileInternal']) !== null && _a !== void 0 ? _a : 0;
557
+ var editorZIndex = (function () {
558
+ // if (isInBulk) {
559
+ // const bulkBlock = findBlockByBlockId(blockStructure, 'BULK');
560
+ // const bulkZOrder = bulkBlock?.[device === 'DESKTOP' ? 'zOrderDesktopInternal' : 'zOrderMobileInternal'] ?? 0;
561
+ // return zIndexMap.EDITING_GROUP;
562
+ // }
563
+ if (!isRoot && isInBulk) {
564
+ return zIndexMap.EDITING_GROUP;
552
565
  }
553
566
  if (!isRoot && editable) {
554
567
  return zIndexMap.EDITING_GROUP;
@@ -560,15 +573,15 @@ var ReactGridLayout = function (_a) {
560
573
  return 0;
561
574
  }
562
575
  return 0;
563
- };
564
- console.log('id: ', l.i, 'z: ', z, 'baseZ: ', baseZ());
576
+ })();
565
577
  var outsideOfEditingGroup = !editingGroupAllChildren.includes(l.i);
578
+ var zIndex = editorMode === 'EDIT' ? editorZIndex : z;
566
579
  return (_jsx(GridItem, { className: classNames({
567
580
  'editable-grid-item': (!isRoot && editable),
568
581
  'not-editable-grid-item': (!isRoot && !editable),
569
582
  'bulk-child-item': isInBulk,
570
583
  'outside-of-editing-group': outsideOfEditingGroup,
571
- }), z: baseZ() + z, 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));
584
+ }), z: zIndex, 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));
572
585
  };
573
586
  var onDragOverHandler = function (e) {
574
587
  var _a;
@@ -637,6 +650,7 @@ var ReactGridLayout = function (_a) {
637
650
  var mergedClassName = classNames(layoutClassName, className);
638
651
  var mergedStyle = __assign({ height: containerHeight() }, style);
639
652
  var processGroup = function (block, viewOnly) {
653
+ var _a;
640
654
  if (!blockStructure) {
641
655
  return;
642
656
  }
@@ -645,13 +659,20 @@ var ReactGridLayout = function (_a) {
645
659
  if (!groupItem) {
646
660
  return _jsx(_Fragment, {});
647
661
  }
662
+ var zOrder = (_a = block[device === 'DESKTOP' ? 'zOrderDesktopInternal' : 'zOrderMobileInternal']) !== null && _a !== void 0 ? _a : 0;
648
663
  var isEditingGroup = block.blockId === editingGroupBlock;
649
664
  var type = getBlockSpecificType(block);
650
665
  var isRoot = editingGroupBlock === 'ROOT';
651
666
  var isInBulk = bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(block.blockId);
652
- var z = (function () {
667
+ var isBulk = block.blockId === 'BULK';
668
+ var baseZ = (function () {
669
+ if (isBulk) {
670
+ return zIndexMap.EDITING_GROUP;
671
+ }
653
672
  if (isInBulk) {
654
- return zIndexMap.BULK;
673
+ // const bulkBlock = findBlockByBlockId(blockStructure, 'BULK');
674
+ // const bulkZOrder = bulkBlock?.[device === 'DESKTOP' ? 'zOrderDesktopInternal' : 'zOrderMobileInternal'] ?? 0;
675
+ return zIndexMap.EDITING_GROUP;
655
676
  }
656
677
  if (!isRoot && type === 'GROUP_BLOCK') {
657
678
  return zIndexMap.EDITING_GROUP;
@@ -664,6 +685,7 @@ var ReactGridLayout = function (_a) {
664
685
  }
665
686
  return zIndexMap.CB;
666
687
  })();
688
+ var zIndex = editorMode === 'EDIT' ? baseZ + zOrder : zOrder;
667
689
  var handleClick = function (e) {
668
690
  onClickGroup && onClickGroup(e, block.blockId, type);
669
691
  };
@@ -678,7 +700,7 @@ var ReactGridLayout = function (_a) {
678
700
  'grid-bulk-block': block.blockId === 'BULK',
679
701
  'editing': editingGroupBlock === block.blockId,
680
702
  'selected': selectedGroupBlock === block.blockId
681
- }), 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, z: z, i: block.blockId,
703
+ }), z: zIndex, 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,
682
704
  // minH={l.minH}
683
705
  // minW={l.minW}
684
706
  // maxH={l.maxH}
@@ -690,7 +712,6 @@ var ReactGridLayout = function (_a) {
690
712
  isHiddenVisibility: isHiddenVisibility, customColWidth: colWidth, autoResize: false, onContextGroup: handleClickContextGroup, children: _jsx("div", { onClick: handleClick, onDoubleClick: handleDoubleClick }) }, block.blockId) }));
691
713
  };
692
714
  var currentGroupBlocks = blockStructure ? findGroupBlocks(blockStructure, editingGroupBlock) : [];
693
- console.log('currentGroupBlocks', currentGroupBlocks);
694
715
  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, 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: {
695
716
  marginTop: margin[1] + "px",
696
717
  marginBottom: margin[1] + "px",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.129",
3
+ "version": "0.0.130",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",