@vectoriox/iox-builder 1.4.56 → 1.4.57

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.
@@ -3985,7 +3985,9 @@ class BuilderComponent {
3985
3985
  this.selectedItem = event.node;
3986
3986
  this.overlayService.setSelect(event.element, event.node.type, this.activeMode, event.node, event.componentRef);
3987
3987
  this.selectPanel(PanelTypes.STYLES);
3988
- this.panelEventService.emit(PanelEventTypes.ELEMENT_SELECT, { node: event.node, componentRef: event.componentRef });
3988
+ const symbolAncestor = this.findSymbolAncestorOf(event.node, this.layout)
3989
+ ?? this.findSymbolAncestorOf(event.node, this.globalElements);
3990
+ this.panelEventService.emit(PanelEventTypes.ELEMENT_SELECT, { node: event.node, componentRef: event.componentRef, symbolAncestor });
3989
3991
  }
3990
3992
  _selectAfterDrop(node) {
3991
3993
  // Wait one tick for Angular to render the new component and register it
@@ -3997,7 +3999,9 @@ class BuilderComponent {
3997
3999
  this.selectedItem = node;
3998
4000
  this.overlayService.setSelect(ref.element, node.type, this.activeMode, node, ref.componentRef);
3999
4001
  this.selectPanel(PanelTypes.STYLES);
4000
- this.panelEventService.emit(PanelEventTypes.ELEMENT_SELECT, { node, componentRef: ref.componentRef });
4002
+ const symbolAncestor = this.findSymbolAncestorOf(node, this.layout)
4003
+ ?? this.findSymbolAncestorOf(node, this.globalElements);
4004
+ this.panelEventService.emit(PanelEventTypes.ELEMENT_SELECT, { node, componentRef: ref.componentRef, symbolAncestor });
4001
4005
  });
4002
4006
  }
4003
4007
  handleMouseEnter(event) {
@@ -4021,7 +4025,9 @@ class BuilderComponent {
4021
4025
  this.selectedItem = node;
4022
4026
  const ref = this.overlayService.getNodeRef(node);
4023
4027
  if (ref) {
4024
- this.panelEventService.emit(PanelEventTypes.ELEMENT_SELECT, { node, componentRef: ref.componentRef });
4028
+ const symbolAncestor = this.findSymbolAncestorOf(node, this.layout)
4029
+ ?? this.findSymbolAncestorOf(node, this.globalElements);
4030
+ this.panelEventService.emit(PanelEventTypes.ELEMENT_SELECT, { node, componentRef: ref.componentRef, symbolAncestor });
4025
4031
  }
4026
4032
  this.selectPanel(PanelTypes.STYLES);
4027
4033
  }
@@ -4300,6 +4306,19 @@ class BuilderComponent {
4300
4306
  }
4301
4307
  return null;
4302
4308
  }
4309
+ /** Returns the closest ancestor (or self) of `target` that has a `symbolId`. */
4310
+ findSymbolAncestorOf(target, nodes) {
4311
+ for (const node of nodes) {
4312
+ if (node === target)
4313
+ return node.symbolId ? node : null;
4314
+ if (node.children?.length && this.findNodeInTree(target, node.children)) {
4315
+ if (node.symbolId)
4316
+ return node;
4317
+ return this.findSymbolAncestorOf(target, node.children);
4318
+ }
4319
+ }
4320
+ return null;
4321
+ }
4303
4322
  handlePanelEvents(panelEvent) {
4304
4323
  if (panelEvent.type === PanelEventTypes.PANEL_CLOSE) {
4305
4324
  this.isPanelOpen = false;