publ-echo-test 0.0.81 → 0.0.83
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.
@@ -51,4 +51,5 @@ export declare const findParentGroupByGroupId: (blockStructure: Block[], targetI
|
|
51
51
|
export declare const addBlockToRoot: (blockStructure: Block[], newBlock: Block) => Block[];
|
52
52
|
export declare const addBulkToTarget: (blockStructure: Block[], targetId: string, bulkIds: string[]) => Block[];
|
53
53
|
export declare const getBlockWorkDirPath: (blockStructure: Block[], blockId: string) => string | null;
|
54
|
+
export declare const getBlockIdByComponentId: (blockStructure: Block[], componentId: number) => string | null;
|
54
55
|
export declare const blockStructure: Block[];
|
@@ -196,7 +196,7 @@ export var addBulkToTarget = function (blockStructure, targetId, bulkIds // comp
|
|
196
196
|
return blockStructure;
|
197
197
|
}
|
198
198
|
var bulkBlocks = targetBlock.children.filter(function (child) {
|
199
|
-
if (child.type === 'COMPONENT_BLOCK' && bulkIds.includes(child.
|
199
|
+
if (child.type === 'COMPONENT_BLOCK' && bulkIds.includes(child.blockId.toString())) {
|
200
200
|
return true;
|
201
201
|
}
|
202
202
|
if (child.type === 'GROUP_BLOCK' && bulkIds.includes(child.blockId)) {
|
@@ -247,6 +247,24 @@ export var getBlockWorkDirPath = function (blockStructure, blockId) {
|
|
247
247
|
var path = findPath(blockStructure, blockId, ['']);
|
248
248
|
return path ? path.join('/') : null;
|
249
249
|
};
|
250
|
+
export var getBlockIdByComponentId = function (blockStructure, componentId) {
|
251
|
+
var findBlock = function (blocks) {
|
252
|
+
for (var _i = 0, blocks_6 = blocks; _i < blocks_6.length; _i++) {
|
253
|
+
var block = blocks_6[_i];
|
254
|
+
if (block.type === 'COMPONENT_BLOCK' && block.componentBlockId === componentId) {
|
255
|
+
return block.blockId;
|
256
|
+
}
|
257
|
+
if ('children' in block && block.children) {
|
258
|
+
var result = findBlock(block.children);
|
259
|
+
if (result) {
|
260
|
+
return result;
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}
|
264
|
+
return null;
|
265
|
+
};
|
266
|
+
return findBlock(blockStructure);
|
267
|
+
};
|
250
268
|
export var blockStructure = [
|
251
269
|
{
|
252
270
|
blockId: 'ROOT',
|