@next-core/editor-bricks-helper 0.43.1 → 0.45.0

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 CHANGED
@@ -3,6 +3,36 @@
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
+ # [0.45.0](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.44.1...@next-core/editor-bricks-helper@0.45.0) (2022-08-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * support drag snippet not update builder data ([3b73fe4](https://github.com/easyops-cn/next-core/commit/3b73fe4b39851667a749a8bb353f561adb131ebb))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.44.1](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.44.0...@next-core/editor-bricks-helper@0.44.1) (2022-08-08)
18
+
19
+ **Note:** Version bump only for package @next-core/editor-bricks-helper
20
+
21
+
22
+
23
+
24
+
25
+ # [0.44.0](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.43.1...@next-core/editor-bricks-helper@0.44.0) (2022-08-08)
26
+
27
+
28
+ ### Features
29
+
30
+ * support updateNode update edges ([0db8809](https://github.com/easyops-cn/next-core/commit/0db880952e8a92bc0dee4453fdd3422a740c23af))
31
+
32
+
33
+
34
+
35
+
6
36
  ## [0.43.1](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.43.0...@next-core/editor-bricks-helper@0.43.1) (2022-08-03)
7
37
 
8
38
  **Note:** Version bump only for package @next-core/editor-bricks-helper
@@ -918,6 +918,7 @@
918
918
  edges,
919
919
  wrapperNode
920
920
  } = this.data;
921
+ var updateNode = nodes.find(item => item.instanceId === instanceId);
921
922
  var newNodes = nodes.map(item => {
922
923
  if (item.instanceId === instanceId) {
923
924
  return _objectSpread__default["default"](_objectSpread__default["default"]({}, item), detail);
@@ -925,10 +926,19 @@
925
926
 
926
927
  return item;
927
928
  });
929
+ var newEdges = detail.mountPoint === undefined || detail.mountPoint === null ? edges : edges.map(item => {
930
+ if (item.child === updateNode.$$uid) {
931
+ return _objectSpread__default["default"](_objectSpread__default["default"]({}, item), {}, {
932
+ mountPoint: detail.mountPoint
933
+ });
934
+ }
935
+
936
+ return item;
937
+ });
928
938
  this.data = {
929
939
  rootId,
930
940
  nodes: newNodes,
931
- edges,
941
+ edges: newEdges,
932
942
  wrapperNode
933
943
  };
934
944
  this.eventTarget.dispatchEvent(new CustomEvent(BuilderInternalEventType.NODE_UPDATE, {
@@ -1223,6 +1233,7 @@
1223
1233
  }
1224
1234
 
1225
1235
  workbenchNodeAdd(detail) {
1236
+ var isNeedUpdateSnippet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1226
1237
  var {
1227
1238
  nodes,
1228
1239
  edges,
@@ -1275,7 +1286,7 @@
1275
1286
 
1276
1287
  if (nodeData.bricks) {
1277
1288
  // snippet
1278
- this.snippetApply({
1289
+ var snippetData = {
1279
1290
  parentUid,
1280
1291
  nodeDetails: nodeData.bricks.map(brickConf => getSnippetNodeDetail({
1281
1292
  parent: parentInstanceId,
@@ -1287,8 +1298,13 @@
1287
1298
  })),
1288
1299
  nodeIds,
1289
1300
  nodeUids
1290
- });
1291
- return;
1301
+ };
1302
+
1303
+ if (isNeedUpdateSnippet) {
1304
+ this.snippetApply(snippetData);
1305
+ } else {
1306
+ return snippetData;
1307
+ }
1292
1308
  }
1293
1309
 
1294
1310
  this.runAddNodeAction({