@next-core/editor-bricks-helper 0.46.28 → 0.47.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 +11 -0
- package/dist/index.bundle.js +27 -12
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +27 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/types/interfaces.d.ts +5 -0
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1170,8 +1170,6 @@ class BuilderDataManager {
|
|
|
1170
1170
|
}
|
|
1171
1171
|
|
|
1172
1172
|
getDragInfo(_ref3) {
|
|
1173
|
-
var _dragEdge$mountPoint;
|
|
1174
|
-
|
|
1175
1173
|
var {
|
|
1176
1174
|
nodeData,
|
|
1177
1175
|
dragNodeUid,
|
|
@@ -1185,19 +1183,18 @@ class BuilderDataManager {
|
|
|
1185
1183
|
} = this.data;
|
|
1186
1184
|
var isDragRoot = dragOverNodeUid === rootId;
|
|
1187
1185
|
/*
|
|
1188
|
-
*
|
|
1186
|
+
* 如果找不到edge, 则为新增状态, 否则为移动状态
|
|
1189
1187
|
*/
|
|
1190
1188
|
|
|
1191
|
-
var
|
|
1192
|
-
var dragEdge = !isAdd ? edges.find(item => item.child === dragNodeUid) : null;
|
|
1189
|
+
var dragEdge = edges.find(item => item.child === dragNodeUid);
|
|
1193
1190
|
var dragOverEdge = edges.find(item => item.child === dragOverNodeUid);
|
|
1194
1191
|
/**
|
|
1195
1192
|
* 如果是根节点, 则mountPoint强制等于 bricks
|
|
1196
|
-
* 如果是属于拖动进某个节点中,
|
|
1193
|
+
* 如果是属于拖动进某个节点中, 默认使用 content
|
|
1197
1194
|
* 其他情况, 使用被拖拽节点的mountPoint
|
|
1198
1195
|
*/
|
|
1199
1196
|
|
|
1200
|
-
var mountPoint = isDragRoot ? "bricks" : dragStatus === "inside" ?
|
|
1197
|
+
var mountPoint = isDragRoot ? "bricks" : dragStatus === "inside" ? "content" : dragOverEdge.mountPoint;
|
|
1201
1198
|
var parentEdge = edges.find(item => item.child === dragOverNodeUid);
|
|
1202
1199
|
/**
|
|
1203
1200
|
* 如果是根节点, parentUid强制等于rootId
|
|
@@ -1210,8 +1207,12 @@ class BuilderDataManager {
|
|
|
1210
1207
|
|
|
1211
1208
|
var siblingEdge = edges.filter(edge => edge.child !== dragNodeUid && edge.parent === parentUid);
|
|
1212
1209
|
var sortUids = sortBy(siblingEdge, "sort").map(item => item.child);
|
|
1213
|
-
var sortNodeIds =
|
|
1214
|
-
|
|
1210
|
+
var sortNodeIds = [];
|
|
1211
|
+
var sortNodeInstanceIds = [];
|
|
1212
|
+
sortUids.forEach(item => {
|
|
1213
|
+
var node = nodes.find(node => node.$$uid === item);
|
|
1214
|
+
sortNodeIds.push(node.id);
|
|
1215
|
+
sortNodeInstanceIds.push(node.instanceId);
|
|
1215
1216
|
});
|
|
1216
1217
|
var sortIndex;
|
|
1217
1218
|
|
|
@@ -1219,6 +1220,7 @@ class BuilderDataManager {
|
|
|
1219
1220
|
sortIndex = siblingEdge.length ? Math.max(...siblingEdge.map(item => item.sort)) + 1 : 0; // 插入默认插最后
|
|
1220
1221
|
|
|
1221
1222
|
sortNodeIds.push(nodeData.id);
|
|
1223
|
+
sortNodeInstanceIds.push(nodeData.instanceId);
|
|
1222
1224
|
} else if (dragStatus === "top" || dragStatus === "bottom") {
|
|
1223
1225
|
var _dragEdge$child;
|
|
1224
1226
|
|
|
@@ -1228,6 +1230,7 @@ class BuilderDataManager {
|
|
|
1228
1230
|
sortNodeIds.splice(sortIndex, 0, nodeData.id); // 如果是新增的情况下, 没有edge, 则取dragNodeUid(新创建的uid)
|
|
1229
1231
|
|
|
1230
1232
|
sortUids.splice(sortIndex, 0, (_dragEdge$child = dragEdge === null || dragEdge === void 0 ? void 0 : dragEdge.child) !== null && _dragEdge$child !== void 0 ? _dragEdge$child : dragNodeUid);
|
|
1233
|
+
sortNodeInstanceIds.splice(sortIndex, 0, nodeData.instanceId);
|
|
1231
1234
|
}
|
|
1232
1235
|
|
|
1233
1236
|
return {
|
|
@@ -1236,7 +1239,8 @@ class BuilderDataManager {
|
|
|
1236
1239
|
sortIndex,
|
|
1237
1240
|
parnetNodeData,
|
|
1238
1241
|
sortUids,
|
|
1239
|
-
sortNodeIds
|
|
1242
|
+
sortNodeIds,
|
|
1243
|
+
sortNodeInstanceIds
|
|
1240
1244
|
};
|
|
1241
1245
|
}
|
|
1242
1246
|
|
|
@@ -1255,6 +1259,8 @@ class BuilderDataManager {
|
|
|
1255
1259
|
} = detail;
|
|
1256
1260
|
|
|
1257
1261
|
if (nodeData.instanceId && !nodeData.instanceId.startsWith("mock")) ; else {
|
|
1262
|
+
var _nodeData$id, _nodeData$instanceId;
|
|
1263
|
+
|
|
1258
1264
|
// insert
|
|
1259
1265
|
var parentInstanceId = detail.parent || detail.parentInstanceId;
|
|
1260
1266
|
var newNodeUid = nodeData.$$uid || getUniqueNodeId();
|
|
@@ -1279,10 +1285,12 @@ class BuilderDataManager {
|
|
|
1279
1285
|
parentUid,
|
|
1280
1286
|
sortIndex,
|
|
1281
1287
|
sortUids: nodeUids,
|
|
1282
|
-
sortNodeIds: nodeIds
|
|
1288
|
+
sortNodeIds: nodeIds,
|
|
1289
|
+
sortNodeInstanceIds: nodeInstanceIds
|
|
1283
1290
|
} = this.getDragInfo({
|
|
1284
1291
|
nodeData: {
|
|
1285
|
-
id: null
|
|
1292
|
+
id: (_nodeData$id = nodeData.id) !== null && _nodeData$id !== void 0 ? _nodeData$id : null,
|
|
1293
|
+
instanceId: (_nodeData$instanceId = nodeData.instanceId) !== null && _nodeData$instanceId !== void 0 ? _nodeData$instanceId : null
|
|
1286
1294
|
},
|
|
1287
1295
|
dragNodeUid: newNodeUid,
|
|
1288
1296
|
dragOverNodeUid,
|
|
@@ -1323,11 +1331,18 @@ class BuilderDataManager {
|
|
|
1323
1331
|
nodeData,
|
|
1324
1332
|
sort: sortIndex
|
|
1325
1333
|
});
|
|
1334
|
+
var sortData = {
|
|
1335
|
+
nodeUids,
|
|
1336
|
+
nodeInstanceIds,
|
|
1337
|
+
nodeIds
|
|
1338
|
+
};
|
|
1339
|
+
detail.sortData = sortData;
|
|
1326
1340
|
this.eventTarget.dispatchEvent(new CustomEvent(BuilderInternalEventType.NODE_ADD, {
|
|
1327
1341
|
detail: {
|
|
1328
1342
|
nodeUid: newNodeUid,
|
|
1329
1343
|
parentUid,
|
|
1330
1344
|
nodeUids,
|
|
1345
|
+
nodeInstanceIds,
|
|
1331
1346
|
nodeIds,
|
|
1332
1347
|
nodeData
|
|
1333
1348
|
}
|