@next-core/editor-bricks-helper 0.46.3 → 0.46.4

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,17 @@
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.46.4](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.46.3...@next-core/editor-bricks-helper@0.46.4) (2022-08-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * move error ([88c878b](https://github.com/easyops-cn/next-core/commit/88c878bf7168c82f8085562dde7c9230e06ed406))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.46.3](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.46.2...@next-core/editor-bricks-helper@0.46.3) (2022-08-11)
7
18
 
8
19
  **Note:** Version bump only for package @next-core/editor-bricks-helper
@@ -717,6 +717,13 @@
717
717
  };
718
718
  }
719
719
 
720
+ var getObjectIdByNode = node => {
721
+ if (brickUtils.isRouteNode(node)) return "STORYBOARD_ROUTE";
722
+ if (brickUtils.isBrickNode(node)) return "STORYBOARD_BRICK";
723
+ if (brickUtils.isCustomTemplateNode(node)) return "STORYBOARD_TEMPLATE";
724
+ if (brickUtils.isSnippetNode(node)) return "STORYBOARD_SNIPPET";
725
+ };
726
+
720
727
  var BuilderInternalEventType;
721
728
 
722
729
  (function (BuilderInternalEventType) {
@@ -1159,6 +1166,9 @@
1159
1166
 
1160
1167
  var orderedEdges = lodash.sortBy(relatedEdges, edge => mountPoints.indexOf(edge.mountPoint), edge => orderedSiblingEdges.indexOf(edge));
1161
1168
  this.reorder(parentUid, orderedEdges);
1169
+ this.eventTarget.dispatchEvent(new CustomEvent(BuilderInternalEventType.NODE_UPDATE, {
1170
+ detail: this.data
1171
+ }));
1162
1172
  }
1163
1173
 
1164
1174
  getDragInfo(_ref3) {
@@ -1340,7 +1350,8 @@
1340
1350
  dragStatus
1341
1351
  } = detail;
1342
1352
  var nodeData = nodes.find(item => item.$$uid === dragNodeUid);
1343
- var originParentUid = edges.find(edge => edge.child === nodeData.$$uid).parent;
1353
+ var originEdge = edges.find(edge => edge.child === nodeData.$$uid);
1354
+ var originParentUid = originEdge.parent;
1344
1355
  var originParentNode = nodes.find(node => node.$$uid === originParentUid);
1345
1356
  var {
1346
1357
  parentUid,
@@ -1379,15 +1390,18 @@
1379
1390
  nodeUid: dragNodeUid,
1380
1391
  nodeInstanceId: nodeData.instanceId,
1381
1392
  nodeIds
1382
- }, originParentNode.instanceId !== parnetNodeData.instanceId ? {
1393
+ }, originParentNode.instanceId !== parnetNodeData.instanceId || originEdge.mountPoint !== mountPoint ? {
1383
1394
  nodeData: {
1384
1395
  parent: parnetNodeData.instanceId,
1385
1396
  mountPoint: mountPoint
1386
1397
  }
1387
1398
  } : {}), {}, {
1388
- objectId: nodeData["_object_id"]
1399
+ objectId: getObjectIdByNode(nodeData)
1389
1400
  })
1390
1401
  }));
1402
+ this.eventTarget.dispatchEvent(new CustomEvent(BuilderInternalEventType.NODE_UPDATE, {
1403
+ detail: this.data
1404
+ }));
1391
1405
  }
1392
1406
  /**
1393
1407
  * Move mount-point up or down.
@@ -1430,7 +1444,8 @@
1430
1444
  detail: {
1431
1445
  nodeUids: childUids,
1432
1446
  parentUid,
1433
- nodeIds: childIds
1447
+ nodeIds: childIds,
1448
+ objectId: getObjectIdByNode(nodes.find(node => node.$$uid === parentUid))
1434
1449
  }
1435
1450
  }));
1436
1451
  }