@vectoriox/iox-builder 1.2.7 → 1.2.9

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.
@@ -290,6 +290,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
290
290
  type: Injectable
291
291
  }] });
292
292
 
293
+ function deepCloneNode(node) {
294
+ const clone = JSON.parse(JSON.stringify(node));
295
+ regenerateIds(clone);
296
+ return clone;
297
+ }
298
+ function regenerateIds(node) {
299
+ node.id = Math.random().toString(36).substr(2, 9);
300
+ node.styleId = undefined;
301
+ (node.children || []).forEach(regenerateIds);
302
+ }
293
303
  class DragEngineService {
294
304
  constructor(registry) {
295
305
  this.registry = registry;
@@ -357,8 +367,15 @@ class DragEngineService {
357
367
  sourceData.splice(srcIdx, 1);
358
368
  this.getCdr(payload.sourceId)?.detectChanges();
359
369
  }
370
+ children.splice(insertIndex, 0, item);
371
+ }
372
+ else {
373
+ // Source not in the drop-zone registry → came from an external panel
374
+ // (e.g. the built-in blocks panel stores one pre-built node object and
375
+ // reuses it across drags). Deep-clone with fresh IDs so each drop
376
+ // produces a fully independent node, preventing shared CSS rules.
377
+ children.splice(insertIndex, 0, deepCloneNode(item));
360
378
  }
361
- children.splice(insertIndex, 0, item);
362
379
  cdr.detectChanges();
363
380
  afterDrop?.();
364
381
  return;
@@ -3384,7 +3401,7 @@ class BuilderRepeaterComponent {
3384
3401
  const changedNode = event.data?.node;
3385
3402
  if (!changedNode || !this.items.length)
3386
3403
  return;
3387
- if (this.children.some(c => c === changedNode || c.id === changedNode.id)) {
3404
+ if (this.isInTemplate(changedNode)) {
3388
3405
  this.refreshPreviews();
3389
3406
  }
3390
3407
  });
@@ -3419,6 +3436,11 @@ class BuilderRepeaterComponent {
3419
3436
  }
3420
3437
  });
3421
3438
  }
3439
+ isInTemplate(target) {
3440
+ const search = (nodes) => nodes.some(c => c === target || c.id === target.id ||
3441
+ (c.children?.length ? search(c.children) : false));
3442
+ return search(this.children);
3443
+ }
3422
3444
  refreshPreviews() {
3423
3445
  if (!this.items.length || !this.children.length) {
3424
3446
  this.previewRows = [];
@@ -3954,7 +3976,7 @@ class SizeGroupStyleConfig extends GroupStyleConfig {
3954
3976
  new TraitConfig('minHeight', 'Min H', TraitInputType.Scrub, { min: 0, max: 9999, step: 1, units: UNITS_ALL, allowAuto: true }, 'auto', true),
3955
3977
  new TraitConfig('maxWidth', 'Max W', TraitInputType.Scrub, { min: 0, max: 9999, step: 1, units: UNITS_ALL, allowAuto: true }, 'auto', true),
3956
3978
  new TraitConfig('maxHeight', 'Max H', TraitInputType.Scrub, { min: 0, max: 9999, step: 1, units: UNITS_ALL, allowAuto: true }, 'auto', true),
3957
- new TraitConfig('aspectRatio', 'Aspect Ratio', TraitInputType.Select, ['auto', '1/1', '4/3', '16/9', '3/2', '2/3', '9/16'], 'auto'),
3979
+ new TraitConfig('aspectRatio', 'Aspect Ratio', TraitInputType.Text, undefined, 'auto'),
3958
3980
  ]);
3959
3981
  }
3960
3982
  }