@vectoriox/iox-builder 2.6.0 → 2.6.1

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.
@@ -5057,6 +5057,9 @@ class BuilderComponent {
5057
5057
  if (inGlobal)
5058
5058
  this.globalElementsChange.emit([...this.globalElements]);
5059
5059
  this.cdr.detectChanges();
5060
+ // If the wrapped node lives in a Repeater template, rebuild its repeated rows so
5061
+ // every clone picks up the new wrapper (and re-resolves the now-nested bindings).
5062
+ this._refreshRepeaterFor(node);
5060
5063
  this.panelEventService.emit(PanelEventTypes.LAYOUT_CHANGED, this.layout);
5061
5064
  this._selectAfterDrop(wrapped);
5062
5065
  }
@@ -5324,6 +5327,17 @@ class BuilderComponent {
5324
5327
  }
5325
5328
  return null;
5326
5329
  }
5330
+ /** If `node` lives inside a Repeater template, tell that repeater to rebuild its preview rows so
5331
+ * a structural change (e.g. wrapping a template child) propagates to every repeated row. No-op
5332
+ * when the node is not inside a repeater. */
5333
+ _refreshRepeaterFor(node) {
5334
+ const repeater = this.findRepeaterAncestorOf(node, this.layout)
5335
+ ?? this.findRepeaterAncestorOf(node, this.globalElements);
5336
+ if (!repeater)
5337
+ return;
5338
+ const ref = this.overlayService.getNodeRef(repeater);
5339
+ ref?.componentRef?.instance?.refreshTemplate?.();
5340
+ }
5327
5341
  /** Emit ELEMENT_SELECT with the ancestors the panels need (symbol + repeater item scope). */
5328
5342
  _emitElementSelect(node, componentRef) {
5329
5343
  const symbolAncestor = this.findSymbolAncestorOf(node, this.layout)
@@ -6126,21 +6140,36 @@ class BuilderRepeaterComponent {
6126
6140
  const item = this.items[0];
6127
6141
  if (!item || !this.children.length)
6128
6142
  return;
6129
- for (const child of this.children) {
6130
- if (!child.bindings?.length)
6131
- continue;
6132
- const ref = this.overlayService.getNodeRef(child);
6133
- if (!ref?.componentRef)
6134
- continue;
6135
- for (const binding of child.bindings) {
6136
- const value = resolvePath(item, binding.path);
6137
- if (value !== undefined) {
6138
- ref.componentRef.instance[binding.prop] = value;
6143
+ this.applyBindingsToNodes(this.children, item);
6144
+ }
6145
+ /** Apply item[0]'s bound values to the live template row, walking the WHOLE subtree — not just
6146
+ * direct children. A bound node can sit any level deep once a template child is wrapped in a
6147
+ * container (or otherwise nested), so recursion is required or the first row shows defaults. */
6148
+ applyBindingsToNodes(nodes, item) {
6149
+ for (const child of nodes) {
6150
+ if (child.bindings?.length) {
6151
+ const ref = this.overlayService.getNodeRef(child);
6152
+ if (ref?.componentRef) {
6153
+ for (const binding of child.bindings) {
6154
+ const value = resolvePath(item, binding.path);
6155
+ if (value !== undefined) {
6156
+ ref.componentRef.instance[binding.prop] = value;
6157
+ }
6158
+ }
6159
+ ref.componentRef.changeDetectorRef.detectChanges();
6139
6160
  }
6140
6161
  }
6141
- ref.componentRef.changeDetectorRef.detectChanges();
6162
+ if (child.children?.length) {
6163
+ this.applyBindingsToNodes(child.children, item);
6164
+ }
6142
6165
  }
6143
6166
  }
6167
+ /** Rebuild preview rows after the template STRUCTURE changed (e.g. a child was wrapped, deleted,
6168
+ * or moved). Deferred so the new DOM + overlay refs exist before bindings are re-applied. */
6169
+ refreshTemplate() {
6170
+ if (this.items.length)
6171
+ setTimeout(() => this.refreshPreviews());
6172
+ }
6144
6173
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BuilderRepeaterComponent, deps: [{ token: DragEngineService }, { token: OverlayService }, { token: BuilderDataSourceService }, { token: DataSourceRegistryService }, { token: PanelEventService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
6145
6174
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", type: BuilderRepeaterComponent, isStandalone: false, selector: "app-builder-repeater", inputs: { children: "children", style: "style", nodeId: "nodeId", dropListId: "dropListId", source: "source", sourcePath: "sourcePath", limit: "limit" }, outputs: { childClick: "childClick", childMouseEnter: "childMouseEnter", childMouseLeave: "childMouseLeave" }, ngImport: i0, template: `
6146
6175
  <ng-template #badgeContent>