@ng-formworks/core 20.6.5 → 20.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.
@@ -6460,7 +6460,8 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6460
6460
  '/properties/' + innerItemLevel2.name : innerItemLevel2.name;
6461
6461
  //innerItemLevel2.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6462
6462
  // innerItemLevel2.schemaPointer=innerItemLevel2.schemaPointer;
6463
- innerItemLevel2.oneOfPointer = innerItemLevel2.schemaPointer;
6463
+ const ofPointer = { anyOf: "anyOfPointer", oneOf: "oneOfPointer" }[ofType];
6464
+ innerItemLevel2[ofPointer] = ofPointer ? innerItemLevel2.schemaPointer : undefined;
6464
6465
  });
6465
6466
  }
6466
6467
  //TODO review-will never reach here if forRefLibrary==true
@@ -6470,6 +6471,9 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6470
6471
  innerItem.forEach(item => {
6471
6472
  const l2SchemaPointer = hasOwn(ofItem, 'properties') ?
6472
6473
  '/properties/' + item.name : item.name;
6474
+ if (ofType == "anyOf") {
6475
+ item.anyOfPointer = item.schemaPointer;
6476
+ }
6473
6477
  if (outerOneOfItem) {
6474
6478
  ////item.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6475
6479
  //schemaPointer + keySchemaPointer + item.dataPointer;
@@ -6493,7 +6497,8 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6493
6497
  }
6494
6498
  else {
6495
6499
  if (outerOneOfItem) {
6496
- innerItem.oneOfPointer = schemaPointer + keySchemaPointer; // + innerItem.dataPointer;
6500
+ const ofPointer = { anyOf: "anyOfPointer", oneOf: "oneOfPointer" }[ofType];
6501
+ innerItem[ofPointer] = ofPointer ? schemaPointer + keySchemaPointer : undefined;
6497
6502
  ////innerItem.schemaPointer=innerItem.oneOfPointer;
6498
6503
  outerOneOfItem.items = outerOneOfItem.items || [];
6499
6504
  outerOneOfItem.items.push(innerItem);
@@ -7503,7 +7508,8 @@ class JsonSchemaFormService {
7503
7508
  //introduced to check if the node is part of ITE conditional
7504
7509
  //then change or add the control
7505
7510
  if (layoutNode?.schemaPointer && layoutNode.isITEItem ||
7506
- (layoutNode?.schemaPointer && layoutNode?.oneOfPointer)) {
7511
+ (layoutNode?.schemaPointer && layoutNode?.oneOfPointer) ||
7512
+ layoutNode?.schemaPointer && layoutNode.anyOfPointer) {
7507
7513
  //before changing control, need to set the new data type for data formatting
7508
7514
  const schemaType = this.dataMap.get(layoutNode?.dataPointer).get("schemaType");
7509
7515
  if (schemaType != layoutNode.dataType) {
@@ -7546,9 +7552,9 @@ class JsonSchemaFormService {
7546
7552
  //set, as the control would only be initialized when the condition is true
7547
7553
  //TODO-review need to decide which of the data sets between data,formValues and default
7548
7554
  //to use for the value
7549
- if (ctx.options?.condition || layoutNode?.oneOfPointer) {
7555
+ if (ctx.options?.condition || layoutNode?.oneOfPointer || layoutNode?.anyOfPointer) {
7550
7556
  const dataPointer = this.getDataPointer(ctx);
7551
- const controlValue = ctx.formControl.value;
7557
+ const controlValue = ctx.formControl?.value;
7552
7558
  const dataValue = JsonPointer.has(this.data, dataPointer) ?
7553
7559
  JsonPointer.get(this.data, dataPointer) : undefined;
7554
7560
  const formValue = JsonPointer.has(this.formValues, dataPointer) ?
@@ -7679,7 +7685,8 @@ class JsonSchemaFormService {
7679
7685
  }
7680
7686
  const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7681
7687
  const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7682
- return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7688
+ const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
7689
+ return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
7683
7690
  }
7684
7691
  setFormControl(ctx, control) {
7685
7692
  if (!ctx || !ctx.layoutNode ||
@@ -7697,7 +7704,8 @@ class JsonSchemaFormService {
7697
7704
  }
7698
7705
  const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7699
7706
  const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7700
- const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7707
+ const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
7708
+ const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
7701
7709
  return control ? control.value : null;
7702
7710
  }
7703
7711
  getFormControlGroup(ctx) {
@@ -7706,7 +7714,8 @@ class JsonSchemaFormService {
7706
7714
  }
7707
7715
  const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7708
7716
  const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7709
- return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer);
7717
+ const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
7718
+ return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer || anyOfPointer);
7710
7719
  }
7711
7720
  getFormControlName(ctx) {
7712
7721
  if (!ctx || !ctx.layoutNode ||