@ng-formworks/core 16.6.5 → 16.6.6

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.
@@ -6456,7 +6456,8 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6456
6456
  '/properties/' + innerItemLevel2.name : innerItemLevel2.name;
6457
6457
  //innerItemLevel2.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6458
6458
  // innerItemLevel2.schemaPointer=innerItemLevel2.schemaPointer;
6459
- innerItemLevel2.oneOfPointer = innerItemLevel2.schemaPointer;
6459
+ const ofPointer = { anyOf: "anyOfPointer", oneOf: "oneOfPointer" }[ofType];
6460
+ innerItemLevel2[ofPointer] = ofPointer ? innerItemLevel2.schemaPointer : undefined;
6460
6461
  });
6461
6462
  }
6462
6463
  //TODO review-will never reach here if forRefLibrary==true
@@ -6466,6 +6467,9 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6466
6467
  innerItem.forEach(item => {
6467
6468
  const l2SchemaPointer = hasOwn(ofItem, 'properties') ?
6468
6469
  '/properties/' + item.name : item.name;
6470
+ if (ofType == "anyOf") {
6471
+ item.anyOfPointer = item.schemaPointer;
6472
+ }
6469
6473
  if (outerOneOfItem) {
6470
6474
  ////item.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6471
6475
  //schemaPointer + keySchemaPointer + item.dataPointer;
@@ -6489,7 +6493,8 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6489
6493
  }
6490
6494
  else {
6491
6495
  if (outerOneOfItem) {
6492
- innerItem.oneOfPointer = schemaPointer + keySchemaPointer; // + innerItem.dataPointer;
6496
+ const ofPointer = { anyOf: "anyOfPointer", oneOf: "oneOfPointer" }[ofType];
6497
+ innerItem[ofPointer] = ofPointer ? schemaPointer + keySchemaPointer : undefined;
6493
6498
  ////innerItem.schemaPointer=innerItem.oneOfPointer;
6494
6499
  outerOneOfItem.items = outerOneOfItem.items || [];
6495
6500
  outerOneOfItem.items.push(innerItem);
@@ -7484,7 +7489,8 @@ class JsonSchemaFormService {
7484
7489
  //introduced to check if the node is part of ITE conditional
7485
7490
  //then change or add the control
7486
7491
  if (layoutNode?.schemaPointer && layoutNode.isITEItem ||
7487
- (layoutNode?.schemaPointer && layoutNode?.oneOfPointer)) {
7492
+ (layoutNode?.schemaPointer && layoutNode?.oneOfPointer) ||
7493
+ layoutNode?.schemaPointer && layoutNode.anyOfPointer) {
7488
7494
  //before changing control, need to set the new data type for data formatting
7489
7495
  const schemaType = this.dataMap.get(layoutNode?.dataPointer).get("schemaType");
7490
7496
  if (schemaType != layoutNode.dataType) {
@@ -7527,9 +7533,9 @@ class JsonSchemaFormService {
7527
7533
  //set, as the control would only be initialized when the condition is true
7528
7534
  //TODO-review need to decide which of the data sets between data,formValues and default
7529
7535
  //to use for the value
7530
- if (ctx.options?.condition || layoutNode?.oneOfPointer) {
7536
+ if (ctx.options?.condition || layoutNode?.oneOfPointer || layoutNode?.anyOfPointer) {
7531
7537
  const dataPointer = this.getDataPointer(ctx);
7532
- const controlValue = ctx.formControl.value;
7538
+ const controlValue = ctx.formControl?.value;
7533
7539
  const dataValue = JsonPointer.has(this.data, dataPointer) ?
7534
7540
  JsonPointer.get(this.data, dataPointer) : undefined;
7535
7541
  const formValue = JsonPointer.has(this.formValues, dataPointer) ?
@@ -7660,7 +7666,8 @@ class JsonSchemaFormService {
7660
7666
  }
7661
7667
  const schemaPointer = ctx.layoutNode?.isITEItem ? ctx.layoutNode?.schemaPointer : null;
7662
7668
  const oneOfPointer = ctx.layoutNode?.oneOfPointer;
7663
- return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7669
+ const anyOfPointer = ctx.layoutNode?.anyOfPointer;
7670
+ return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
7664
7671
  }
7665
7672
  setFormControl(ctx, control) {
7666
7673
  if (!ctx || !ctx.layoutNode ||
@@ -7678,7 +7685,8 @@ class JsonSchemaFormService {
7678
7685
  }
7679
7686
  const schemaPointer = ctx.layoutNode?.isITEItem ? ctx.layoutNode?.schemaPointer : null;
7680
7687
  const oneOfPointer = ctx.layoutNode?.oneOfPointer;
7681
- const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7688
+ const anyOfPointer = ctx.layoutNode?.anyOfPointer;
7689
+ const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
7682
7690
  return control ? control.value : null;
7683
7691
  }
7684
7692
  getFormControlGroup(ctx) {
@@ -7687,7 +7695,8 @@ class JsonSchemaFormService {
7687
7695
  }
7688
7696
  const schemaPointer = ctx.layoutNode?.isITEItem ? ctx.layoutNode?.schemaPointer : null;
7689
7697
  const oneOfPointer = ctx.layoutNode?.oneOfPointer;
7690
- return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer);
7698
+ const anyOfPointer = ctx.layoutNode?.anyOfPointer;
7699
+ return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer || anyOfPointer);
7691
7700
  }
7692
7701
  getFormControlName(ctx) {
7693
7702
  if (!ctx.layoutNode ||