@rjsf/core 6.0.0-beta.10 → 6.0.0-beta.11

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/core.umd.js CHANGED
@@ -1660,6 +1660,11 @@
1660
1660
  } = this.props;
1661
1661
  const { widgets: widgets2, fields: fields2, translateString, globalUiOptions, schemaUtils } = registry;
1662
1662
  const { SchemaField: _SchemaField } = fields2;
1663
+ const MultiSchemaFieldTemplate2 = utils.getTemplate(
1664
+ "MultiSchemaFieldTemplate",
1665
+ registry,
1666
+ globalUiOptions
1667
+ );
1663
1668
  const { selectedOption, retrievedOptions } = this.state;
1664
1669
  const {
1665
1670
  widget = "select",
@@ -1706,34 +1711,42 @@
1706
1711
  value: index
1707
1712
  };
1708
1713
  });
1709
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "panel panel-default panel-body", children: [
1710
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "form-group", children: /* @__PURE__ */ jsxRuntime.jsx(
1711
- Widget,
1712
- {
1713
- id: this.getFieldId(),
1714
- name: `${name}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`,
1715
- schema: { type: "number", default: 0 },
1716
- onChange: this.onOptionChange,
1717
- onBlur,
1718
- onFocus,
1719
- disabled: disabled || isEmpty(enumOptions),
1720
- multiple: false,
1721
- rawErrors,
1722
- errorSchema: fieldErrorSchema,
1723
- value: selectedOption >= 0 ? selectedOption : void 0,
1724
- options: { enumOptions, ...uiOptions },
1725
- registry,
1726
- formContext,
1727
- placeholder,
1728
- autocomplete,
1729
- autofocus,
1730
- label: title ?? name,
1731
- hideLabel: !displayLabel,
1732
- readonly
1733
- }
1734
- ) }),
1735
- optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ jsxRuntime.jsx(_SchemaField, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema })
1736
- ] });
1714
+ const selector = /* @__PURE__ */ jsxRuntime.jsx(
1715
+ Widget,
1716
+ {
1717
+ id: this.getFieldId(),
1718
+ name: `${name}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`,
1719
+ schema: { type: "number", default: 0 },
1720
+ onChange: this.onOptionChange,
1721
+ onBlur,
1722
+ onFocus,
1723
+ disabled: disabled || isEmpty(enumOptions),
1724
+ multiple: false,
1725
+ rawErrors,
1726
+ errorSchema: fieldErrorSchema,
1727
+ value: selectedOption >= 0 ? selectedOption : void 0,
1728
+ options: { enumOptions, ...uiOptions },
1729
+ registry,
1730
+ formContext,
1731
+ placeholder,
1732
+ autocomplete,
1733
+ autofocus,
1734
+ label: title ?? name,
1735
+ hideLabel: !displayLabel,
1736
+ readonly
1737
+ }
1738
+ );
1739
+ const optionsSchemaField = optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ jsxRuntime.jsx(_SchemaField, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema }) || null;
1740
+ return /* @__PURE__ */ jsxRuntime.jsx(
1741
+ MultiSchemaFieldTemplate2,
1742
+ {
1743
+ schema,
1744
+ registry,
1745
+ uiSchema,
1746
+ selector,
1747
+ optionSchemaField: optionsSchemaField
1748
+ }
1749
+ );
1737
1750
  }
1738
1751
  };
1739
1752
  var MultiSchemaField_default = AnyOfField;
@@ -2816,6 +2829,13 @@
2816
2829
  const { children, column, className, ...rest } = props;
2817
2830
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className, ...rest, children });
2818
2831
  }
2832
+ function MultiSchemaFieldTemplate(props) {
2833
+ const { selector, optionSchemaField } = props;
2834
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "panel panel-default panel-body", children: [
2835
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "form-group", children: selector }),
2836
+ optionSchemaField
2837
+ ] });
2838
+ }
2819
2839
  function ObjectFieldTemplate(props) {
2820
2840
  const {
2821
2841
  description,
@@ -2980,6 +3000,7 @@
2980
3000
  FieldErrorTemplate,
2981
3001
  FieldHelpTemplate,
2982
3002
  GridTemplate,
3003
+ MultiSchemaFieldTemplate,
2983
3004
  ObjectFieldTemplate,
2984
3005
  TitleFieldTemplate: TitleField,
2985
3006
  UnsupportedFieldTemplate: UnsupportedField_default,