@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/dist/index.esm.js CHANGED
@@ -916,6 +916,7 @@ class BuilderDataManager {
916
916
  edges,
917
917
  wrapperNode
918
918
  } = this.data;
919
+ var updateNode = nodes.find(item => item.instanceId === instanceId);
919
920
  var newNodes = nodes.map(item => {
920
921
  if (item.instanceId === instanceId) {
921
922
  return _objectSpread(_objectSpread({}, item), detail);
@@ -923,10 +924,19 @@ class BuilderDataManager {
923
924
 
924
925
  return item;
925
926
  });
927
+ var newEdges = detail.mountPoint === undefined || detail.mountPoint === null ? edges : edges.map(item => {
928
+ if (item.child === updateNode.$$uid) {
929
+ return _objectSpread(_objectSpread({}, item), {}, {
930
+ mountPoint: detail.mountPoint
931
+ });
932
+ }
933
+
934
+ return item;
935
+ });
926
936
  this.data = {
927
937
  rootId,
928
938
  nodes: newNodes,
929
- edges,
939
+ edges: newEdges,
930
940
  wrapperNode
931
941
  };
932
942
  this.eventTarget.dispatchEvent(new CustomEvent(BuilderInternalEventType.NODE_UPDATE, {
@@ -1221,6 +1231,7 @@ class BuilderDataManager {
1221
1231
  }
1222
1232
 
1223
1233
  workbenchNodeAdd(detail) {
1234
+ var isNeedUpdateSnippet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1224
1235
  var {
1225
1236
  nodes,
1226
1237
  edges,
@@ -1273,7 +1284,7 @@ class BuilderDataManager {
1273
1284
 
1274
1285
  if (nodeData.bricks) {
1275
1286
  // snippet
1276
- this.snippetApply({
1287
+ var snippetData = {
1277
1288
  parentUid,
1278
1289
  nodeDetails: nodeData.bricks.map(brickConf => getSnippetNodeDetail({
1279
1290
  parent: parentInstanceId,
@@ -1285,8 +1296,13 @@ class BuilderDataManager {
1285
1296
  })),
1286
1297
  nodeIds,
1287
1298
  nodeUids
1288
- });
1289
- return;
1299
+ };
1300
+
1301
+ if (isNeedUpdateSnippet) {
1302
+ this.snippetApply(snippetData);
1303
+ } else {
1304
+ return snippetData;
1305
+ }
1290
1306
  }
1291
1307
 
1292
1308
  this.runAddNodeAction({