@rjsf/core 6.2.5 → 6.3.0

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
@@ -2093,7 +2093,7 @@
2093
2093
  const {
2094
2094
  schema: _schema,
2095
2095
  fieldPathId,
2096
- uiSchema,
2096
+ uiSchema: _uiSchema,
2097
2097
  formData,
2098
2098
  errorSchema,
2099
2099
  name,
@@ -2107,6 +2107,7 @@
2107
2107
  } = props;
2108
2108
  const { schemaUtils, globalFormOptions, globalUiOptions, fields: fields2 } = registry;
2109
2109
  const { AnyOfField: _AnyOfField, OneOfField: _OneOfField } = fields2;
2110
+ const uiSchema = utils.resolveUiSchema(_schema, _uiSchema, registry);
2110
2111
  const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
2111
2112
  const FieldTemplate2 = utils.getTemplate("FieldTemplate", registry, uiOptions);
2112
2113
  const DescriptionFieldTemplate = utils.getTemplate(
@@ -2592,6 +2593,18 @@
2592
2593
  }
2593
2594
  );
2594
2595
  }
2596
+ function SchemaExamples(props) {
2597
+ const { id, schema } = props;
2598
+ const { examples, default: schemaDefault } = schema;
2599
+ if (!Array.isArray(examples)) {
2600
+ return null;
2601
+ }
2602
+ return /* @__PURE__ */ jsxRuntime.jsx("datalist", { id: utils.examplesId(id), children: examples.concat(
2603
+ schemaDefault !== void 0 && !examples.map(String).includes(String(schemaDefault)) ? [schemaDefault] : []
2604
+ ).map((example) => {
2605
+ return /* @__PURE__ */ jsxRuntime.jsx("option", { value: example }, String(example));
2606
+ }) }, `datalist_${id}`);
2607
+ }
2595
2608
  function BaseInputTemplate(props) {
2596
2609
  const {
2597
2610
  id,
@@ -2673,9 +2686,7 @@
2673
2686
  }
2674
2687
  ),
2675
2688
  options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */ jsxRuntime.jsx(ClearButton2, { registry, onClick: _onClear }),
2676
- Array.isArray(schema.examples) && /* @__PURE__ */ jsxRuntime.jsx("datalist", { id: utils.examplesId(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
2677
- return /* @__PURE__ */ jsxRuntime.jsx("option", { value: example }, example);
2678
- }) }, `datalist_${id}`)
2689
+ /* @__PURE__ */ jsxRuntime.jsx(SchemaExamples, { id, schema })
2679
2690
  ] });
2680
2691
  }
2681
2692
  function SubmitButton({ uiSchema }) {
@@ -3960,11 +3971,12 @@
3960
3971
  }
3961
3972
  const newRegistry = this.getRegistry(props, rootSchema, schemaUtils);
3962
3973
  const registry = utils.deepEquals(state.registry, newRegistry) ? state.registry : newRegistry;
3974
+ const expandedUiSchema = registry.uiSchemaDefinitions ? utils.expandUiSchemaDefinitions(rootSchema, uiSchema, registry) : uiSchema;
3963
3975
  const fieldPathId = state.fieldPathId && state.fieldPathId?.[utils.ID_KEY] === registry.globalFormOptions.idPrefix ? state.fieldPathId : utils.toFieldPathId("", registry.globalFormOptions);
3964
3976
  const nextState = {
3965
3977
  schemaUtils,
3966
3978
  schema: rootSchema,
3967
- uiSchema,
3979
+ uiSchema: expandedUiSchema,
3968
3980
  fieldPathId,
3969
3981
  formData,
3970
3982
  edit,
@@ -4407,7 +4419,8 @@
4407
4419
  schemaUtils,
4408
4420
  translateString: customTranslateString || translateString,
4409
4421
  globalUiOptions: uiSchema[utils.UI_GLOBAL_OPTIONS_KEY],
4410
- globalFormOptions: this.getGlobalFormOptions(props)
4422
+ globalFormOptions: this.getGlobalFormOptions(props),
4423
+ uiSchemaDefinitions: uiSchema[utils.UI_DEFINITIONS_KEY] ?? {}
4411
4424
  };
4412
4425
  }
4413
4426
  /** Provides a function that can be used to programmatically submit the `Form` */
@@ -4640,6 +4653,7 @@
4640
4653
 
4641
4654
  exports.RichDescription = RichDescription;
4642
4655
  exports.RichHelp = RichHelp;
4656
+ exports.SchemaExamples = SchemaExamples;
4643
4657
  exports.default = index_default;
4644
4658
  exports.getDefaultRegistry = getDefaultRegistry;
4645
4659
  exports.getTestRegistry = getTestRegistry;