publ-echo-test 0.0.120 → 0.0.123
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.
@@ -46,7 +46,7 @@ export declare const findDirectChildrenCbIds: (block: Block, targetId: string) =
|
|
46
46
|
export declare const findAllChildrenCbIds: (block: Block, targetId: string) => number[];
|
47
47
|
export declare const findAllChildrenBlockIds: (block: Block, targetId: string) => string[];
|
48
48
|
export declare const findDirectChildrenBlockIds: (block: Block, targetId: string) => string[];
|
49
|
-
export declare const findGroupBlocks: (
|
49
|
+
export declare const findGroupBlocks: (block: Block, targetId: string) => GroupBlock[];
|
50
50
|
export declare const addBulkToTarget: (block: Block, targetId: string, bulkBlockIds: string[]) => Block;
|
51
51
|
export declare const getBlockWorkDirPath: (block: Block, blockId: string) => string | null;
|
52
52
|
export declare function formatBlockIdToCbId(blockId: string): number | null;
|
@@ -98,36 +98,41 @@ export var findDirectChildrenBlockIds = function (block, targetId) {
|
|
98
98
|
}
|
99
99
|
return collectChildrenBlockIds(targetBlock, 'current');
|
100
100
|
};
|
101
|
-
export var findGroupBlocks = function (
|
102
|
-
var targetBlock = findBlockByBlockId(
|
103
|
-
|
104
|
-
if (targetBlock
|
105
|
-
|
106
|
-
|
107
|
-
// Include BULK children if present
|
108
|
-
var bulkBlocks = targetBlock.children.filter(function (child) { return child.blockId === 'BULK'; });
|
109
|
-
bulkBlocks.forEach(function (bulk) {
|
110
|
-
if ('children' in bulk && bulk.children) {
|
111
|
-
groupBlocks.push.apply(groupBlocks, bulk.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; }));
|
112
|
-
}
|
113
|
-
});
|
114
|
-
return groupBlocks;
|
115
|
-
}
|
101
|
+
export var findGroupBlocks = function (block, targetId) {
|
102
|
+
var targetBlock = findBlockByBlockId(block, targetId);
|
103
|
+
// const groupBlocks: Set<GroupBlock> = new Set();
|
104
|
+
if (!targetBlock) {
|
105
|
+
console.error('Target block not found');
|
106
|
+
return [];
|
116
107
|
}
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
});
|
128
|
-
}
|
108
|
+
// const addGroupBlocks = (block: GroupBlock | BulkBlockInternal) => {
|
109
|
+
// block.children.forEach(child => {
|
110
|
+
// if (child.type === 'GROUP_BLOCK') {
|
111
|
+
// groupBlocks.add(child as GroupBlock);
|
112
|
+
// }
|
113
|
+
// });
|
114
|
+
// };
|
115
|
+
if (targetBlock.type !== 'GROUP_BLOCK') {
|
116
|
+
console.error('Target block is not a group block');
|
117
|
+
return [];
|
129
118
|
}
|
119
|
+
var groupBlocks = targetBlock.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; });
|
130
120
|
return groupBlocks;
|
121
|
+
// if (targetBlock.blockId === 'ROOT') {
|
122
|
+
// addGroupBlocks(targetBlock as RootBlock);
|
123
|
+
// }
|
124
|
+
// if (targetBlock.type === 'GROUP_BLOCK') {
|
125
|
+
// groupBlocks.add(targetBlock as GroupBlock);
|
126
|
+
// addGroupBlocks(targetBlock);
|
127
|
+
// }
|
128
|
+
// // Handle BULK blocks
|
129
|
+
// if (targetBlock.type === 'GROUP_BLOCK') {
|
130
|
+
// const bulkBlocks = targetBlock.children.filter(child => child.blockId === 'BULK') as BulkBlockInternal[];
|
131
|
+
// bulkBlocks.forEach(bulk => {
|
132
|
+
// addGroupBlocks(bulk);
|
133
|
+
// });
|
134
|
+
// }
|
135
|
+
// return Array.from(groupBlocks); // Convert Set back to array
|
131
136
|
};
|
132
137
|
// export const findAllComponentBlockIds = (blockStructure: Block[]): number[] => {
|
133
138
|
// const collectComponentBlockIds = (blocks: Block[]): number[] => {
|
@@ -221,8 +226,8 @@ var findPath = function (block, id, path) {
|
|
221
226
|
if (child.blockId === id) {
|
222
227
|
return currentPath;
|
223
228
|
}
|
224
|
-
if ('children' in
|
225
|
-
var result = findPath(
|
229
|
+
if ('children' in child && child.children) {
|
230
|
+
var result = findPath(child, id, currentPath); // Pass the correct child block here
|
226
231
|
if (result) {
|
227
232
|
return result;
|
228
233
|
}
|