@react-typed-forms/schemas 11.2.1 → 11.2.2

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.
package/lib/index.js CHANGED
@@ -462,9 +462,10 @@ function visitControlData(definition, ctx, cb) {
462
462
  if (!fieldData) return !fieldName ? visitControlDataArray(children, ctx, cb) : undefined;
463
463
  var thisPath = [].concat(ctx.path, [fieldData.field]);
464
464
  var control = ctx.data.lookupControl(thisPath);
465
- if (!control) throw "No control for field";
465
+ if (!control) return undefined;
466
466
  var result = def ? cb(def, fieldData, control, false) : undefined;
467
467
  if (result !== undefined) return result;
468
+ var compound = isCompoundField(fieldData);
468
469
  if (fieldData.collection) {
469
470
  var cIndex = 0;
470
471
  for (var _iterator3 = _createForOfIteratorHelperLoose((_control$elements = control.elements) != null ? _control$elements : []), _step3; !(_step3 = _iterator3()).done;) {
@@ -472,7 +473,7 @@ function visitControlData(definition, ctx, cb) {
472
473
  var c = _step3.value;
473
474
  var elemResult = def ? cb(def, fieldData, c, true) : undefined;
474
475
  if (elemResult !== undefined) return elemResult;
475
- if (isCompoundField(fieldData)) {
476
+ if (compound) {
476
477
  var cfResult = visitControlDataArray(children, _extends({}, ctx, {
477
478
  fields: fieldData.children,
478
479
  path: [].concat(thisPath, [cIndex])
@@ -481,7 +482,13 @@ function visitControlData(definition, ctx, cb) {
481
482
  }
482
483
  cIndex++;
483
484
  }
485
+ } else if (compound) {
486
+ return visitControlDataArray(children, _extends({}, ctx, {
487
+ fields: fieldData.children,
488
+ path: thisPath
489
+ }), cb);
484
490
  }
491
+ return undefined;
485
492
  }
486
493
  }
487
494
  function lookupChildControl(data, path) {