publ-echo-test 0.0.377 → 0.0.379

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.
@@ -38,7 +38,7 @@ import { calcGridColWidth, calcXY, getRowsForHeightFitContentItems, resolveRowHe
38
38
  // NOTE: 필수 변경하기
39
39
  import GridItem from "../GridItem/GridItem";
40
40
  import isEqual from "../../external-lib/lodash.isEqual";
41
- import { findAllChildrenCbIds, findBlockByBlockId, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, findParentGroupBlock, formatCbIdToBlockId, getBlockSpecificType, zIndexMap, } from "./group";
41
+ import { findAllChildrenCbIds, findBlockByBlockId, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, findParentGroupBlock, formatCbIdToBlockId, getBlockIdKind, getBlockSpecificType, zIndexMap, } from "./group";
42
42
  import GroupItem from "../GridItem/GroupItem";
43
43
  import OutsideClickHandler from "../GridItem/OutsideClickHandler";
44
44
  import { GridBackgroundPlaceholder } from "./Placeholder";
@@ -53,6 +53,7 @@ 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
+ var parsedSelectedBlockId = getBlockIdKind(selectedBlockId !== null && selectedBlockId !== void 0 ? selectedBlockId : "");
56
57
  var _2 = useState(), activeDrag = _2[0], setActiveDrag = _2[1];
57
58
  var _3 = useState(), oldDragItem = _3[0], setOldDragItem = _3[1];
58
59
  var _4 = useState(), oldLayout = _4[0], setOldLayout = _4[1];
@@ -573,7 +574,7 @@ var ReactGridLayout = function (_a) {
573
574
  var zIndex = editorMode === "EDIT" ? editorZIndex : z;
574
575
  // Check if a layout item overlaps any of the activeRows (vertical overlap)
575
576
  var isOverlappingActiveRows = function (item) {
576
- if (selectedBlockId === item.i) {
577
+ if ((parsedSelectedBlockId === null || parsedSelectedBlockId === void 0 ? void 0 : parsedSelectedBlockId.id) === item.i) {
577
578
  return false;
578
579
  }
579
580
  if (!(activeDragItemOrSelectedItem === null || activeDragItemOrSelectedItem === void 0 ? void 0 : activeDragItemOrSelectedItem.heightFitContent)) {
@@ -753,10 +754,22 @@ var ReactGridLayout = function (_a) {
753
754
  var currentGroupBlocks = blockStructure
754
755
  ? findGroupBlocks(blockStructure, editingGroupBlock)
755
756
  : [];
756
- var selectedLayoutItem = selectedBlockId
757
- ? getLayoutItem(layout, selectedBlockId)
758
- : null;
759
- console.log("layout", layout);
757
+ function generateGrouplayout(groupblockId) {
758
+ if (!blockStructure) {
759
+ return null;
760
+ }
761
+ var childrenIds = findAllChildrenCbIds(blockStructure, groupblockId).map(function (i) { return i.toString(); });
762
+ var groupItem = getBoundingArea(layout, childrenIds);
763
+ if (!groupItem) {
764
+ return null;
765
+ }
766
+ return __assign({ i: groupblockId }, groupItem);
767
+ }
768
+ var selectedLayoutItem = (parsedSelectedBlockId === null || parsedSelectedBlockId === void 0 ? void 0 : parsedSelectedBlockId.type) === "CB"
769
+ ? getLayoutItem(layout, parsedSelectedBlockId.id)
770
+ : (parsedSelectedBlockId === null || parsedSelectedBlockId === void 0 ? void 0 : parsedSelectedBlockId.type) === "GB"
771
+ ? generateGrouplayout(parsedSelectedBlockId.id)
772
+ : null;
760
773
  var activeDragItemOrSelectedItem = activeDrag || selectedLayoutItem;
761
774
  var activeBlock = activeDragItemOrSelectedItem
762
775
  ? blockStructure
@@ -774,6 +787,7 @@ var ReactGridLayout = function (_a) {
774
787
  : activeRows;
775
788
  console.log("activeDragItemOrSelectedItem", activeDragItemOrSelectedItem);
776
789
  console.log("selectedBlockId", selectedBlockId);
790
+ console.log('curentgroupblocks"', currentGroupBlocks);
777
791
  console.log("selectedLayoutItem", selectedLayoutItem);
778
792
  console.log("activeBlock", activeBlock);
779
793
  console.log("activeRowsFiltered", activeRowsFiltered);
@@ -62,5 +62,12 @@ export declare const addBulkToTarget: (block: Block, targetId: string, bulkBlock
62
62
  export declare function getBlockWorkDirPath(blockStructure: Block, targetBlockId: string): string;
63
63
  export declare function formatBlockIdToCbId(blockId: string): number | null;
64
64
  export declare function formatCbIdToBlockId(cbId: number): string;
65
+ export declare function getBlockIdKind(blockId: string): {
66
+ type: "GB";
67
+ id: string;
68
+ } | {
69
+ type: "CB";
70
+ id: string;
71
+ } | null;
65
72
  export declare function findParentGroupBlock(current: Block, targetBlockId: string): GroupBlock | null;
66
73
  export declare function findOneComponentBlock(current: Block, targetBlockId: string): number | null;
@@ -250,6 +250,21 @@ export function formatBlockIdToCbId(blockId) {
250
250
  export function formatCbIdToBlockId(cbId) {
251
251
  return "CB_".concat(cbId);
252
252
  }
253
+ export function getBlockIdKind(blockId) {
254
+ if (/^GB_.+$/i.test(blockId)) {
255
+ return {
256
+ type: "GB",
257
+ id: blockId,
258
+ };
259
+ }
260
+ if (/^CB_\d+$/i.test(blockId)) {
261
+ return {
262
+ type: "CB",
263
+ id: formatBlockIdToCbId(blockId).toString(),
264
+ };
265
+ }
266
+ return null;
267
+ }
253
268
  // export const findAccessibleChildrenBlocks = (
254
269
  // block: Block,
255
270
  // targetGroupId: string,
@@ -565,7 +565,9 @@ function log() {
565
565
  }
566
566
  export var noop = function (_args) { return undefined; };
567
567
  export function getBoundingArea(layout, ids) {
568
- var layoutItems = ids.map(function (id) { return getLayoutItem(layout, id); }).filter(function (item) { return item !== undefined; });
568
+ var layoutItems = ids
569
+ .map(function (id) { return getLayoutItem(layout, id); })
570
+ .filter(function (item) { return item !== undefined; });
569
571
  if (layoutItems.length === 0) {
570
572
  return null;
571
573
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.377",
3
+ "version": "0.0.379",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",