@next-core/editor-bricks-helper 0.34.0 → 0.35.2
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.
- package/CHANGELOG.md +23 -46
- package/README.md +2 -2
- package/dist/index.bundle.js +112 -37
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +112 -37
- package/dist/index.esm.js.map +1 -1
- package/dist/types/DropZone/DropZone.d.ts +2 -1
- package/dist/types/hooks/useBuilderGroupedChildNodes.d.ts +4 -2
- package/dist/types/hooks/useBuilderNode.d.ts +2 -1
- package/dist/types/interfaces.d.ts +1 -0
- package/dist/types/internal/BuilderDataManager.d.ts +1 -0
- package/dist/types/internal/deleteNodeFromTree.d.ts +1 -1
- package/dist/types/internal/getAppendingNodesAndEdges.d.ts +2 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,118 +3,95 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
## [0.35.2](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.35.1...@next-core/editor-bricks-helper@0.35.2) (2022-03-04)
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
10
9
|
|
|
11
|
-
* export type BuilderDataManager ([1c9f821](https://github.com/easyops-cn/next-core/commit/1c9f8217f7a3feee77f7f0544fc46a95942648f7))
|
|
12
10
|
|
|
13
11
|
|
|
14
|
-
### Features
|
|
15
12
|
|
|
16
|
-
* record brick instance id in storyboard for development ([9d1193e](https://github.com/easyops-cn/next-core/commit/9d1193e11cf5cd35d10d36afe4f07a52a7f7841a))
|
|
17
13
|
|
|
14
|
+
## [0.35.1](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.35.0...@next-core/editor-bricks-helper@0.35.1) (2022-03-04)
|
|
18
15
|
|
|
16
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
19
17
|
|
|
20
18
|
|
|
21
19
|
|
|
22
|
-
## [0.33.35](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.34...@next-core/editor-bricks-helper@0.33.35) (2022-02-17)
|
|
23
20
|
|
|
24
|
-
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
25
21
|
|
|
22
|
+
# [0.35.0](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.34.0...@next-core/editor-bricks-helper@0.35.0) (2022-02-28)
|
|
26
23
|
|
|
27
24
|
|
|
25
|
+
### Features
|
|
28
26
|
|
|
27
|
+
* support wrapper theme hidden ([87e3299](https://github.com/easyops-cn/next-core/commit/87e32997e496718d6d27e213b93b265dc3540ac6))
|
|
28
|
+
* update type ([f07ac57](https://github.com/easyops-cn/next-core/commit/f07ac57c12a867d3a6eada0838d2e7f2742d6478))
|
|
29
|
+
* update type ([a32c5b1](https://github.com/easyops-cn/next-core/commit/a32c5b1c6ae8a7496a2e58e45c65097f94188e9b))
|
|
30
|
+
* update unit test ([4f8b06c](https://github.com/easyops-cn/next-core/commit/4f8b06c3cfdd4d46ad97d2cade76a7f0712d2cf0))
|
|
31
|
+
* update unit test ([cd8c97c](https://github.com/easyops-cn/next-core/commit/cd8c97c98160867f4b81e183fd40bd1fa037ac01))
|
|
29
32
|
|
|
30
|
-
## [0.33.34](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.33...@next-core/editor-bricks-helper@0.33.34) (2022-02-17)
|
|
31
33
|
|
|
32
|
-
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
|
|
37
|
+
# [0.34.0](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.35...@next-core/editor-bricks-helper@0.34.0) (2022-02-21)
|
|
36
38
|
|
|
39
|
+
### Bug Fixes
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
41
|
+
- export type BuilderDataManager ([1c9f821](https://github.com/easyops-cn/next-core/commit/1c9f8217f7a3feee77f7f0544fc46a95942648f7))
|
|
41
42
|
|
|
43
|
+
### Features
|
|
42
44
|
|
|
45
|
+
- record brick instance id in storyboard for development ([9d1193e](https://github.com/easyops-cn/next-core/commit/9d1193e11cf5cd35d10d36afe4f07a52a7f7841a))
|
|
43
46
|
|
|
47
|
+
## [0.33.35](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.34...@next-core/editor-bricks-helper@0.33.35) (2022-02-17)
|
|
44
48
|
|
|
49
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
45
50
|
|
|
46
|
-
## [0.33.
|
|
51
|
+
## [0.33.34](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.33...@next-core/editor-bricks-helper@0.33.34) (2022-02-17)
|
|
47
52
|
|
|
48
53
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
49
54
|
|
|
55
|
+
## [0.33.33](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.32...@next-core/editor-bricks-helper@0.33.33) (2022-02-17)
|
|
50
56
|
|
|
57
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
51
58
|
|
|
59
|
+
## [0.33.32](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.31...@next-core/editor-bricks-helper@0.33.32) (2022-02-15)
|
|
52
60
|
|
|
61
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
53
62
|
|
|
54
63
|
## [0.33.31](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.30...@next-core/editor-bricks-helper@0.33.31) (2022-02-15)
|
|
55
64
|
|
|
56
65
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
67
|
## [0.33.30](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.29...@next-core/editor-bricks-helper@0.33.30) (2022-02-15)
|
|
63
68
|
|
|
64
69
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
65
70
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
71
|
## [0.33.29](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.28...@next-core/editor-bricks-helper@0.33.29) (2022-02-15)
|
|
71
72
|
|
|
72
73
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
75
|
## [0.33.28](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.27...@next-core/editor-bricks-helper@0.33.28) (2022-02-15)
|
|
79
76
|
|
|
80
77
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
81
78
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
79
|
## [0.33.27](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.26...@next-core/editor-bricks-helper@0.33.27) (2022-02-14)
|
|
87
80
|
|
|
88
81
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
89
82
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
83
|
## [0.33.26](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.25...@next-core/editor-bricks-helper@0.33.26) (2022-02-14)
|
|
95
84
|
|
|
96
85
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
97
86
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
87
|
## [0.33.25](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.24...@next-core/editor-bricks-helper@0.33.25) (2022-01-28)
|
|
103
88
|
|
|
104
89
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
105
90
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
91
|
## [0.33.24](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.23...@next-core/editor-bricks-helper@0.33.24) (2022-01-28)
|
|
111
92
|
|
|
112
93
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
113
94
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
95
|
## [0.33.23](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.33.22...@next-core/editor-bricks-helper@0.33.23) (2022-01-27)
|
|
119
96
|
|
|
120
97
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
package/README.md
CHANGED
|
@@ -4,10 +4,10 @@ Generated by [@next-core/brick-scripts] v2.0.4
|
|
|
4
4
|
|
|
5
5
|
## Development
|
|
6
6
|
|
|
7
|
-
`lerna run start --scope=@
|
|
7
|
+
`lerna run start --scope=@next-core/editor-bricks-helper`
|
|
8
8
|
|
|
9
9
|
## Build
|
|
10
10
|
|
|
11
|
-
`lerna run build --scope=@
|
|
11
|
+
`lerna run build --scope=@next-core/editor-bricks-helper`
|
|
12
12
|
|
|
13
13
|
[@next-core/brick-scripts]: https://github.com/easyops-cn/next-core/tree/master/packages/brick-scripts
|
package/dist/index.bundle.js
CHANGED
|
@@ -296,14 +296,16 @@
|
|
|
296
296
|
var {
|
|
297
297
|
rootId,
|
|
298
298
|
nodes,
|
|
299
|
-
edges
|
|
299
|
+
edges,
|
|
300
|
+
wrapperNode
|
|
300
301
|
} = _ref;
|
|
301
302
|
var idsToDelete = new Set();
|
|
302
303
|
collectIdsToDelete(nodeUid, edges, idsToDelete);
|
|
303
304
|
return {
|
|
304
305
|
rootId,
|
|
305
306
|
nodes: nodes.filter(node => !idsToDelete.has(node.$$uid)),
|
|
306
|
-
edges: edges.filter(edge => !idsToDelete.has(edge.parent) && !idsToDelete.has(edge.child))
|
|
307
|
+
edges: edges.filter(edge => !idsToDelete.has(edge.parent) && !idsToDelete.has(edge.child)),
|
|
308
|
+
wrapperNode: (wrapperNode === null || wrapperNode === void 0 ? void 0 : wrapperNode.$$uid) === nodeUid ? null : wrapperNode
|
|
307
309
|
};
|
|
308
310
|
}
|
|
309
311
|
|
|
@@ -455,10 +457,12 @@
|
|
|
455
457
|
|
|
456
458
|
function getAppendingNodesAndEdges(nodeData, nodeUid, templateSourceMap) {
|
|
457
459
|
var storyList = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
460
|
+
var isRoot = arguments.length > 4 ? arguments[4] : undefined;
|
|
458
461
|
var nodes = [];
|
|
459
462
|
var edges = [];
|
|
463
|
+
var wrapperNode;
|
|
460
464
|
|
|
461
|
-
var walk = (nodeData, currentUid, processedTemplateSet, isTemplateInternalNode, inheritedTemplateRefToUid) => {
|
|
465
|
+
var walk = (nodeData, currentUid, processedTemplateSet, isTemplateInternalNode, inheritedTemplateRefToUid, layoutType) => {
|
|
462
466
|
var _templateSource$child, _storyList$find, _templateSource$child2;
|
|
463
467
|
|
|
464
468
|
var builderNode = getBuilderNode(nodeData, currentUid, isTemplateInternalNode);
|
|
@@ -471,7 +475,11 @@
|
|
|
471
475
|
var templateSource;
|
|
472
476
|
|
|
473
477
|
if (brickUtils.isBrickNode(builderNode) && (!builderNode.brick.includes(".") && builderNode.brick.startsWith("tpl-") && !processedTemplateSet.has(builderNode.brick) && (templateSource = templateSourceMap === null || templateSourceMap === void 0 ? void 0 : templateSourceMap.get(builderNode.brick)) && ((_templateSource$child = templateSource.children) === null || _templateSource$child === void 0 ? void 0 : _templateSource$child.length) > 0 || builderNode.brick.includes(".tpl-") && (templateSource = storyList === null || storyList === void 0 ? void 0 : (_storyList$find = storyList.find(item => item.storyId === builderNode.brick)) === null || _storyList$find === void 0 ? void 0 : _storyList$find.originData) && ((_templateSource$child2 = templateSource.children) === null || _templateSource$child2 === void 0 ? void 0 : _templateSource$child2.length) > 0)) {
|
|
474
|
-
|
|
478
|
+
if (templateSource.layoutType === "wrapper") {
|
|
479
|
+
builderNode.layoutType = "wrapper";
|
|
480
|
+
} // Avoid nesting the same templates.
|
|
481
|
+
|
|
482
|
+
|
|
475
483
|
processedTemplateSet.add(builderNode.brick);
|
|
476
484
|
builderNode.$$isExpandableTemplate = true;
|
|
477
485
|
builderNode.$$templateProxy = templateSource.proxy && JSON.parse(templateSource.proxy);
|
|
@@ -615,9 +623,30 @@
|
|
|
615
623
|
};
|
|
616
624
|
|
|
617
625
|
walk(nodeData, nodeUid, new Set());
|
|
626
|
+
|
|
627
|
+
var _loop2 = function (i) {
|
|
628
|
+
// 布局模板属于第一层
|
|
629
|
+
var item = nodes[i];
|
|
630
|
+
|
|
631
|
+
if (item.layoutType === "wrapper" && isRoot && edges.find(edge => edge.child === item.$$uid).parent === nodeUid) {
|
|
632
|
+
if (!wrapperNode) {
|
|
633
|
+
wrapperNode = item;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
return "break";
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
641
|
+
var _ret = _loop2(i);
|
|
642
|
+
|
|
643
|
+
if (_ret === "break") break;
|
|
644
|
+
}
|
|
645
|
+
|
|
618
646
|
return {
|
|
619
647
|
nodes,
|
|
620
|
-
edges
|
|
648
|
+
edges,
|
|
649
|
+
wrapperNode
|
|
621
650
|
};
|
|
622
651
|
}
|
|
623
652
|
function isBasicRefProperty(propRef) {
|
|
@@ -655,7 +684,8 @@
|
|
|
655
684
|
_defineProperty__default["default"](this, "data", {
|
|
656
685
|
rootId: null,
|
|
657
686
|
nodes: [],
|
|
658
|
-
edges: []
|
|
687
|
+
edges: [],
|
|
688
|
+
wrapperNode: null
|
|
659
689
|
});
|
|
660
690
|
|
|
661
691
|
_defineProperty__default["default"](this, "hoverNodeUid", void 0);
|
|
@@ -690,7 +720,8 @@
|
|
|
690
720
|
var {
|
|
691
721
|
rootId,
|
|
692
722
|
nodes,
|
|
693
|
-
edges
|
|
723
|
+
edges,
|
|
724
|
+
wrapperNode
|
|
694
725
|
} = this.data;
|
|
695
726
|
var {
|
|
696
727
|
nodeUid,
|
|
@@ -713,7 +744,8 @@
|
|
|
713
744
|
var newData = {
|
|
714
745
|
rootId,
|
|
715
746
|
nodes: newNodes,
|
|
716
|
-
edges: newEdges
|
|
747
|
+
edges: newEdges,
|
|
748
|
+
wrapperNode
|
|
717
749
|
};
|
|
718
750
|
this.data = _objectSpread__default["default"](_objectSpread__default["default"]({}, newData), {}, {
|
|
719
751
|
edges: reorderBuilderEdges(newData, {
|
|
@@ -787,7 +819,7 @@
|
|
|
787
819
|
|
|
788
820
|
var newData = _objectSpread__default["default"]({
|
|
789
821
|
rootId
|
|
790
|
-
}, getAppendingNodesAndEdges(root, rootId, templateSourceMap, this.storyList));
|
|
822
|
+
}, getAppendingNodesAndEdges(root, rootId, templateSourceMap, this.storyList, true));
|
|
791
823
|
|
|
792
824
|
this.data = _objectSpread__default["default"](_objectSpread__default["default"]({}, newData), {}, {
|
|
793
825
|
edges: expandTemplateEdges(newData)
|
|
@@ -811,7 +843,23 @@
|
|
|
811
843
|
this.runAddNodeAction(detail);
|
|
812
844
|
}
|
|
813
845
|
|
|
846
|
+
redirectMountPoint(detail) {
|
|
847
|
+
var {
|
|
848
|
+
rootId,
|
|
849
|
+
wrapperNode
|
|
850
|
+
} = this.data;
|
|
851
|
+
|
|
852
|
+
if (detail.parentUid === rootId) {
|
|
853
|
+
detail.nodeData.mountPoint = "bricks";
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
if (wrapperNode && wrapperNode.instanceId === detail.nodeData.parent) {
|
|
857
|
+
detail.nodeData.mountPoint = "content";
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
|
|
814
861
|
nodeAdd(detail) {
|
|
862
|
+
this.redirectMountPoint(detail);
|
|
815
863
|
this.runAddNodeAction(detail);
|
|
816
864
|
this.eventTarget.dispatchEvent(new CustomEvent(BuilderInternalEventType.NODE_ADD, {
|
|
817
865
|
detail
|
|
@@ -822,7 +870,8 @@
|
|
|
822
870
|
var {
|
|
823
871
|
rootId,
|
|
824
872
|
nodes,
|
|
825
|
-
edges
|
|
873
|
+
edges,
|
|
874
|
+
wrapperNode
|
|
826
875
|
} = this.data;
|
|
827
876
|
var {
|
|
828
877
|
nodeUid,
|
|
@@ -834,7 +883,8 @@
|
|
|
834
883
|
id: nodeData.id,
|
|
835
884
|
instanceId: nodeData.instanceId
|
|
836
885
|
}) : node),
|
|
837
|
-
edges
|
|
886
|
+
edges,
|
|
887
|
+
wrapperNode
|
|
838
888
|
};
|
|
839
889
|
this.triggerDataChange();
|
|
840
890
|
}
|
|
@@ -843,7 +893,8 @@
|
|
|
843
893
|
var {
|
|
844
894
|
rootId,
|
|
845
895
|
nodes,
|
|
846
|
-
edges
|
|
896
|
+
edges,
|
|
897
|
+
wrapperNode
|
|
847
898
|
} = this.data;
|
|
848
899
|
var {
|
|
849
900
|
nodeDetails,
|
|
@@ -885,7 +936,8 @@
|
|
|
885
936
|
var newData = {
|
|
886
937
|
rootId,
|
|
887
938
|
nodes: newNodes,
|
|
888
|
-
edges: newEdges
|
|
939
|
+
edges: newEdges,
|
|
940
|
+
wrapperNode
|
|
889
941
|
};
|
|
890
942
|
this.data = _objectSpread__default["default"](_objectSpread__default["default"]({}, newData), {}, {
|
|
891
943
|
edges: reorderBuilderEdges(newData, {
|
|
@@ -926,8 +978,10 @@
|
|
|
926
978
|
var {
|
|
927
979
|
rootId,
|
|
928
980
|
nodes,
|
|
929
|
-
edges
|
|
981
|
+
edges,
|
|
982
|
+
wrapperNode
|
|
930
983
|
} = this.data;
|
|
984
|
+
this.redirectMountPoint(detail);
|
|
931
985
|
var {
|
|
932
986
|
nodeUid,
|
|
933
987
|
parentUid,
|
|
@@ -943,7 +997,8 @@
|
|
|
943
997
|
mountPoint: nodeData.mountPoint,
|
|
944
998
|
sort: undefined,
|
|
945
999
|
$$isTemplateDelegated: isParentExpandableTemplate(nodes, parentUid)
|
|
946
|
-
})
|
|
1000
|
+
}),
|
|
1001
|
+
wrapperNode
|
|
947
1002
|
};
|
|
948
1003
|
this.data = _objectSpread__default["default"](_objectSpread__default["default"]({}, newData), {}, {
|
|
949
1004
|
edges: reorderBuilderEdges(newData, {
|
|
@@ -961,14 +1016,16 @@
|
|
|
961
1016
|
var {
|
|
962
1017
|
rootId,
|
|
963
1018
|
nodes,
|
|
964
|
-
edges
|
|
1019
|
+
edges,
|
|
1020
|
+
wrapperNode
|
|
965
1021
|
} = this.data;
|
|
966
1022
|
this.data = {
|
|
967
1023
|
rootId,
|
|
968
1024
|
edges,
|
|
969
1025
|
nodes: nodes.map(node => node.$$uid === rootId ? _objectSpread__default["default"](_objectSpread__default["default"]({}, node), {}, {
|
|
970
1026
|
context: detail.context
|
|
971
|
-
}) : node)
|
|
1027
|
+
}) : node),
|
|
1028
|
+
wrapperNode
|
|
972
1029
|
};
|
|
973
1030
|
this.triggerDataChange();
|
|
974
1031
|
}
|
|
@@ -1183,14 +1240,22 @@
|
|
|
1183
1240
|
function useBuilderNode(_ref) {
|
|
1184
1241
|
var {
|
|
1185
1242
|
nodeUid,
|
|
1186
|
-
isRoot
|
|
1243
|
+
isRoot,
|
|
1244
|
+
isWrapper
|
|
1187
1245
|
} = _ref;
|
|
1188
1246
|
var {
|
|
1189
1247
|
rootId,
|
|
1190
|
-
nodes
|
|
1248
|
+
nodes,
|
|
1249
|
+
wrapperNode
|
|
1191
1250
|
} = useBuilderData();
|
|
1192
1251
|
var currentUid = isRoot ? rootId : nodeUid;
|
|
1193
|
-
return React.useMemo(() =>
|
|
1252
|
+
return React.useMemo(() => {
|
|
1253
|
+
if (isWrapper) {
|
|
1254
|
+
return wrapperNode;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
return nodes.find(node => node.$$uid === currentUid);
|
|
1258
|
+
}, [nodes, currentUid, isWrapper, wrapperNode]);
|
|
1194
1259
|
}
|
|
1195
1260
|
|
|
1196
1261
|
function useBuilderContextMenuStatus() {
|
|
@@ -1602,26 +1667,30 @@
|
|
|
1602
1667
|
var {
|
|
1603
1668
|
nodeUid,
|
|
1604
1669
|
isRoot,
|
|
1605
|
-
doNotExpandTemplates
|
|
1670
|
+
doNotExpandTemplates,
|
|
1671
|
+
isWrapper
|
|
1606
1672
|
} = _ref;
|
|
1607
1673
|
var {
|
|
1608
1674
|
rootId,
|
|
1609
1675
|
nodes,
|
|
1610
|
-
edges
|
|
1676
|
+
edges,
|
|
1677
|
+
wrapperNode
|
|
1611
1678
|
} = useBuilderData();
|
|
1612
1679
|
return React.useMemo(() => getBuilderGroupedChildNodes({
|
|
1613
1680
|
nodes,
|
|
1614
1681
|
edges,
|
|
1615
|
-
nodeUid: isRoot ? rootId : nodeUid,
|
|
1616
|
-
doNotExpandTemplates
|
|
1617
|
-
|
|
1682
|
+
nodeUid: isRoot ? isWrapper ? wrapperNode.$$uid : rootId : nodeUid,
|
|
1683
|
+
doNotExpandTemplates,
|
|
1684
|
+
isWrapper: isWrapper
|
|
1685
|
+
}), [doNotExpandTemplates, edges, isRoot, nodeUid, nodes, rootId, isWrapper, wrapperNode]);
|
|
1618
1686
|
}
|
|
1619
1687
|
function getBuilderGroupedChildNodes(_ref2) {
|
|
1620
1688
|
var {
|
|
1621
1689
|
nodeUid,
|
|
1622
1690
|
nodes,
|
|
1623
1691
|
edges,
|
|
1624
|
-
doNotExpandTemplates
|
|
1692
|
+
doNotExpandTemplates,
|
|
1693
|
+
isWrapper
|
|
1625
1694
|
} = _ref2;
|
|
1626
1695
|
var groups = new Map();
|
|
1627
1696
|
var relatedEdges = lodash.sortBy(edges.filter(edge => edge.parent === nodeUid && (doNotExpandTemplates ? !edge.$$isTemplateInternal : !edge.$$isTemplateDelegated)), [edge => edge.sort]);
|
|
@@ -1643,7 +1712,7 @@
|
|
|
1643
1712
|
return Array.from(groups.entries()).map(_ref3 => {
|
|
1644
1713
|
var [mountPoint, childNodes] = _ref3;
|
|
1645
1714
|
return {
|
|
1646
|
-
mountPoint,
|
|
1715
|
+
mountPoint: isWrapper ? "bricks" : mountPoint,
|
|
1647
1716
|
childNodes
|
|
1648
1717
|
};
|
|
1649
1718
|
});
|
|
@@ -2133,20 +2202,30 @@
|
|
|
2133
2202
|
dropZoneStyle,
|
|
2134
2203
|
dropZoneBodyStyle,
|
|
2135
2204
|
slotContentLayout,
|
|
2136
|
-
showOutlineIfEmpty
|
|
2205
|
+
showOutlineIfEmpty,
|
|
2206
|
+
hiddenWrapper = true
|
|
2137
2207
|
} = _ref;
|
|
2138
2208
|
var dropZoneBody = React__default["default"].useRef();
|
|
2139
2209
|
var [dropPositionCursor, setDropPositionCursor] = React__default["default"].useState(null);
|
|
2140
2210
|
var dropPositionCursorRef = React__default["default"].useRef();
|
|
2141
2211
|
var contextMenuStatus = useBuilderContextMenuStatus();
|
|
2142
2212
|
var manager = useBuilderDataManager();
|
|
2213
|
+
var {
|
|
2214
|
+
nodes,
|
|
2215
|
+
edges,
|
|
2216
|
+
wrapperNode
|
|
2217
|
+
} = useBuilderData();
|
|
2218
|
+
var isWrapper = hiddenWrapper && isRoot && !lodash.isEmpty(wrapperNode);
|
|
2143
2219
|
var node = useBuilderNode({
|
|
2144
2220
|
nodeUid,
|
|
2145
|
-
isRoot
|
|
2221
|
+
isRoot,
|
|
2222
|
+
isWrapper
|
|
2146
2223
|
});
|
|
2147
2224
|
var groupedChildNodes = useBuilderGroupedChildNodes({
|
|
2148
2225
|
nodeUid,
|
|
2149
|
-
isRoot
|
|
2226
|
+
isRoot,
|
|
2227
|
+
doNotExpandTemplates: isWrapper,
|
|
2228
|
+
isWrapper
|
|
2150
2229
|
});
|
|
2151
2230
|
var isGeneralizedPortalCanvas = independentPortalCanvas ? canvasIndex > 0 : isPortalCanvas;
|
|
2152
2231
|
var hasTabs = separateCanvas || independentPortalCanvas;
|
|
@@ -2176,10 +2255,6 @@
|
|
|
2176
2255
|
|
|
2177
2256
|
return isGeneralizedPortalCanvas ? selfChildNodes.length : 0;
|
|
2178
2257
|
}, [hasTabs, selfChildNodesInCurrentCanvas, isGeneralizedPortalCanvas, selfChildNodes]);
|
|
2179
|
-
var {
|
|
2180
|
-
nodes,
|
|
2181
|
-
edges
|
|
2182
|
-
} = useBuilderData();
|
|
2183
2258
|
var getDroppingContext = React__default["default"].useCallback(() => {
|
|
2184
2259
|
if (delegatedContext) {
|
|
2185
2260
|
var _siblingGroups$find$c, _siblingGroups$find;
|
|
@@ -2201,12 +2276,12 @@
|
|
|
2201
2276
|
|
|
2202
2277
|
return {
|
|
2203
2278
|
droppingParentUid: node.$$uid,
|
|
2204
|
-
droppingParentInstanceId: node.instanceId,
|
|
2279
|
+
droppingParentInstanceId: isWrapper ? wrapperNode.instanceId : node.instanceId,
|
|
2205
2280
|
droppingMountPoint: mountPoint,
|
|
2206
2281
|
droppingChildNodes: selfChildNodes,
|
|
2207
2282
|
droppingSiblingGroups: groupedChildNodes
|
|
2208
2283
|
};
|
|
2209
|
-
}, [delegatedContext, edges, groupedChildNodes, mountPoint, node, nodes, selfChildNodes]);
|
|
2284
|
+
}, [delegatedContext, edges, groupedChildNodes, mountPoint, node, nodes, selfChildNodes, isWrapper, wrapperNode]);
|
|
2210
2285
|
var [{
|
|
2211
2286
|
isDraggingOverCurrent
|
|
2212
2287
|
}, dropRef] = reactDnd.useDrop({
|
|
@@ -2249,7 +2324,7 @@
|
|
|
2249
2324
|
React__default["default"].useEffect(() => {
|
|
2250
2325
|
manager.updateDroppingStatus(delegatedContext ? delegatedContext.templateUid : node.$$uid, delegatedContext ? delegatedContext.templateMountPoint : mountPoint, isDraggingOverCurrent);
|
|
2251
2326
|
}, [isDraggingOverCurrent, mountPoint, manager, delegatedContext, node]);
|
|
2252
|
-
var droppable = !!delegatedContext || !(node.$$isExpandableTemplate || node.$$isTemplateInternalNode);
|
|
2327
|
+
var droppable = !!delegatedContext || isWrapper || !(node.$$isExpandableTemplate || node.$$isTemplateInternalNode);
|
|
2253
2328
|
var dropZoneRef = React__default["default"].useRef();
|
|
2254
2329
|
var dropZoneRefCallback = React__default["default"].useCallback(element => {
|
|
2255
2330
|
dropZoneRef.current = element;
|