@next-core/editor-bricks-helper 0.38.8 → 0.39.2
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 +27 -0
- package/dist/index.bundle.js +32 -0
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +32 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/types/hooks/useActiveNodeUid.d.ts +1 -0
- package/dist/types/hooks/useActiveNodeUid.spec.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/internal/BuilderDataManager.d.ts +4 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
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.39.2](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.39.1...@next-core/editor-bricks-helper@0.39.2) (2022-04-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.39.1](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.39.0...@next-core/editor-bricks-helper@0.39.1) (2022-04-01)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [0.39.0](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.38.8...@next-core/editor-bricks-helper@0.39.0) (2022-03-30)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* set active node ([dcac564](https://github.com/easyops-cn/next-core/commit/dcac564bef68a41cbc676a764302abdc95316832))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [0.38.8](https://github.com/easyops-cn/next-core/compare/@next-core/editor-bricks-helper@0.38.7...@next-core/editor-bricks-helper@0.38.8) (2022-03-30)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @next-core/editor-bricks-helper
|
package/dist/index.bundle.js
CHANGED
|
@@ -670,6 +670,7 @@
|
|
|
670
670
|
BuilderInternalEventType["SHARED_EDITOR_LIST_CHANGE"] = "builder.sharedEditorList.change";
|
|
671
671
|
BuilderInternalEventType["ROUTE_LIST_CHANGE"] = "builder.routeList.change";
|
|
672
672
|
BuilderInternalEventType["HOVER_NODE_CHANGE"] = "builder.hoverNode.change";
|
|
673
|
+
BuilderInternalEventType["ACTIVE_NODE_CHANGE"] = "builder.activeNode.change";
|
|
673
674
|
BuilderInternalEventType["SHOW_RELATED_NODES_BASED_ON_EVENTS"] = "builder.showRelatedNodesBasedOnEvents.change";
|
|
674
675
|
BuilderInternalEventType["HIGHLIGHT_NODES_CHANGE"] = "builder.highlightNodes.change";
|
|
675
676
|
BuilderInternalEventType["OUTLINE_DISABLED_NODES_CHANGE"] = "builder.outlineDisabledNodes.change";
|
|
@@ -690,6 +691,8 @@
|
|
|
690
691
|
|
|
691
692
|
_defineProperty__default["default"](this, "hoverNodeUid", void 0);
|
|
692
693
|
|
|
694
|
+
_defineProperty__default["default"](this, "activeNodeUid", void 0);
|
|
695
|
+
|
|
693
696
|
_defineProperty__default["default"](this, "sharedEditorList", void 0);
|
|
694
697
|
|
|
695
698
|
_defineProperty__default["default"](this, "routeList", void 0);
|
|
@@ -1144,6 +1147,7 @@
|
|
|
1144
1147
|
}
|
|
1145
1148
|
|
|
1146
1149
|
nodeClick(detail) {
|
|
1150
|
+
this.setActiveNodeUid(detail.$$uid);
|
|
1147
1151
|
this.eventTarget.dispatchEvent(new CustomEvent(BuilderInternalEventType.NODE_CLICK, {
|
|
1148
1152
|
detail
|
|
1149
1153
|
}));
|
|
@@ -1237,6 +1241,24 @@
|
|
|
1237
1241
|
};
|
|
1238
1242
|
}
|
|
1239
1243
|
|
|
1244
|
+
setActiveNodeUid(uid) {
|
|
1245
|
+
if (this.activeNodeUid !== uid) {
|
|
1246
|
+
this.activeNodeUid = uid;
|
|
1247
|
+
this.eventTarget.dispatchEvent(new CustomEvent(BuilderInternalEventType.ACTIVE_NODE_CHANGE));
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
getActiveNodeUid() {
|
|
1252
|
+
return this.activeNodeUid;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
onActiveNodeChange(fn) {
|
|
1256
|
+
this.eventTarget.addEventListener(BuilderInternalEventType.ACTIVE_NODE_CHANGE, fn);
|
|
1257
|
+
return () => {
|
|
1258
|
+
this.eventTarget.removeEventListener(BuilderInternalEventType.ACTIVE_NODE_CHANGE, fn);
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1240
1262
|
toggleOutline(nodeInstanceId) {
|
|
1241
1263
|
if (this.outlineDisabledNodes.has(nodeInstanceId)) {
|
|
1242
1264
|
this.outlineDisabledNodes.delete(nodeInstanceId);
|
|
@@ -2728,6 +2750,15 @@
|
|
|
2728
2750
|
return data;
|
|
2729
2751
|
}
|
|
2730
2752
|
|
|
2753
|
+
function useActiveNodeUid() {
|
|
2754
|
+
var manager = useBuilderDataManager();
|
|
2755
|
+
var [data, setData] = React.useState(manager.getActiveNodeUid());
|
|
2756
|
+
React.useEffect(() => manager.onActiveNodeChange(() => {
|
|
2757
|
+
setData(manager.getActiveNodeUid());
|
|
2758
|
+
}), [manager]);
|
|
2759
|
+
return data;
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2731
2762
|
function useOutlineEnabled(nodeInstanceId, inapplicable) {
|
|
2732
2763
|
var manager = useBuilderDataManager();
|
|
2733
2764
|
var [enabled, setEnabled] = React.useState(inapplicable ? false : manager.isOutlineEnabled(nodeInstanceId));
|
|
@@ -2764,6 +2795,7 @@
|
|
|
2764
2795
|
exports.EditorElementFactory = EditorElementFactory;
|
|
2765
2796
|
exports.SlotContainer = SlotContainer;
|
|
2766
2797
|
exports.getSortedIdsAfterDropped = getSortedIdsAfterDropped;
|
|
2798
|
+
exports.useActiveNodeUid = useActiveNodeUid;
|
|
2767
2799
|
exports.useBuilderContextMenuStatus = useBuilderContextMenuStatus;
|
|
2768
2800
|
exports.useBuilderData = useBuilderData;
|
|
2769
2801
|
exports.useBuilderDataManager = useBuilderDataManager;
|