publ-echo-test 0.0.64 → 0.0.67

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 { findAllChildrenButGroup, findAllChildrenIds, findChildrenIds, findGroupBlocks, getBlockSpecificType, zIndexMap } from "./group";
40
+ import { findAllChildrenComponentIds, findChildrenIds, findGroupBlocks, 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";
@@ -139,6 +139,7 @@ var ReactGridLayout = function (_a) {
139
139
  var _b;
140
140
  var e = _a.e, node = _a.node;
141
141
  var l = (_b = getLayoutItem(layout, i)) !== null && _b !== void 0 ? _b : { i: i, x: x, y: y, w: 1, h: 1 };
142
+ console.log(l);
142
143
  if (!l)
143
144
  return;
144
145
  setOldDragItem(cloneLayoutItem(l));
@@ -147,7 +148,7 @@ var ReactGridLayout = function (_a) {
147
148
  if (!blockStructure) {
148
149
  return;
149
150
  }
150
- var childrenIds = findAllChildrenButGroup(blockStructure, i);
151
+ var childrenIds = findAllChildrenComponentIds(blockStructure, i).map(function (i) { return i.toString(); });
151
152
  var children_1 = childrenIds.map(function (id) {
152
153
  var item = getLayoutItem(layout, id);
153
154
  return cloneLayoutItem(item);
@@ -582,7 +583,7 @@ var ReactGridLayout = function (_a) {
582
583
  if (!blockStructure) {
583
584
  return;
584
585
  }
585
- var childrenIds = findAllChildrenIds(blockStructure, block.blockId);
586
+ var childrenIds = findAllChildrenComponentIds(blockStructure, block.blockId).map(function (i) { return i.toString(); });
586
587
  var groupItem = getBoundingArea(layout, childrenIds);
587
588
  // const draggable =
588
589
  // typeof l.isDraggable === "boolean"
@@ -43,10 +43,10 @@ export type BulkBlockInternal = {
43
43
  export declare const findBlockById: (blocks: Block[], blockId: string) => Block | null;
44
44
  export declare const findChildrenIds: (blockStructure: Block[], targetId: string) => string[];
45
45
  export declare const findAllChildrenIds: (blockStructure: Block[], targetId: string) => string[];
46
+ export declare const findAllChildrenComponentIds: (blockStructure: Block[], targetId: string) => number[];
46
47
  export declare const findAllParentGroups: (blockStructure: Block[], targetId: string) => GroupBlock[];
47
- export declare const findAllChildrenButGroup: (blockStructure: Block[], targetId: string) => string[];
48
48
  export declare const findGroupBlocks: (blockStructure: Block[], targetId: string) => GroupBlock[];
49
- export declare const findAllComponentBlockIds: (blockStructure: Block[]) => string[];
49
+ export declare const findAllComponentBlockIds: (blockStructure: Block[]) => number[];
50
50
  export declare const findParentGroupByGroupId: (blockStructure: Block[], targetId: string) => string | null;
51
51
  export declare const addBlockToRoot: (blockStructure: Block[], newBlock: Block) => Block[];
52
52
  export declare const addBulkToTarget: (blockStructure: Block[], targetId: string, bulkIds: string[]) => Block[];
@@ -71,6 +71,23 @@ export var findAllChildrenIds = function (blockStructure, targetId) {
71
71
  var targetBlock = findBlockById(blockStructure, targetId);
72
72
  return targetBlock ? collectChildrenIds(targetBlock) : [];
73
73
  };
74
+ export var findAllChildrenComponentIds = function (blockStructure, targetId) {
75
+ var collectComponentIds = function (block) {
76
+ var ids = [];
77
+ if ('children' in block && block.children) {
78
+ for (var _i = 0, _a = block.children; _i < _a.length; _i++) {
79
+ var child = _a[_i];
80
+ if (child.type === 'COMPONENT_BLOCK') {
81
+ ids.push(child.componentBlockId);
82
+ }
83
+ ids = ids.concat(collectComponentIds(child));
84
+ }
85
+ }
86
+ return ids;
87
+ };
88
+ var targetBlock = findBlockById(blockStructure, targetId);
89
+ return targetBlock ? collectComponentIds(targetBlock) : [];
90
+ };
74
91
  export var findAllParentGroups = function (blockStructure, targetId) {
75
92
  var findParentGroups = function (blocks, id, parents) {
76
93
  if (parents === void 0) { parents = []; }
@@ -90,23 +107,22 @@ export var findAllParentGroups = function (blockStructure, targetId) {
90
107
  };
91
108
  return findParentGroups(blockStructure, targetId) || [];
92
109
  };
93
- export var findAllChildrenButGroup = function (blockStructure, targetId) {
94
- var collectChildrenIds = function (block) {
95
- var ids = [];
96
- if ('children' in block && block.children) {
97
- for (var _i = 0, _a = block.children; _i < _a.length; _i++) {
98
- var child = _a[_i];
99
- if (child.type !== 'GROUP_BLOCK') {
100
- ids.push(child.blockId);
101
- }
102
- ids = ids.concat(collectChildrenIds(child));
103
- }
104
- }
105
- return ids;
106
- };
107
- var targetBlock = findBlockById(blockStructure, targetId);
108
- return targetBlock ? collectChildrenIds(targetBlock) : [];
109
- };
110
+ // export const findAllChildrenButGroup = (blockStructure: Block[], targetId: string): string[] => {
111
+ // const collectChildrenIds = (block: Block): string[] => {
112
+ // let ids: string[] = [];
113
+ // if ('children' in block && block.children) {
114
+ // for (const child of block.children) {
115
+ // if (child.type !== 'GROUP_BLOCK') {
116
+ // ids.push(child.blockId);
117
+ // }
118
+ // ids = ids.concat(collectChildrenIds(child));
119
+ // }
120
+ // }
121
+ // return ids;
122
+ // };
123
+ // const targetBlock = findBlockById(blockStructure, targetId);
124
+ // return targetBlock ? collectChildrenIds(targetBlock) : [];
125
+ // };
110
126
  export var findGroupBlocks = function (blockStructure, targetId) {
111
127
  var targetBlock = findBlockById(blockStructure, targetId);
112
128
  var groupBlocks = [];
@@ -130,7 +146,7 @@ export var findAllComponentBlockIds = function (blockStructure) {
130
146
  for (var _i = 0, blocks_3 = blocks; _i < blocks_3.length; _i++) {
131
147
  var block = blocks_3[_i];
132
148
  if (block.type === 'COMPONENT_BLOCK') {
133
- ids.push(block.blockId);
149
+ ids.push(block.componentBlockId);
134
150
  }
135
151
  if ('children' in block && block.children) {
136
152
  ids = ids.concat(collectComponentBlockIds(block.children));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.64",
3
+ "version": "0.0.67",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",