@rjsf/core 5.0.2 → 5.2.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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { Component } from 'react';
2
- import { StrictRJSFSchema, RJSFSchema, FormContextType, ValidatorType, UiSchema, RegistryFieldsType, TemplatesType, RegistryWidgetsType, RJSFValidationError, CustomValidator, ErrorSchema, ErrorTransformer, IdSchema, SchemaUtilsType, ValidationData, Registry, PathSchema } from '@rjsf/utils';
2
+ import { StrictRJSFSchema, RJSFSchema, FormContextType, ValidatorType, UiSchema, RegistryFieldsType, TemplatesType, RegistryWidgetsType, RJSFValidationError, CustomValidator, ErrorSchema, ErrorTransformer, Registry, IdSchema, SchemaUtilsType, ValidationData, PathSchema } from '@rjsf/utils';
3
3
 
4
4
  /** The properties that are passed to the `Form` */
5
5
  interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
@@ -128,6 +128,15 @@ interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
128
128
  * Schema validation
129
129
  */
130
130
  transformErrors?: ErrorTransformer<T, S, F>;
131
+ /** If set to true, then the first field with an error will receive the focus when the form is submitted with errors
132
+ */
133
+ focusOnFirstError?: boolean;
134
+ /** Optional string translation function, if provided, allows users to change the translation of the RJSF internal
135
+ * strings. Some strings contain replaceable parameter values as indicated by `%1`, `%2`, etc. The number after the
136
+ * `%` indicates the order of the parameter. The ordering of parameters is important because some languages may choose
137
+ * to put the second parameter before the first in its translation.
138
+ */
139
+ translateString?: Registry["translateString"];
131
140
  /**
132
141
  * _internalFormWrapper is currently used by the semantic-ui theme to provide a custom wrapper around `<Form />`
133
142
  * that supports the proper rendering of those themes. To use this prop, one must pass a component that takes two
@@ -279,6 +288,13 @@ declare class Form<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends F
279
288
  getRegistry(): Registry<T, S, F>;
280
289
  /** Provides a function that can be used to programmatically submit the `Form` */
281
290
  submit(): void;
291
+ /** Attempts to focus on the field associated with the `error`. Uses the `property` field to compute path of the error
292
+ * field, then, using the `idPrefix` and `idSeparator` converts that path into an id. Then the input element with that
293
+ * id is attempted to be found using the `formElement` ref. If it is located, then it is focused.
294
+ *
295
+ * @param error - The error on which to focus
296
+ */
297
+ focusOnError(error: RJSFValidationError): void;
282
298
  /** Programmatically validate the form. If `onError` is provided, then it will be called with the list of errors the
283
299
  * same way as would happen on form submission.
284
300
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rjsf/core",
3
- "version": "5.0.2",
3
+ "version": "5.2.0",
4
4
  "description": "A simple React component capable of building HTML forms out of a JSON schema.",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && dts build --rollupTypes --format cjs,esm,umd",
@@ -39,6 +39,7 @@
39
39
  "dependencies": {
40
40
  "lodash": "^4.17.15",
41
41
  "lodash-es": "^4.17.15",
42
+ "markdown-to-jsx": "^7.1.9",
42
43
  "nanoid": "^3.3.4",
43
44
  "prop-types": "^15.7.2"
44
45
  },
@@ -48,13 +49,13 @@
48
49
  "@babel/plugin-proposal-class-properties": "^7.18.6",
49
50
  "@babel/plugin-proposal-optional-chaining": "^7.20.7",
50
51
  "@babel/plugin-transform-object-assign": "^7.18.6",
51
- "@babel/plugin-transform-react-jsx": "^7.20.7",
52
+ "@babel/plugin-transform-react-jsx": "^7.20.13",
52
53
  "@babel/preset-env": "^7.20.2",
53
54
  "@babel/preset-react": "^7.18.6",
54
55
  "@babel/register": "^7.18.9",
55
- "@rjsf/utils": "^5.0.2",
56
- "@rjsf/validator-ajv6": "^5.0.2",
57
- "@rjsf/validator-ajv8": "^5.0.2",
56
+ "@rjsf/utils": "^5.2.0",
57
+ "@rjsf/validator-ajv6": "^5.2.0",
58
+ "@rjsf/validator-ajv8": "^5.2.0",
58
59
  "@types/lodash": "^4.14.191",
59
60
  "@types/react": "^17.0.39",
60
61
  "@types/react-dom": "^17.0.11",
@@ -62,14 +63,14 @@
62
63
  "atob": "^2.1.2",
63
64
  "chai": "^3.3.0",
64
65
  "dts-cli": "^1.6.3",
65
- "eslint": "^8.31.0",
66
+ "eslint": "^8.33.0",
66
67
  "html": "^1.0.0",
67
68
  "jsdom": "^20.0.1",
68
69
  "mocha": "^10.2.0",
69
70
  "react": "^17.0.2",
70
71
  "react-dom": "^17.0.2",
71
72
  "react-portal": "^4.2.2",
72
- "rimraf": "^4.0.4",
73
+ "rimraf": "^4.1.2",
73
74
  "sinon": "^9.0.2"
74
75
  },
75
76
  "directories": {
@@ -93,5 +94,5 @@
93
94
  "publishConfig": {
94
95
  "access": "public"
95
96
  },
96
- "gitHead": "8fa3d2a7c18bc508ca5f61328400c5508238df82"
97
+ "gitHead": "43002ee01891686f9404960d217fcc1ea7eb5633"
97
98
  }