publ-echo-test 0.0.333 → 0.0.335
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.
@@ -577,7 +577,7 @@ var ReactGridLayout = function (_a) {
|
|
577
577
|
return zIndexMap.ROOT + z;
|
578
578
|
}
|
579
579
|
if (isRoot && !editable) {
|
580
|
-
return
|
580
|
+
return z;
|
581
581
|
}
|
582
582
|
if (!editable) {
|
583
583
|
return z;
|
@@ -696,7 +696,7 @@ var ReactGridLayout = function (_a) {
|
|
696
696
|
return zIndexMap.EDITABLE_GROUP + internalZOrder;
|
697
697
|
}
|
698
698
|
if (type === "GROUP_BLOCK") {
|
699
|
-
return
|
699
|
+
return zIndexMap.ROOT + zIndexMap.GROUP;
|
700
700
|
}
|
701
701
|
return -1; // NOTE: ERROR
|
702
702
|
})();
|
@@ -12,34 +12,34 @@ export declare function getBlockSpecificType(block: Block): "ROOT" | "BULK" | "C
|
|
12
12
|
export type SectionPedigree = RootBlock;
|
13
13
|
export type Block = ComponentBlock | GroupBlock | RootBlock;
|
14
14
|
export type ZOrder = {
|
15
|
-
[platform in
|
15
|
+
[platform in "mobile" | "desktop"]: {
|
16
16
|
[componentBlockId: string]: number;
|
17
17
|
};
|
18
18
|
};
|
19
19
|
export type ComponentBlock = {
|
20
20
|
blockId: string;
|
21
|
-
type:
|
21
|
+
type: "COMPONENT_BLOCK";
|
22
22
|
zOrderDesktopInternal: number | null;
|
23
23
|
zOrderMobileInternal: number | null;
|
24
24
|
componentBlockId: number;
|
25
25
|
};
|
26
26
|
export type GroupBlock = {
|
27
27
|
blockId: string;
|
28
|
-
type:
|
28
|
+
type: "GROUP_BLOCK";
|
29
29
|
zOrderDesktopInternal: number | null;
|
30
30
|
zOrderMobileInternal: number | null;
|
31
31
|
children: (ComponentBlock | GroupBlock)[];
|
32
32
|
};
|
33
33
|
export type RootBlock = {
|
34
|
-
blockId:
|
35
|
-
type:
|
34
|
+
blockId: "ROOT";
|
35
|
+
type: "GROUP_BLOCK";
|
36
36
|
zOrderDesktopInternal: number | null;
|
37
37
|
zOrderMobileInternal: number | null;
|
38
38
|
children: (ComponentBlock | GroupBlock)[];
|
39
39
|
};
|
40
40
|
export type BulkBlockInternal = {
|
41
|
-
blockId:
|
42
|
-
type:
|
41
|
+
blockId: "BULK";
|
42
|
+
type: "GROUP_BLOCK";
|
43
43
|
zOrderDesktopInternal: number;
|
44
44
|
zOrderMobileInternal: number;
|
45
45
|
children: (ComponentBlock | GroupBlock)[];
|
@@ -15,27 +15,27 @@ export var zIndexMap = {
|
|
15
15
|
EDITING_GROUP: 9000,
|
16
16
|
GROUP: 5000,
|
17
17
|
CB: 0,
|
18
|
-
ROOT:
|
18
|
+
ROOT: 20000, //?
|
19
19
|
};
|
20
20
|
export function getBlockSpecificType(block) {
|
21
|
-
if (block.blockId ===
|
22
|
-
return
|
21
|
+
if (block.blockId === "ROOT") {
|
22
|
+
return "ROOT";
|
23
23
|
}
|
24
|
-
if (block.blockId ===
|
25
|
-
return
|
24
|
+
if (block.blockId === "BULK") {
|
25
|
+
return "BULK";
|
26
26
|
}
|
27
27
|
return block.type;
|
28
28
|
}
|
29
29
|
var deepClone = function (blocks) { return JSON.parse(JSON.stringify(blocks)); };
|
30
30
|
var collectChildrenCbIds = function (block, depth) {
|
31
31
|
var ids = [];
|
32
|
-
if (
|
32
|
+
if ("children" in block && block.children) {
|
33
33
|
for (var _i = 0, _a = block.children; _i < _a.length; _i++) {
|
34
34
|
var child = _a[_i];
|
35
|
-
if (child.type ===
|
35
|
+
if (child.type === "COMPONENT_BLOCK") {
|
36
36
|
ids.push(child.componentBlockId);
|
37
37
|
}
|
38
|
-
if (depth ===
|
38
|
+
if (depth === "deep" && child.type === "GROUP_BLOCK") {
|
39
39
|
ids = ids.concat(collectChildrenCbIds(child, depth));
|
40
40
|
}
|
41
41
|
}
|
@@ -44,11 +44,11 @@ var collectChildrenCbIds = function (block, depth) {
|
|
44
44
|
};
|
45
45
|
var collectChildrenBlockIds = function (block, depth) {
|
46
46
|
var ids = [];
|
47
|
-
if (
|
47
|
+
if ("children" in block && block.children) {
|
48
48
|
for (var _i = 0, _a = block.children; _i < _a.length; _i++) {
|
49
49
|
var child = _a[_i];
|
50
50
|
ids.push(child.blockId);
|
51
|
-
if (depth ===
|
51
|
+
if (depth === "deep") {
|
52
52
|
ids = ids.concat(collectChildrenBlockIds(child, depth));
|
53
53
|
}
|
54
54
|
}
|
@@ -56,10 +56,10 @@ var collectChildrenBlockIds = function (block, depth) {
|
|
56
56
|
return ids;
|
57
57
|
};
|
58
58
|
export var findBlockByBlockId = function (block, blockId) {
|
59
|
-
if (block.type !==
|
59
|
+
if (block.type !== "GROUP_BLOCK" || block.children.length === 0) {
|
60
60
|
return null;
|
61
61
|
}
|
62
|
-
if (block.blockId ===
|
62
|
+
if (block.blockId === "ROOT" && blockId === "ROOT") {
|
63
63
|
return block;
|
64
64
|
}
|
65
65
|
for (var _i = 0, _a = block.children; _i < _a.length; _i++) {
|
@@ -67,7 +67,7 @@ export var findBlockByBlockId = function (block, blockId) {
|
|
67
67
|
if (child.blockId === blockId) {
|
68
68
|
return child;
|
69
69
|
}
|
70
|
-
if (child.type ===
|
70
|
+
if (child.type === "GROUP_BLOCK" && child.children) {
|
71
71
|
var found = findBlockByBlockId(child, blockId);
|
72
72
|
if (found) {
|
73
73
|
return found;
|
@@ -78,31 +78,31 @@ export var findBlockByBlockId = function (block, blockId) {
|
|
78
78
|
};
|
79
79
|
export var findDirectChildrenCbIds = function (block, targetId) {
|
80
80
|
var targetBlock = findBlockByBlockId(block, targetId);
|
81
|
-
if (!targetBlock || targetBlock.type !==
|
81
|
+
if (!targetBlock || targetBlock.type !== "GROUP_BLOCK") {
|
82
82
|
return [];
|
83
83
|
}
|
84
|
-
return collectChildrenCbIds(targetBlock,
|
84
|
+
return collectChildrenCbIds(targetBlock, "current");
|
85
85
|
};
|
86
86
|
export var findAllChildrenCbIds = function (block, targetId) {
|
87
87
|
var targetBlock = findBlockByBlockId(block, targetId);
|
88
|
-
if (!targetBlock || targetBlock.type !==
|
88
|
+
if (!targetBlock || targetBlock.type !== "GROUP_BLOCK") {
|
89
89
|
return [];
|
90
90
|
}
|
91
|
-
return collectChildrenCbIds(targetBlock,
|
91
|
+
return collectChildrenCbIds(targetBlock, "deep");
|
92
92
|
};
|
93
93
|
export var findAllChildrenBlockIds = function (block, targetId) {
|
94
94
|
var targetBlock = findBlockByBlockId(block, targetId);
|
95
|
-
if (!targetBlock || targetBlock.type !==
|
95
|
+
if (!targetBlock || targetBlock.type !== "GROUP_BLOCK") {
|
96
96
|
return [];
|
97
97
|
}
|
98
|
-
return collectChildrenBlockIds(targetBlock,
|
98
|
+
return collectChildrenBlockIds(targetBlock, "deep");
|
99
99
|
};
|
100
100
|
export var findDirectChildrenBlockIds = function (block, targetId) {
|
101
101
|
var targetBlock = findBlockByBlockId(block, targetId);
|
102
|
-
if (!targetBlock || targetBlock.type !==
|
102
|
+
if (!targetBlock || targetBlock.type !== "GROUP_BLOCK") {
|
103
103
|
return [];
|
104
104
|
}
|
105
|
-
return collectChildrenBlockIds(targetBlock,
|
105
|
+
return collectChildrenBlockIds(targetBlock, "current");
|
106
106
|
};
|
107
107
|
// NOTE: 타겟과 하위 모두.
|
108
108
|
export var findGroupBlocks = function (block, targetId) {
|
@@ -110,21 +110,21 @@ export var findGroupBlocks = function (block, targetId) {
|
|
110
110
|
if (!targetBlock) {
|
111
111
|
return [];
|
112
112
|
}
|
113
|
-
if (targetBlock.type !==
|
113
|
+
if (targetBlock.type !== "GROUP_BLOCK") {
|
114
114
|
return [];
|
115
115
|
}
|
116
|
-
var groupBlocks = targetBlock.children.filter(function (child) { return child.type ===
|
117
|
-
var bulkInTarget = targetBlock.children.find(function (block) { return block.blockId ===
|
118
|
-
if (bulkInTarget && bulkInTarget.type ===
|
119
|
-
var groupInBulk = bulkInTarget.children.filter(function (child) { return child.type ===
|
120
|
-
if (targetBlock.blockId ===
|
116
|
+
var groupBlocks = targetBlock.children.filter(function (child) { return child.type === "GROUP_BLOCK"; });
|
117
|
+
var bulkInTarget = targetBlock.children.find(function (block) { return block.blockId === "BULK"; });
|
118
|
+
if (bulkInTarget && bulkInTarget.type === "GROUP_BLOCK") {
|
119
|
+
var groupInBulk = bulkInTarget.children.filter(function (child) { return child.type === "GROUP_BLOCK"; });
|
120
|
+
if (targetBlock.blockId === "ROOT") {
|
121
121
|
return groupBlocks.concat(groupInBulk);
|
122
122
|
}
|
123
123
|
if (groupInBulk && groupInBulk.length > 0) {
|
124
124
|
return [targetBlock].concat(groupBlocks).concat(groupInBulk);
|
125
125
|
}
|
126
126
|
}
|
127
|
-
if (targetBlock.blockId ===
|
127
|
+
if (targetBlock.blockId === "ROOT") {
|
128
128
|
return groupBlocks;
|
129
129
|
}
|
130
130
|
return [targetBlock].concat(groupBlocks);
|
@@ -180,16 +180,16 @@ export var addBulkToTarget = function (block, targetId, bulkBlockIds) {
|
|
180
180
|
var blockCopy = deepClone(block);
|
181
181
|
var targetBlock = findBlockByBlockId(blockCopy, targetId);
|
182
182
|
if (!targetBlock ||
|
183
|
-
targetBlock.type !==
|
183
|
+
targetBlock.type !== "GROUP_BLOCK" ||
|
184
184
|
!targetBlock.children) {
|
185
185
|
return block;
|
186
186
|
}
|
187
187
|
var bulkBlocks = targetBlock.children.filter(function (child) {
|
188
|
-
if (child.type ===
|
188
|
+
if (child.type === "COMPONENT_BLOCK" &&
|
189
189
|
bulkBlockIds.includes(child.blockId.toString())) {
|
190
190
|
return true;
|
191
191
|
}
|
192
|
-
if (child.type ===
|
192
|
+
if (child.type === "GROUP_BLOCK" && bulkBlockIds.includes(child.blockId)) {
|
193
193
|
return true;
|
194
194
|
}
|
195
195
|
return false;
|
@@ -212,8 +212,8 @@ export var addBulkToTarget = function (block, targetId, bulkBlockIds) {
|
|
212
212
|
var zOrderMobileInternal = Math.max.apply(Math, zOrdersMobile);
|
213
213
|
// Create the new bulkBlock
|
214
214
|
var bulkBlock = {
|
215
|
-
blockId:
|
216
|
-
type:
|
215
|
+
blockId: "BULK",
|
216
|
+
type: "GROUP_BLOCK",
|
217
217
|
zOrderDesktopInternal: zOrderDesktopInternal,
|
218
218
|
zOrderMobileInternal: zOrderMobileInternal,
|
219
219
|
children: bulkBlocks,
|
@@ -226,7 +226,7 @@ function findPathHelper(current, targetBlockId) {
|
|
226
226
|
if (current.blockId === targetBlockId) {
|
227
227
|
return [current.blockId];
|
228
228
|
}
|
229
|
-
if (
|
229
|
+
if ("children" in current && Array.isArray(current.children)) {
|
230
230
|
for (var _i = 0, _a = current.children; _i < _a.length; _i++) {
|
231
231
|
var child = _a[_i];
|
232
232
|
var result = findPathHelper(child, targetBlockId);
|
@@ -239,7 +239,7 @@ function findPathHelper(current, targetBlockId) {
|
|
239
239
|
}
|
240
240
|
export function getBlockWorkDirPath(blockStructure, targetBlockId) {
|
241
241
|
var path = findPathHelper(blockStructure, targetBlockId);
|
242
|
-
return path ?
|
242
|
+
return path ? "/" + path.join("/") : "";
|
243
243
|
}
|
244
244
|
export function formatBlockIdToCbId(blockId) {
|
245
245
|
var match = blockId.match(/^CB_(\d+)$/);
|
@@ -284,22 +284,22 @@ export function formatCbIdToBlockId(cbId) {
|
|
284
284
|
// };
|
285
285
|
export function findParentGroupBlock(current, targetBlockId) {
|
286
286
|
// 현재 블록이 그룹(또는 루트) 블록이고, 자식이 있다면 탐색합니다.
|
287
|
-
if (
|
287
|
+
if ("children" in current && Array.isArray(current.children)) {
|
288
288
|
for (var _i = 0, _a = current.children; _i < _a.length; _i++) {
|
289
289
|
var child = _a[_i];
|
290
290
|
// 자식 중에 targetBlockId를 가진 블록이 있다면,
|
291
291
|
if (child.blockId === targetBlockId) {
|
292
292
|
// 현재 블록이 ROOT라면 부모가 ROOT이므로 null 반환
|
293
|
-
if (current.blockId ===
|
293
|
+
if (current.blockId === "ROOT") {
|
294
294
|
return null;
|
295
295
|
}
|
296
296
|
// 그렇지 않다면 현재 블록이 부모 그룹 블록이므로 반환
|
297
|
-
if (current.type ===
|
297
|
+
if (current.type === "GROUP_BLOCK") {
|
298
298
|
return current;
|
299
299
|
}
|
300
300
|
}
|
301
301
|
// 만약 자식이 그룹 블록이라면 재귀적으로 탐색
|
302
|
-
if (child.type ===
|
302
|
+
if (child.type === "GROUP_BLOCK") {
|
303
303
|
var found = findParentGroupBlock(child, targetBlockId);
|
304
304
|
if (found !== null) {
|
305
305
|
return found;
|
@@ -313,24 +313,24 @@ export function findParentGroupBlock(current, targetBlockId) {
|
|
313
313
|
export function findOneComponentBlock(current, targetBlockId) {
|
314
314
|
var targetBlock = findBlockByBlockId(current, targetBlockId);
|
315
315
|
if (!targetBlock) {
|
316
|
-
console.error(
|
316
|
+
console.error("Target block not found");
|
317
317
|
return null;
|
318
318
|
}
|
319
|
-
if (targetBlock.type !==
|
320
|
-
console.error(
|
319
|
+
if (targetBlock.type !== "GROUP_BLOCK") {
|
320
|
+
console.error("Target block is not a group block");
|
321
321
|
return null;
|
322
322
|
}
|
323
323
|
// 직속 하위에서 먼저 찾기
|
324
324
|
for (var _i = 0, _a = targetBlock.children; _i < _a.length; _i++) {
|
325
325
|
var child = _a[_i];
|
326
|
-
if (child.type ===
|
326
|
+
if (child.type === "COMPONENT_BLOCK") {
|
327
327
|
return child.componentBlockId;
|
328
328
|
}
|
329
329
|
}
|
330
330
|
// 직속 하위에 없다면 재귀적으로 찾기
|
331
331
|
for (var _b = 0, _c = targetBlock.children; _b < _c.length; _b++) {
|
332
332
|
var child = _c[_b];
|
333
|
-
if (child.type ===
|
333
|
+
if (child.type === "GROUP_BLOCK") {
|
334
334
|
var found = findOneComponentBlock(child, child.blockId);
|
335
335
|
if (found !== null) {
|
336
336
|
return found;
|