@rjsf/utils 5.0.0-beta.18 → 5.0.0-beta.19

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/dist/index.d.ts CHANGED
@@ -672,6 +672,14 @@ type UiSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormCo
672
672
  * to look up an implementation from the `fields` list or an actual one-off `Field` component implementation itself
673
673
  */
674
674
  "ui:field"?: Field<T, S, F> | string;
675
+ /** By default, any field that is rendered for an `anyOf`/`oneOf` schema will be wrapped inside the `AnyOfField` or
676
+ * `OneOfField` component. This default behavior may be undesirable if your custom field already handles behavior
677
+ * related to choosing one or more subschemas contained in the `anyOf`/`oneOf` schema.
678
+ * By providing a `true` value for this flag in association with a custom `ui:field`, the wrapped components will be
679
+ * omitted, so just one instance of the custom field will be rendered. If the flag is omitted or set to `false`,
680
+ * your custom field will be wrapped by `AnyOfField`/`OneOfField`.
681
+ */
682
+ "ui:fieldReplacesAnyOrOneOf"?: boolean;
675
683
  /** An object that contains all the potential UI options in a single object */
676
684
  "ui:options"?: UIOptionsType<T, S, F>;
677
685
  };
@@ -1559,6 +1559,16 @@ function toPathSchema(validator, schema, name, rootSchema, formData) {
1559
1559
  return toPathSchema(validator, _schema, name, rootSchema, formData);
1560
1560
  }
1561
1561
  var pathSchema = (_pathSchema = {}, _pathSchema[NAME_KEY] = name.replace(/^\./, ""), _pathSchema);
1562
+ if (ONE_OF_KEY in schema) {
1563
+ var index = getClosestMatchingOption(validator, rootSchema, formData, schema.oneOf, 0);
1564
+ var _schema2 = schema.oneOf[index];
1565
+ return toPathSchema(validator, _schema2, name, rootSchema, formData);
1566
+ }
1567
+ if (ANY_OF_KEY in schema) {
1568
+ var _index = getClosestMatchingOption(validator, rootSchema, formData, schema.anyOf, 0);
1569
+ var _schema3 = schema.anyOf[_index];
1570
+ return toPathSchema(validator, _schema3, name, rootSchema, formData);
1571
+ }
1562
1572
  if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
1563
1573
  set__default["default"](pathSchema, RJSF_ADDITONAL_PROPERTIES_FLAG, true);
1564
1574
  }