@rjsf/core 5.2.0 → 5.2.1
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/LICENSE.md +183 -183
- package/README.md +1 -1
- package/dist/core.cjs.development.js +831 -735
- package/dist/core.cjs.development.js.map +1 -1
- package/dist/core.cjs.production.min.js +1 -1
- package/dist/core.cjs.production.min.js.map +1 -1
- package/dist/core.esm.js +798 -701
- package/dist/core.esm.js.map +1 -1
- package/dist/core.umd.development.js +833 -738
- package/dist/core.umd.development.js.map +1 -1
- package/dist/core.umd.production.min.js +1 -1
- package/dist/core.umd.production.min.js.map +1 -1
- package/dist/index.d.ts +17 -17
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode, FormEvent, ElementType, Ref, Component, RefObject, ComponentType } from 'react';
|
|
2
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` */
|
|
@@ -8,7 +8,7 @@ interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
8
8
|
/** An implementation of the `ValidatorType` interface that is needed for form validation to work */
|
|
9
9
|
validator: ValidatorType<T, S, F>;
|
|
10
10
|
/** The optional children for the form, if provided, it will replace the default `SubmitButton` */
|
|
11
|
-
children?:
|
|
11
|
+
children?: ReactNode;
|
|
12
12
|
/** The uiSchema for the form */
|
|
13
13
|
uiSchema?: UiSchema<T, S, F>;
|
|
14
14
|
/** The data for the form, used to prefill a form with existing data */
|
|
@@ -40,8 +40,8 @@ interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
40
40
|
/** The dictionary of registered fields in the form */
|
|
41
41
|
fields?: RegistryFieldsType<T, S, F>;
|
|
42
42
|
/** The dictionary of registered templates in the form; Partial allows a subset to be provided beyond the defaults */
|
|
43
|
-
templates?: Partial<Omit<TemplatesType<T, S, F>,
|
|
44
|
-
ButtonTemplates?: Partial<TemplatesType<T, S, F>[
|
|
43
|
+
templates?: Partial<Omit<TemplatesType<T, S, F>, 'ButtonTemplates'>> & {
|
|
44
|
+
ButtonTemplates?: Partial<TemplatesType<T, S, F>['ButtonTemplates']>;
|
|
45
45
|
};
|
|
46
46
|
/** The dictionary of registered widgets in the form */
|
|
47
47
|
widgets?: RegistryWidgetsType<T, S, F>;
|
|
@@ -58,7 +58,7 @@ interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
58
58
|
* and its data are valid. It will be passed a result object having a `formData` attribute, which is the valid form
|
|
59
59
|
* data you're usually after. The original event will also be passed as a second parameter
|
|
60
60
|
*/
|
|
61
|
-
onSubmit?: (data: IChangeEvent<T, S, F>, event:
|
|
61
|
+
onSubmit?: (data: IChangeEvent<T, S, F>, event: FormEvent<any>) => void;
|
|
62
62
|
/** Sometimes you may want to trigger events or modify external state when a field has been touched, so you can pass
|
|
63
63
|
* an `onBlur` handler, which will receive the id of the input that was blurred and the field value
|
|
64
64
|
*/
|
|
@@ -92,7 +92,7 @@ interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
92
92
|
* nesting forms. However, native browser form behaviour, such as submitting when the `Enter` key is pressed, may no
|
|
93
93
|
* longer work
|
|
94
94
|
*/
|
|
95
|
-
tagName?:
|
|
95
|
+
tagName?: ElementType;
|
|
96
96
|
/** The value of this prop will be passed to the `target` HTML attribute on the form */
|
|
97
97
|
target?: string;
|
|
98
98
|
/** Formerly the `validate` prop; Takes a function that specifies custom validation rules for the form */
|
|
@@ -123,7 +123,7 @@ interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
123
123
|
/** When this prop is set to `top` or 'bottom', a list of errors (or the custom error list defined in the `ErrorList`) will also
|
|
124
124
|
* show. When set to false, only inline input validation errors will be shown. Set to `top` by default
|
|
125
125
|
*/
|
|
126
|
-
showErrorList?: false |
|
|
126
|
+
showErrorList?: false | 'top' | 'bottom';
|
|
127
127
|
/** A function can be passed to this prop in order to make modifications to the default errors resulting from JSON
|
|
128
128
|
* Schema validation
|
|
129
129
|
*/
|
|
@@ -136,7 +136,7 @@ interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
136
136
|
* `%` indicates the order of the parameter. The ordering of parameters is important because some languages may choose
|
|
137
137
|
* to put the second parameter before the first in its translation.
|
|
138
138
|
*/
|
|
139
|
-
translateString?: Registry[
|
|
139
|
+
translateString?: Registry['translateString'];
|
|
140
140
|
/**
|
|
141
141
|
* _internalFormWrapper is currently used by the semantic-ui theme to provide a custom wrapper around `<Form />`
|
|
142
142
|
* that supports the proper rendering of those themes. To use this prop, one must pass a component that takes two
|
|
@@ -152,10 +152,10 @@ interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
152
152
|
*
|
|
153
153
|
* Use at your own risk as this prop is private and may change at any time without notice.
|
|
154
154
|
*/
|
|
155
|
-
_internalFormWrapper?:
|
|
155
|
+
_internalFormWrapper?: ElementType;
|
|
156
156
|
/** Support receiving a React ref to the Form
|
|
157
157
|
*/
|
|
158
|
-
ref?:
|
|
158
|
+
ref?: Ref<Form<T, S, F>>;
|
|
159
159
|
}
|
|
160
160
|
/** The data that is contained within the state for the `Form` */
|
|
161
161
|
interface FormState<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
|
|
@@ -187,16 +187,16 @@ interface FormState<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
187
187
|
/** The event data passed when changes have been made to the form, includes everything from the `FormState` except
|
|
188
188
|
* the schema validation errors. An additional `status` is added when returned from `onSubmit`
|
|
189
189
|
*/
|
|
190
|
-
interface IChangeEvent<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Omit<FormState<T, S, F>,
|
|
190
|
+
interface IChangeEvent<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Omit<FormState<T, S, F>, 'schemaValidationErrors' | 'schemaValidationErrorSchema'> {
|
|
191
191
|
/** The status of the form when submitted */
|
|
192
|
-
status?:
|
|
192
|
+
status?: 'submitted';
|
|
193
193
|
}
|
|
194
194
|
/** The `Form` component renders the outer form and all the fields defined in the `schema` */
|
|
195
195
|
declare class Form<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Component<FormProps<T, S, F>, FormState<T, S, F>> {
|
|
196
196
|
/** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
|
|
197
197
|
* provide any possible type here
|
|
198
198
|
*/
|
|
199
|
-
formElement:
|
|
199
|
+
formElement: RefObject<any>;
|
|
200
200
|
/** Constructs the `Form` from the `props`. Will setup the initial state from the props. It will also call the
|
|
201
201
|
* `onChange` handler if the initially provided `formData` is modified to add missing default values as part of the
|
|
202
202
|
* state construction.
|
|
@@ -283,7 +283,7 @@ declare class Form<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends F
|
|
|
283
283
|
*
|
|
284
284
|
* @param event - The submit HTML form event
|
|
285
285
|
*/
|
|
286
|
-
onSubmit: (event:
|
|
286
|
+
onSubmit: (event: FormEvent<any>) => void;
|
|
287
287
|
/** Returns the registry for the form */
|
|
288
288
|
getRegistry(): Registry<T, S, F>;
|
|
289
289
|
/** Provides a function that can be used to programmatically submit the `Form` */
|
|
@@ -310,14 +310,14 @@ declare class Form<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends F
|
|
|
310
310
|
/** The properties for the `withTheme` function, essentially a subset of properties from the `FormProps` that can be
|
|
311
311
|
* overridden while creating a theme
|
|
312
312
|
*/
|
|
313
|
-
type ThemeProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Pick<FormProps<T, S, F>,
|
|
313
|
+
type ThemeProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Pick<FormProps<T, S, F>, 'fields' | 'templates' | 'widgets' | '_internalFormWrapper'>;
|
|
314
314
|
/** A Higher-Order component that creates a wrapper around a `Form` with the overrides from the `WithThemeProps` */
|
|
315
|
-
declare function withTheme<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(themeProps: ThemeProps<T, S, F>):
|
|
315
|
+
declare function withTheme<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(themeProps: ThemeProps<T, S, F>): ComponentType<FormProps<T, S, F>>;
|
|
316
316
|
|
|
317
317
|
/** The default registry consists of all the fields, templates and widgets provided in the core implementation,
|
|
318
318
|
* plus an empty `rootSchema` and `formContext. We omit schemaUtils here because it cannot be defaulted without a
|
|
319
319
|
* rootSchema and validator. It will be added into the computed registry later in the Form.
|
|
320
320
|
*/
|
|
321
|
-
declare function getDefaultRegistry<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): Omit<Registry<T, S, F>,
|
|
321
|
+
declare function getDefaultRegistry<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): Omit<Registry<T, S, F>, 'schemaUtils'>;
|
|
322
322
|
|
|
323
323
|
export { FormProps, FormState, IChangeEvent, ThemeProps, Form as default, getDefaultRegistry, withTheme };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rjsf/core",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.1",
|
|
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",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@babel/preset-env": "^7.20.2",
|
|
54
54
|
"@babel/preset-react": "^7.18.6",
|
|
55
55
|
"@babel/register": "^7.18.9",
|
|
56
|
-
"@rjsf/utils": "^5.2.
|
|
57
|
-
"@rjsf/validator-ajv6": "^5.2.
|
|
58
|
-
"@rjsf/validator-ajv8": "^5.2.
|
|
56
|
+
"@rjsf/utils": "^5.2.1",
|
|
57
|
+
"@rjsf/validator-ajv6": "^5.2.1",
|
|
58
|
+
"@rjsf/validator-ajv8": "^5.2.1",
|
|
59
59
|
"@types/lodash": "^4.14.191",
|
|
60
60
|
"@types/react": "^17.0.39",
|
|
61
61
|
"@types/react-dom": "^17.0.11",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"publishConfig": {
|
|
95
95
|
"access": "public"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "461f74b2f51c17e1cdaa327f63ef0fd88060fde0"
|
|
98
98
|
}
|