@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 +11 -0
- package/dist/index.bundle.js +19 -4
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +20 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/types/interfaces.d.ts +1 -0
- package/dist/types/internal/getObjectIdByNode.d.ts +2 -0
- package/dist/types/internal/getObjectIdByNode.spec.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { useState, useEffect, useMemo, useRef, useCallback, createContext
|
|
|
2
2
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import { sortBy, clamp, isEmpty, cloneDeep, upperFirst, omit } from 'lodash';
|
|
5
|
-
import { hasOwnProperty, normalizeBuilderNode, isBrickNode,
|
|
5
|
+
import { hasOwnProperty, normalizeBuilderNode, isBrickNode, isRouteNode, isCustomTemplateNode, isSnippetNode, JsonStorage } from '@next-core/brick-utils';
|
|
6
6
|
export { isBrickNode, isCustomTemplateNode, isRouteNode, isSnippetNode } from '@next-core/brick-utils';
|
|
7
7
|
import yaml from 'js-yaml';
|
|
8
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
@@ -715,6 +715,13 @@ function getSnippetNodeDetail(_ref) {
|
|
|
715
715
|
};
|
|
716
716
|
}
|
|
717
717
|
|
|
718
|
+
var getObjectIdByNode = node => {
|
|
719
|
+
if (isRouteNode(node)) return "STORYBOARD_ROUTE";
|
|
720
|
+
if (isBrickNode(node)) return "STORYBOARD_BRICK";
|
|
721
|
+
if (isCustomTemplateNode(node)) return "STORYBOARD_TEMPLATE";
|
|
722
|
+
if (isSnippetNode(node)) return "STORYBOARD_SNIPPET";
|
|
723
|
+
};
|
|
724
|
+
|
|
718
725
|
var BuilderInternalEventType;
|
|
719
726
|
|
|
720
727
|
(function (BuilderInternalEventType) {
|
|
@@ -1157,6 +1164,9 @@ class BuilderDataManager {
|
|
|
1157
1164
|
|
|
1158
1165
|
var orderedEdges = sortBy(relatedEdges, edge => mountPoints.indexOf(edge.mountPoint), edge => orderedSiblingEdges.indexOf(edge));
|
|
1159
1166
|
this.reorder(parentUid, orderedEdges);
|
|
1167
|
+
this.eventTarget.dispatchEvent(new CustomEvent(BuilderInternalEventType.NODE_UPDATE, {
|
|
1168
|
+
detail: this.data
|
|
1169
|
+
}));
|
|
1160
1170
|
}
|
|
1161
1171
|
|
|
1162
1172
|
getDragInfo(_ref3) {
|
|
@@ -1338,7 +1348,8 @@ class BuilderDataManager {
|
|
|
1338
1348
|
dragStatus
|
|
1339
1349
|
} = detail;
|
|
1340
1350
|
var nodeData = nodes.find(item => item.$$uid === dragNodeUid);
|
|
1341
|
-
var
|
|
1351
|
+
var originEdge = edges.find(edge => edge.child === nodeData.$$uid);
|
|
1352
|
+
var originParentUid = originEdge.parent;
|
|
1342
1353
|
var originParentNode = nodes.find(node => node.$$uid === originParentUid);
|
|
1343
1354
|
var {
|
|
1344
1355
|
parentUid,
|
|
@@ -1377,15 +1388,18 @@ class BuilderDataManager {
|
|
|
1377
1388
|
nodeUid: dragNodeUid,
|
|
1378
1389
|
nodeInstanceId: nodeData.instanceId,
|
|
1379
1390
|
nodeIds
|
|
1380
|
-
}, originParentNode.instanceId !== parnetNodeData.instanceId ? {
|
|
1391
|
+
}, originParentNode.instanceId !== parnetNodeData.instanceId || originEdge.mountPoint !== mountPoint ? {
|
|
1381
1392
|
nodeData: {
|
|
1382
1393
|
parent: parnetNodeData.instanceId,
|
|
1383
1394
|
mountPoint: mountPoint
|
|
1384
1395
|
}
|
|
1385
1396
|
} : {}), {}, {
|
|
1386
|
-
objectId: nodeData
|
|
1397
|
+
objectId: getObjectIdByNode(nodeData)
|
|
1387
1398
|
})
|
|
1388
1399
|
}));
|
|
1400
|
+
this.eventTarget.dispatchEvent(new CustomEvent(BuilderInternalEventType.NODE_UPDATE, {
|
|
1401
|
+
detail: this.data
|
|
1402
|
+
}));
|
|
1389
1403
|
}
|
|
1390
1404
|
/**
|
|
1391
1405
|
* Move mount-point up or down.
|
|
@@ -1428,7 +1442,8 @@ class BuilderDataManager {
|
|
|
1428
1442
|
detail: {
|
|
1429
1443
|
nodeUids: childUids,
|
|
1430
1444
|
parentUid,
|
|
1431
|
-
nodeIds: childIds
|
|
1445
|
+
nodeIds: childIds,
|
|
1446
|
+
objectId: getObjectIdByNode(nodes.find(node => node.$$uid === parentUid))
|
|
1432
1447
|
}
|
|
1433
1448
|
}));
|
|
1434
1449
|
}
|