@ng-formworks/core 17.6.5 → 17.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);
@@ -7500,7 +7505,8 @@ class JsonSchemaFormService {
7500
7505
  //introduced to check if the node is part of ITE conditional
7501
7506
  //then change or add the control
7502
7507
  if (layoutNode?.schemaPointer && layoutNode.isITEItem ||
7503
- (layoutNode?.schemaPointer && layoutNode?.oneOfPointer)) {
7508
+ (layoutNode?.schemaPointer && layoutNode?.oneOfPointer) ||
7509
+ layoutNode?.schemaPointer && layoutNode.anyOfPointer) {
7504
7510
  //before changing control, need to set the new data type for data formatting
7505
7511
  const schemaType = this.dataMap.get(layoutNode?.dataPointer).get("schemaType");
7506
7512
  if (schemaType != layoutNode.dataType) {
@@ -7543,9 +7549,9 @@ class JsonSchemaFormService {
7543
7549
  //set, as the control would only be initialized when the condition is true
7544
7550
  //TODO-review need to decide which of the data sets between data,formValues and default
7545
7551
  //to use for the value
7546
- if (ctx.options?.condition || layoutNode?.oneOfPointer) {
7552
+ if (ctx.options?.condition || layoutNode?.oneOfPointer || layoutNode?.anyOfPointer) {
7547
7553
  const dataPointer = this.getDataPointer(ctx);
7548
- const controlValue = ctx.formControl.value;
7554
+ const controlValue = ctx.formControl?.value;
7549
7555
  const dataValue = JsonPointer.has(this.data, dataPointer) ?
7550
7556
  JsonPointer.get(this.data, dataPointer) : undefined;
7551
7557
  const formValue = JsonPointer.has(this.formValues, dataPointer) ?
@@ -7676,7 +7682,8 @@ class JsonSchemaFormService {
7676
7682
  }
7677
7683
  const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7678
7684
  const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7679
- return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7685
+ const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
7686
+ return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
7680
7687
  }
7681
7688
  setFormControl(ctx, control) {
7682
7689
  if (!ctx || !ctx.layoutNode ||
@@ -7694,7 +7701,8 @@ class JsonSchemaFormService {
7694
7701
  }
7695
7702
  const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7696
7703
  const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7697
- const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7704
+ const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
7705
+ const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
7698
7706
  return control ? control.value : null;
7699
7707
  }
7700
7708
  getFormControlGroup(ctx) {
@@ -7703,7 +7711,8 @@ class JsonSchemaFormService {
7703
7711
  }
7704
7712
  const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7705
7713
  const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7706
- return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer);
7714
+ const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
7715
+ return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer || anyOfPointer);
7707
7716
  }
7708
7717
  getFormControlName(ctx) {
7709
7718
  if (!ctx || !ctx.layoutNode ||