@rjsf/core 6.7.1 → 6.10.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 +199 -155
- package/dist/index.cjs +195 -193
- package/dist/index.cjs.map +3 -3
- package/dist/index.esm.js +225 -201
- package/dist/index.esm.js.map +3 -3
- package/lib/components/Form.d.ts +3 -2
- package/lib/components/Form.d.ts.map +1 -1
- package/lib/components/Form.js +62 -45
- package/lib/components/Form.js.map +1 -0
- package/lib/components/RichDescription.js +1 -0
- package/lib/components/RichDescription.js.map +1 -0
- package/lib/components/RichHelp.js +1 -0
- package/lib/components/RichHelp.js.map +1 -0
- package/lib/components/SchemaExamples.js +1 -0
- package/lib/components/SchemaExamples.js.map +1 -0
- package/lib/components/constants.js +1 -0
- package/lib/components/constants.js.map +1 -0
- package/lib/components/fields/ArrayField.d.ts.map +1 -1
- package/lib/components/fields/ArrayField.js +16 -17
- package/lib/components/fields/ArrayField.js.map +1 -0
- package/lib/components/fields/BooleanField.d.ts.map +1 -1
- package/lib/components/fields/BooleanField.js +2 -2
- package/lib/components/fields/BooleanField.js.map +1 -0
- package/lib/components/fields/CyclicSchemaField.js +1 -0
- package/lib/components/fields/CyclicSchemaField.js.map +1 -0
- package/lib/components/fields/FallbackField.js +1 -0
- package/lib/components/fields/FallbackField.js.map +1 -0
- package/lib/components/fields/LayoutGridField.d.ts +61 -1
- package/lib/components/fields/LayoutGridField.d.ts.map +1 -1
- package/lib/components/fields/LayoutGridField.js +50 -63
- package/lib/components/fields/LayoutGridField.js.map +1 -0
- package/lib/components/fields/LayoutHeaderField.js +1 -0
- package/lib/components/fields/LayoutHeaderField.js.map +1 -0
- package/lib/components/fields/LayoutMultiSchemaField.d.ts.map +1 -1
- package/lib/components/fields/LayoutMultiSchemaField.js +14 -18
- package/lib/components/fields/LayoutMultiSchemaField.js.map +1 -0
- package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
- package/lib/components/fields/MultiSchemaField.js +6 -7
- package/lib/components/fields/MultiSchemaField.js.map +1 -0
- package/lib/components/fields/NullField.js +1 -0
- package/lib/components/fields/NullField.js.map +1 -0
- package/lib/components/fields/NumberField.js +1 -0
- package/lib/components/fields/NumberField.js.map +1 -0
- package/lib/components/fields/ObjectField.d.ts.map +1 -1
- package/lib/components/fields/ObjectField.js +20 -25
- package/lib/components/fields/ObjectField.js.map +1 -0
- package/lib/components/fields/OptionalDataControlsField.js +1 -0
- package/lib/components/fields/OptionalDataControlsField.js.map +1 -0
- package/lib/components/fields/SchemaField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.js +5 -5
- package/lib/components/fields/SchemaField.js.map +1 -0
- package/lib/components/fields/StringField.js +1 -0
- package/lib/components/fields/StringField.js.map +1 -0
- package/lib/components/fields/index.js +15 -14
- package/lib/components/fields/index.js.map +1 -0
- package/lib/components/templates/ArrayFieldDescriptionTemplate.js +1 -0
- package/lib/components/templates/ArrayFieldDescriptionTemplate.js.map +1 -0
- package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +1 -0
- package/lib/components/templates/ArrayFieldItemButtonsTemplate.js.map +1 -0
- package/lib/components/templates/ArrayFieldItemTemplate.js +1 -0
- package/lib/components/templates/ArrayFieldItemTemplate.js.map +1 -0
- package/lib/components/templates/ArrayFieldTemplate.js +1 -0
- package/lib/components/templates/ArrayFieldTemplate.js.map +1 -0
- package/lib/components/templates/ArrayFieldTitleTemplate.js +1 -0
- package/lib/components/templates/ArrayFieldTitleTemplate.js.map +1 -0
- package/lib/components/templates/BaseInputTemplate.js +3 -2
- package/lib/components/templates/BaseInputTemplate.js.map +1 -0
- package/lib/components/templates/ButtonTemplates/AddButton.js +2 -1
- package/lib/components/templates/ButtonTemplates/AddButton.js.map +1 -0
- package/lib/components/templates/ButtonTemplates/IconButton.js +1 -0
- package/lib/components/templates/ButtonTemplates/IconButton.js.map +1 -0
- package/lib/components/templates/ButtonTemplates/SubmitButton.js +1 -0
- package/lib/components/templates/ButtonTemplates/SubmitButton.js.map +1 -0
- package/lib/components/templates/ButtonTemplates/index.js +4 -3
- package/lib/components/templates/ButtonTemplates/index.js.map +1 -0
- package/lib/components/templates/CyclicSchemaExpandTemplate.js +1 -0
- package/lib/components/templates/CyclicSchemaExpandTemplate.js.map +1 -0
- package/lib/components/templates/DescriptionField.js +2 -1
- package/lib/components/templates/DescriptionField.js.map +1 -0
- package/lib/components/templates/ErrorList.js +1 -0
- package/lib/components/templates/ErrorList.js.map +1 -0
- package/lib/components/templates/FallbackFieldTemplate.js +1 -0
- package/lib/components/templates/FallbackFieldTemplate.js.map +1 -0
- package/lib/components/templates/FieldErrorTemplate.js +1 -0
- package/lib/components/templates/FieldErrorTemplate.js.map +1 -0
- package/lib/components/templates/FieldHelpTemplate.js +2 -1
- package/lib/components/templates/FieldHelpTemplate.js.map +1 -0
- package/lib/components/templates/FieldTemplate/FieldTemplate.js +2 -1
- package/lib/components/templates/FieldTemplate/FieldTemplate.js.map +1 -0
- package/lib/components/templates/FieldTemplate/Label.js +1 -0
- package/lib/components/templates/FieldTemplate/Label.js.map +1 -0
- package/lib/components/templates/FieldTemplate/index.d.ts +1 -1
- package/lib/components/templates/FieldTemplate/index.d.ts.map +1 -1
- package/lib/components/templates/FieldTemplate/index.js +2 -1
- package/lib/components/templates/FieldTemplate/index.js.map +1 -0
- package/lib/components/templates/GridTemplate.js +1 -0
- package/lib/components/templates/GridTemplate.js.map +1 -0
- package/lib/components/templates/MultiSchemaFieldTemplate.js +1 -0
- package/lib/components/templates/MultiSchemaFieldTemplate.js.map +1 -0
- package/lib/components/templates/ObjectFieldTemplate.js +1 -0
- package/lib/components/templates/ObjectFieldTemplate.js.map +1 -0
- package/lib/components/templates/OptionalDataControlsTemplate.js +2 -1
- package/lib/components/templates/OptionalDataControlsTemplate.js.map +1 -0
- package/lib/components/templates/TitleField.js +1 -0
- package/lib/components/templates/TitleField.js.map +1 -0
- package/lib/components/templates/UnsupportedField.js +1 -0
- package/lib/components/templates/UnsupportedField.js.map +1 -0
- package/lib/components/templates/WrapIfAdditionalTemplate.js +2 -1
- package/lib/components/templates/WrapIfAdditionalTemplate.js.map +1 -0
- package/lib/components/templates/index.js +22 -21
- package/lib/components/templates/index.js.map +1 -0
- package/lib/components/widgets/AltDateTimeWidget.js +1 -0
- package/lib/components/widgets/AltDateTimeWidget.js.map +1 -0
- package/lib/components/widgets/AltDateWidget.js +1 -0
- package/lib/components/widgets/AltDateWidget.js.map +1 -0
- package/lib/components/widgets/CheckboxWidget.d.ts +1 -1
- package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -1
- package/lib/components/widgets/CheckboxWidget.js +4 -3
- package/lib/components/widgets/CheckboxWidget.js.map +1 -0
- package/lib/components/widgets/CheckboxesWidget.js +1 -0
- package/lib/components/widgets/CheckboxesWidget.js.map +1 -0
- package/lib/components/widgets/ColorWidget.js +1 -0
- package/lib/components/widgets/ColorWidget.js.map +1 -0
- package/lib/components/widgets/DateTimeWidget.js +1 -0
- package/lib/components/widgets/DateTimeWidget.js.map +1 -0
- package/lib/components/widgets/DateWidget.js +1 -0
- package/lib/components/widgets/DateWidget.js.map +1 -0
- package/lib/components/widgets/EmailWidget.js +1 -0
- package/lib/components/widgets/EmailWidget.js.map +1 -0
- package/lib/components/widgets/FileWidget.js +1 -0
- package/lib/components/widgets/FileWidget.js.map +1 -0
- package/lib/components/widgets/HiddenWidget.js +1 -0
- package/lib/components/widgets/HiddenWidget.js.map +1 -0
- package/lib/components/widgets/PasswordWidget.js +1 -0
- package/lib/components/widgets/PasswordWidget.js.map +1 -0
- package/lib/components/widgets/RadioWidget.js +1 -0
- package/lib/components/widgets/RadioWidget.js.map +1 -0
- package/lib/components/widgets/RangeWidget.js +1 -0
- package/lib/components/widgets/RangeWidget.js.map +1 -0
- package/lib/components/widgets/RatingWidget.d.ts +1 -1
- package/lib/components/widgets/RatingWidget.d.ts.map +1 -1
- package/lib/components/widgets/RatingWidget.js +2 -1
- package/lib/components/widgets/RatingWidget.js.map +1 -0
- package/lib/components/widgets/SelectWidget.js +1 -0
- package/lib/components/widgets/SelectWidget.js.map +1 -0
- package/lib/components/widgets/TextWidget.js +1 -0
- package/lib/components/widgets/TextWidget.js.map +1 -0
- package/lib/components/widgets/TextareaWidget.js +1 -0
- package/lib/components/widgets/TextareaWidget.js.map +1 -0
- package/lib/components/widgets/TimeWidget.d.ts.map +1 -1
- package/lib/components/widgets/TimeWidget.js +16 -3
- package/lib/components/widgets/TimeWidget.js.map +1 -0
- package/lib/components/widgets/URLWidget.js +1 -0
- package/lib/components/widgets/URLWidget.js.map +1 -0
- package/lib/components/widgets/UpDownWidget.js +1 -0
- package/lib/components/widgets/UpDownWidget.js.map +1 -0
- package/lib/components/widgets/index.js +21 -20
- package/lib/components/widgets/index.js.map +1 -0
- package/lib/getDefaultRegistry.js +4 -3
- package/lib/getDefaultRegistry.js.map +1 -0
- package/lib/getTestRegistry.js +2 -1
- package/lib/getTestRegistry.js.map +1 -0
- package/lib/index.d.ts +12 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -7
- package/lib/index.js.map +1 -0
- package/lib/withTheme.d.ts +1 -1
- package/lib/withTheme.d.ts.map +1 -1
- package/lib/withTheme.js +2 -1
- package/lib/withTheme.js.map +1 -0
- package/package.json +13 -18
- package/src/components/Form.tsx +68 -47
- package/src/components/fields/ArrayField.tsx +17 -19
- package/src/components/fields/BooleanField.tsx +1 -2
- package/src/components/fields/LayoutGridField.tsx +57 -65
- package/src/components/fields/LayoutMultiSchemaField.tsx +18 -18
- package/src/components/fields/MultiSchemaField.tsx +6 -8
- package/src/components/fields/ObjectField.tsx +26 -27
- package/src/components/fields/SchemaField.tsx +13 -4
- package/src/components/fields/index.ts +14 -14
- package/src/components/templates/BaseInputTemplate.tsx +2 -2
- package/src/components/templates/ButtonTemplates/AddButton.tsx +1 -1
- package/src/components/templates/ButtonTemplates/index.ts +3 -3
- package/src/components/templates/DescriptionField.tsx +1 -1
- package/src/components/templates/FieldHelpTemplate.tsx +1 -1
- package/src/components/templates/FieldTemplate/FieldTemplate.tsx +1 -1
- package/src/components/templates/FieldTemplate/index.ts +1 -1
- package/src/components/templates/OptionalDataControlsTemplate.tsx +1 -1
- package/src/components/templates/WrapIfAdditionalTemplate.tsx +1 -1
- package/src/components/templates/index.ts +21 -21
- package/src/components/widgets/CheckboxWidget.tsx +9 -2
- package/src/components/widgets/RatingWidget.tsx +0 -1
- package/src/components/widgets/TimeWidget.tsx +18 -3
- package/src/components/widgets/index.ts +20 -20
- package/src/getDefaultRegistry.ts +3 -3
- package/src/getTestRegistry.tsx +1 -1
- package/src/index.ts +12 -12
- package/src/withTheme.tsx +2 -2
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/src/tsconfig.json +0 -30
package/lib/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { FormProps, FormState, IChangeEvent } from './components/Form.
|
|
2
|
-
import Form from './components/Form.
|
|
3
|
-
import type { RichDescriptionProps } from './components/RichDescription.
|
|
4
|
-
import RichDescription from './components/RichDescription.
|
|
5
|
-
import type { RichHelpProps } from './components/RichHelp.
|
|
6
|
-
import RichHelp from './components/RichHelp.
|
|
7
|
-
import type { SchemaExamplesProps } from './components/SchemaExamples.
|
|
8
|
-
import SchemaExamples from './components/SchemaExamples.
|
|
9
|
-
import getDefaultRegistry from './getDefaultRegistry.
|
|
10
|
-
import getTestRegistry from './getTestRegistry.
|
|
11
|
-
import type { ThemeProps } from './withTheme.
|
|
12
|
-
import withTheme from './withTheme.
|
|
1
|
+
import type { FormProps, FormState, IChangeEvent } from './components/Form.tsx';
|
|
2
|
+
import Form from './components/Form.tsx';
|
|
3
|
+
import type { RichDescriptionProps } from './components/RichDescription.tsx';
|
|
4
|
+
import RichDescription from './components/RichDescription.tsx';
|
|
5
|
+
import type { RichHelpProps } from './components/RichHelp.tsx';
|
|
6
|
+
import RichHelp from './components/RichHelp.tsx';
|
|
7
|
+
import type { SchemaExamplesProps } from './components/SchemaExamples.tsx';
|
|
8
|
+
import SchemaExamples from './components/SchemaExamples.tsx';
|
|
9
|
+
import getDefaultRegistry from './getDefaultRegistry.ts';
|
|
10
|
+
import getTestRegistry from './getTestRegistry.tsx';
|
|
11
|
+
import type { ThemeProps } from './withTheme.tsx';
|
|
12
|
+
import withTheme from './withTheme.tsx';
|
|
13
13
|
export type { FormProps, FormState, IChangeEvent, ThemeProps, RichDescriptionProps, RichHelpProps, SchemaExamplesProps, };
|
|
14
14
|
export { withTheme, getDefaultRegistry, getTestRegistry, RichDescription, RichHelp, SchemaExamples };
|
|
15
15
|
export default Form;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,IAAI,MAAM,uBAAuB,CAAC;AACzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,eAAe,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,cAAc,MAAM,iCAAiC,CAAC;AAC7D,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,eAAe,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,YAAY,EACV,SAAS,EACT,SAAS,EACT,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,mBAAmB,GACpB,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AACrG,eAAe,IAAI,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import Form from
|
|
2
|
-
import RichDescription from
|
|
3
|
-
import RichHelp from
|
|
4
|
-
import SchemaExamples from
|
|
5
|
-
import getDefaultRegistry from
|
|
6
|
-
import getTestRegistry from
|
|
7
|
-
import withTheme from
|
|
1
|
+
import Form from "./components/Form.js";
|
|
2
|
+
import RichDescription from "./components/RichDescription.js";
|
|
3
|
+
import RichHelp from "./components/RichHelp.js";
|
|
4
|
+
import SchemaExamples from "./components/SchemaExamples.js";
|
|
5
|
+
import getDefaultRegistry from "./getDefaultRegistry.js";
|
|
6
|
+
import getTestRegistry from "./getTestRegistry.js";
|
|
7
|
+
import withTheme from "./withTheme.js";
|
|
8
8
|
export { withTheme, getDefaultRegistry, getTestRegistry, RichDescription, RichHelp, SchemaExamples };
|
|
9
9
|
export default Form;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,sBAAuB,CAAC;AAEzC,OAAO,eAAe,MAAM,iCAAkC,CAAC;AAE/D,OAAO,QAAQ,MAAM,0BAA2B,CAAC;AAEjD,OAAO,cAAc,MAAM,gCAAiC,CAAC;AAC7D,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,eAAe,MAAM,sBAAuB,CAAC;AAEpD,OAAO,SAAS,MAAM,gBAAiB,CAAC;AAYxC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AACrG,eAAe,IAAI,CAAC"}
|
package/lib/withTheme.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
3
|
-
import type { FormProps } from './components/Form.
|
|
3
|
+
import type { FormProps } from './components/Form.tsx';
|
|
4
4
|
/** The properties for the `withTheme` function, essentially a subset of properties from the `FormProps` that can be
|
|
5
5
|
* overridden while creating a theme
|
|
6
6
|
*/
|
package/lib/withTheme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withTheme.d.ts","sourceRoot":"","sources":["../src/withTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"withTheme.d.ts","sourceRoot":"","sources":["../src/withTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,IAAI,IAAI,CAC9G,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,sBAAsB,CAC5D,CAAC;AAEF,mHAAmH;AACnH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EACjH,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC9B,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CA8BnC"}
|
package/lib/withTheme.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import Form from
|
|
3
|
+
import Form from "./components/Form.js";
|
|
4
4
|
/** A Higher-Order component that creates a wrapper around a `Form` with the overrides from the `WithThemeProps` */
|
|
5
5
|
export default function withTheme(themeProps) {
|
|
6
6
|
// @ts-expect-error TS2322 because the latest types complain about LegacyRef's string form not working with Form
|
|
@@ -18,3 +18,4 @@ export default function withTheme(themeProps) {
|
|
|
18
18
|
return (_jsx(Form, { ...themeProps, ...directProps, fields: fields, widgets: widgets, templates: templates, ref: ref }));
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
+
//# sourceMappingURL=withTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withTheme.js","sourceRoot":"","sources":["../src/withTheme.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,IAAI,MAAM,sBAAuB,CAAC;AAUzC,mHAAmH;AACnH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,UAA+B;IAE/B,gHAAgH;IAChH,OAAO,UAAU,CACf,CACE,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,WAAW,EAAsB,EAC1G,GAAgC,EAChC,EAAE;QACF,MAAM,MAAM,GAAG,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CAAC;QACxD,MAAM,OAAO,GAAG,EAAE,GAAG,UAAU,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,CAAC;QAC3D,MAAM,SAAS,GAAG;YAChB,GAAG,UAAU,EAAE,SAAS;YACxB,GAAG,aAAa;YAChB,eAAe,EAAE;gBACf,GAAG,UAAU,EAAE,SAAS,EAAE,eAAe;gBACzC,GAAG,aAAa,EAAE,eAAe;aAClC;SACF,CAAC;QAEF,OAAO,CACL,KAAC,IAAI,OACC,UAAU,KACV,WAAW,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,GACR,CACH,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rjsf/core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.10.0",
|
|
4
4
|
"description": "A simple React component capable of building HTML forms out of a JSON schema.",
|
|
5
5
|
"lint-staged": {
|
|
6
6
|
"{src,test}/**/*.{ts,tsx,js,jsx}": [
|
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
"module": "lib/index.js",
|
|
13
13
|
"typings": "lib/index.d.ts",
|
|
14
14
|
"type": "module",
|
|
15
|
+
"sideEffects": false,
|
|
15
16
|
"exports": {
|
|
16
17
|
".": {
|
|
18
|
+
"@rjsf/source": "./src/index.ts",
|
|
17
19
|
"types": "./lib/index.d.ts",
|
|
18
20
|
"require": "./dist/index.cjs",
|
|
19
21
|
"import": "./lib/index.js"
|
|
@@ -50,26 +52,20 @@
|
|
|
50
52
|
},
|
|
51
53
|
"peerDependencies": {
|
|
52
54
|
"react": ">=18",
|
|
53
|
-
"@rjsf/utils": "^6.
|
|
55
|
+
"@rjsf/utils": "^6.10.0"
|
|
54
56
|
},
|
|
55
57
|
"dependencies": {
|
|
56
|
-
"
|
|
57
|
-
"lodash-es": "^4.18.1",
|
|
58
|
-
"markdown-to-jsx": "^9.8.2",
|
|
59
|
-
"prop-types": "^15.8.1"
|
|
58
|
+
"markdown-to-jsx": "^9.8.2"
|
|
60
59
|
},
|
|
61
60
|
"devDependencies": {
|
|
62
|
-
"@testing-library/jest-dom": "^
|
|
63
|
-
"@testing-library/react": "^16.3.
|
|
64
|
-
"@testing-library/user-event": "^14.6.
|
|
61
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
62
|
+
"@testing-library/react": "^16.3.3",
|
|
63
|
+
"@testing-library/user-event": "^14.6.6",
|
|
65
64
|
"@types/json-schema": "^7.0.15",
|
|
66
|
-
"@types/react-portal": "^4.0.7",
|
|
67
65
|
"ajv": "^8.20.0",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"@rjsf/
|
|
71
|
-
"@rjsf/utils": "^6.7.1",
|
|
72
|
-
"@rjsf/validator-ajv8": "^6.7.1"
|
|
66
|
+
"@rjsf/snapshot-tests": "^6.10.0",
|
|
67
|
+
"@rjsf/utils": "^6.10.0",
|
|
68
|
+
"@rjsf/validator-ajv8": "^6.10.0"
|
|
73
69
|
},
|
|
74
70
|
"directories": {
|
|
75
71
|
"test": "test"
|
|
@@ -109,8 +105,7 @@
|
|
|
109
105
|
}
|
|
110
106
|
},
|
|
111
107
|
"scripts": {
|
|
112
|
-
"
|
|
113
|
-
"build:ts": "pnpm run compileReplacer && rimraf ./lib && tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
108
|
+
"build:ts": "tsc -b",
|
|
114
109
|
"build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.cjs --sourcemap --packages=external --format=cjs",
|
|
115
110
|
"build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/index.esm.js --sourcemap --packages=external --format=esm",
|
|
116
111
|
"build:umd": "rollup dist/index.esm.js --format=umd --file=dist/core.umd.js --name=JSONSchemaForm",
|
|
@@ -121,7 +116,7 @@
|
|
|
121
116
|
"precommit": "lint-staged",
|
|
122
117
|
"publish-to-npm": "pnpm run build && pnpm publish",
|
|
123
118
|
"test": "vitest run",
|
|
124
|
-
"test:debug": "node --inspect-brk ../../node_modules/.bin/
|
|
119
|
+
"test:debug": "node --inspect-brk ../../node_modules/.bin/vitest --pool=forks",
|
|
125
120
|
"test:update": "vitest run --update",
|
|
126
121
|
"test:watch": "vitest",
|
|
127
122
|
"test-coverage": "vitest run --coverage"
|
package/src/components/Form.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
FieldPathId,
|
|
8
8
|
FieldPathList,
|
|
9
9
|
FormContextType,
|
|
10
|
+
GenericObjectType,
|
|
10
11
|
PathSchema,
|
|
11
12
|
StrictRJSFSchema,
|
|
12
13
|
Registry,
|
|
@@ -25,6 +26,10 @@ import type {
|
|
|
25
26
|
NameGeneratorFunction,
|
|
26
27
|
} from '@rjsf/utils';
|
|
27
28
|
import {
|
|
29
|
+
getByPath,
|
|
30
|
+
setByPath,
|
|
31
|
+
toPath,
|
|
32
|
+
unsetByPath,
|
|
28
33
|
createSchemaUtils,
|
|
29
34
|
deepEquals,
|
|
30
35
|
ErrorSchemaBuilder,
|
|
@@ -51,16 +56,9 @@ import {
|
|
|
51
56
|
ANY_OF_KEY,
|
|
52
57
|
ONE_OF_KEY,
|
|
53
58
|
} from '@rjsf/utils';
|
|
54
|
-
import _cloneDeep from 'lodash/cloneDeep';
|
|
55
|
-
import _get from 'lodash/get';
|
|
56
|
-
import _isEmpty from 'lodash/isEmpty';
|
|
57
|
-
import _pick from 'lodash/pick';
|
|
58
|
-
import _set from 'lodash/set';
|
|
59
|
-
import _toPath from 'lodash/toPath';
|
|
60
|
-
import _unset from 'lodash/unset';
|
|
61
59
|
|
|
62
|
-
import getDefaultRegistry from '../getDefaultRegistry';
|
|
63
|
-
import { ADDITIONAL_PROPERTY_KEY_REMOVE, IS_RESET } from './constants';
|
|
60
|
+
import getDefaultRegistry from '../getDefaultRegistry.ts';
|
|
61
|
+
import { ADDITIONAL_PROPERTY_KEY_REMOVE, IS_RESET } from './constants.ts';
|
|
64
62
|
|
|
65
63
|
/** Represents a boolean option that is deprecated.
|
|
66
64
|
* @deprecated - In a future major release, this type will be removed
|
|
@@ -349,8 +347,16 @@ function toIChangeEvent<T = any, S extends StrictRJSFSchema = RJSFSchema, F exte
|
|
|
349
347
|
state: FormState<T, S, F>,
|
|
350
348
|
status?: IChangeEvent['status'],
|
|
351
349
|
): IChangeEvent<T, S, F> {
|
|
350
|
+
const { schema, uiSchema, fieldPathId, schemaUtils, formData, edit, errors, errorSchema } = state;
|
|
352
351
|
return {
|
|
353
|
-
|
|
352
|
+
schema,
|
|
353
|
+
uiSchema,
|
|
354
|
+
fieldPathId,
|
|
355
|
+
schemaUtils,
|
|
356
|
+
formData,
|
|
357
|
+
edit,
|
|
358
|
+
errors,
|
|
359
|
+
errorSchema,
|
|
354
360
|
...(status !== undefined && { status }),
|
|
355
361
|
};
|
|
356
362
|
}
|
|
@@ -488,7 +494,9 @@ export default class Form<
|
|
|
488
494
|
// match one of the subSchemas, the retrieved schema must be updated.
|
|
489
495
|
isSchemaChanged || isFormDataChanged ? undefined : this.state.retrievedSchema,
|
|
490
496
|
isSchemaChanged,
|
|
491
|
-
|
|
497
|
+
// Only the error clearing needs the path of each changed field, and it runs only when live validation does
|
|
498
|
+
// not, so the walk that produces them is left for `getStateFromProps` to ask for
|
|
499
|
+
() => getChangedFields(this.props.formData, prevProps.formData, true),
|
|
492
500
|
// Skip live validation for this request if no form data has changed from the last state
|
|
493
501
|
!isStateDataChanged,
|
|
494
502
|
);
|
|
@@ -545,7 +553,8 @@ export default class Form<
|
|
|
545
553
|
* @param inputFormData - The new or current data for the `Form`
|
|
546
554
|
* @param retrievedSchema - An expanded schema, if not provided, it will be retrieved from the `schema` and `formData`.
|
|
547
555
|
* @param [isSchemaChanged=false] - A flag indicating whether the schema has changed.
|
|
548
|
-
* @param [
|
|
556
|
+
* @param [getFormDataChangedFields=() => []] - Optional function returning the path of each `formData` field that
|
|
557
|
+
* changed, only called when those paths are needed, which is when live validation is not going to run
|
|
549
558
|
* @param [skipLiveValidate=false] - Optional flag, if true, means that we are not running live validation
|
|
550
559
|
* @param [shouldSanitize=false] - Optional flag, if true, means that we should attempt to sanitize formData
|
|
551
560
|
* @returns - The new state for the `Form`
|
|
@@ -555,7 +564,7 @@ export default class Form<
|
|
|
555
564
|
inputFormData?: T,
|
|
556
565
|
retrievedSchema?: S,
|
|
557
566
|
isSchemaChanged = false,
|
|
558
|
-
|
|
567
|
+
getFormDataChangedFields: () => string[] = () => [],
|
|
559
568
|
skipLiveValidate = false,
|
|
560
569
|
shouldSanitize = false,
|
|
561
570
|
): FormState<T, S, F> {
|
|
@@ -691,17 +700,31 @@ export default class Form<
|
|
|
691
700
|
errors = currentErrors.errors;
|
|
692
701
|
errorSchema = currentErrors.errorSchema;
|
|
693
702
|
// We only update the error schema for changed fields if mustValidate is false
|
|
694
|
-
if (
|
|
695
|
-
const
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
703
|
+
if (!mustValidate) {
|
|
704
|
+
const formDataChangedFields = getFormDataChangedFields();
|
|
705
|
+
if (formDataChangedFields.length > 0) {
|
|
706
|
+
// `formDataChangedFields` carries the path of each field that changed, so clearing has to follow that path
|
|
707
|
+
// instead of dropping the whole branch it starts in. The path is split with `toPath()`, the same way
|
|
708
|
+
// `toErrorSchema()` splits a validation error property, so the two address the same entry. Intermediate
|
|
709
|
+
// objects are forced so the numeric segment of an array item stays an object key, which is how an
|
|
710
|
+
// `ErrorSchema` addresses array items.
|
|
711
|
+
const newErrorSchema = formDataChangedFields.reduce<GenericObjectType>((acc, path) => {
|
|
712
|
+
const pathOfField = toPath(path);
|
|
713
|
+
// Every container holding the field changed along with it, so an error of their own, such as the
|
|
714
|
+
// `uniqueItems` of the array the field sits in, is cleared too. Only their own errors go: the other
|
|
715
|
+
// fields they hold did not change and keep theirs.
|
|
716
|
+
for (let i = 1; i < pathOfField.length; i++) {
|
|
717
|
+
setByPath(acc, [...pathOfField.slice(0, i), ERRORS_KEY], undefined, true);
|
|
718
|
+
}
|
|
719
|
+
return setByPath(acc, pathOfField, undefined, true);
|
|
720
|
+
}, {});
|
|
721
|
+
schemaValidationErrorSchema = mergeObjects(
|
|
722
|
+
currentErrors.errorSchema,
|
|
723
|
+
newErrorSchema,
|
|
724
|
+
'preventDuplicates',
|
|
725
|
+
) as ErrorSchema<T>;
|
|
726
|
+
errorSchema = schemaValidationErrorSchema;
|
|
727
|
+
}
|
|
705
728
|
}
|
|
706
729
|
const mergedErrors = Form.mergeErrors<T>({ errorSchema, errors }, props.extraErrors, state.customErrors);
|
|
707
730
|
errors = mergedErrors.errors;
|
|
@@ -951,7 +974,7 @@ export default class Form<
|
|
|
951
974
|
const rootPathId = fieldPathId.path[0] || '';
|
|
952
975
|
|
|
953
976
|
const isRootPath = !path || path.length === 0 || (path.length === 1 && path[0] === rootPathId);
|
|
954
|
-
let formData = isRootPath ? newValue :
|
|
977
|
+
let formData = isRootPath ? newValue : structuredClone(oldFormData);
|
|
955
978
|
|
|
956
979
|
// When switching from null to an object option in oneOf, MultiSchemaField sends
|
|
957
980
|
// an object with property names but undefined values (e.g., {types: undefined, content: undefined}).
|
|
@@ -974,7 +997,7 @@ export default class Form<
|
|
|
974
997
|
|
|
975
998
|
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
976
999
|
// For additional properties, this key was explicitly removed, so unset it
|
|
977
|
-
|
|
1000
|
+
unsetByPath(formData, path);
|
|
978
1001
|
} else if (!isRootPath) {
|
|
979
1002
|
// Set the new value at its path in the form data.
|
|
980
1003
|
let valueForPath: T | null | undefined = newValue;
|
|
@@ -998,9 +1021,9 @@ export default class Form<
|
|
|
998
1021
|
}
|
|
999
1022
|
|
|
1000
1023
|
if (plainLeafWasCleared) {
|
|
1001
|
-
|
|
1024
|
+
setByPath(formData, path, undefined);
|
|
1002
1025
|
} else {
|
|
1003
|
-
|
|
1026
|
+
setByPath(formData, path, valueForPath);
|
|
1004
1027
|
}
|
|
1005
1028
|
}
|
|
1006
1029
|
const shouldSanitize =
|
|
@@ -1024,7 +1047,7 @@ export default class Form<
|
|
|
1024
1047
|
// formData copy passed to AJV via JSON.parse(JSON.stringify(...)) so the validator never
|
|
1025
1048
|
// sees { [key]: undefined } for type:"string" or patternProperties fields (#4518).
|
|
1026
1049
|
if (plainLeafWasCleared && formData) {
|
|
1027
|
-
|
|
1050
|
+
setByPath(formData, path, undefined);
|
|
1028
1051
|
}
|
|
1029
1052
|
}
|
|
1030
1053
|
|
|
@@ -1040,15 +1063,17 @@ export default class Form<
|
|
|
1040
1063
|
|
|
1041
1064
|
if (newErrorSchema) {
|
|
1042
1065
|
// First check to see if there is an existing validation error on this path...
|
|
1043
|
-
|
|
1044
|
-
|
|
1066
|
+
const oldValidationError = !isRootPath
|
|
1067
|
+
? getByPath(schemaValidationErrorSchema, path)
|
|
1068
|
+
: schemaValidationErrorSchema;
|
|
1045
1069
|
// If there is an old validation error for this path, assume we are updating it directly
|
|
1046
|
-
if (
|
|
1070
|
+
if (oldValidationError && Object.keys(oldValidationError).length > 0) {
|
|
1047
1071
|
// Apply the user-supplied newErrorSchema onto a clone of the AJV-only base, so that
|
|
1048
1072
|
// mergeErrors below sees the user's error at this path without mutating shared state.
|
|
1049
1073
|
if (!isRootPath) {
|
|
1050
|
-
mergeBaseErrorSchema =
|
|
1051
|
-
|
|
1074
|
+
mergeBaseErrorSchema = structuredClone(schemaValidationErrorSchema);
|
|
1075
|
+
// An `ErrorSchema` nests plain objects even at numeric segments, so never auto-vivify arrays
|
|
1076
|
+
setByPath(mergeBaseErrorSchema, path, newErrorSchema, true);
|
|
1052
1077
|
} else {
|
|
1053
1078
|
mergeBaseErrorSchema = newErrorSchema;
|
|
1054
1079
|
}
|
|
@@ -1057,16 +1082,17 @@ export default class Form<
|
|
|
1057
1082
|
customErrors = new ErrorSchemaBuilder<T>();
|
|
1058
1083
|
}
|
|
1059
1084
|
if (isRootPath) {
|
|
1060
|
-
const pathErrors =
|
|
1085
|
+
const pathErrors = newErrorSchema[ERRORS_KEY];
|
|
1061
1086
|
if (pathErrors) {
|
|
1062
1087
|
// only set errors when there are some
|
|
1063
1088
|
customErrors.setErrors(pathErrors);
|
|
1064
1089
|
}
|
|
1065
1090
|
} else {
|
|
1066
|
-
|
|
1091
|
+
// An `ErrorSchema` nests plain objects even at numeric segments, so never auto-vivify arrays
|
|
1092
|
+
setByPath(customErrors.ErrorSchema, path, newErrorSchema, true);
|
|
1067
1093
|
}
|
|
1068
1094
|
}
|
|
1069
|
-
} else if (customErrors &&
|
|
1095
|
+
} else if (customErrors && getByPath(customErrors.ErrorSchema, [...path, ERRORS_KEY])) {
|
|
1070
1096
|
// If we have custom errors and the path has an error, then we need to clear it
|
|
1071
1097
|
customErrors.clearErrors(path);
|
|
1072
1098
|
}
|
|
@@ -1186,8 +1212,8 @@ export default class Form<
|
|
|
1186
1212
|
// Filter out `schemaValidationErrors` and `schemaValidationErrorSchema` since they aren't IChangeEvent props
|
|
1187
1213
|
.filter((key) => !key.startsWith('schemaValidation'))
|
|
1188
1214
|
.some((key) => {
|
|
1189
|
-
const oldData =
|
|
1190
|
-
const newData =
|
|
1215
|
+
const oldData = this.state[key as keyof FormState<T, S, F>];
|
|
1216
|
+
const newData = state[key as keyof FormState<T, S, F>];
|
|
1191
1217
|
return !deepEquals(oldData, newData);
|
|
1192
1218
|
});
|
|
1193
1219
|
this.setState(state as FormState<T, S, F>, () => {
|
|
@@ -1338,14 +1364,9 @@ export default class Form<
|
|
|
1338
1364
|
focusOnError(error: RJSFValidationError) {
|
|
1339
1365
|
const { idPrefix = 'root', idSeparator = '_' } = this.props;
|
|
1340
1366
|
const { property } = error;
|
|
1341
|
-
const path =
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
path[0] = idPrefix;
|
|
1345
|
-
} else {
|
|
1346
|
-
// Otherwise insert the idPrefix into the first location using unshift
|
|
1347
|
-
path.unshift(idPrefix);
|
|
1348
|
-
}
|
|
1367
|
+
const path = toPath(property ?? '');
|
|
1368
|
+
// The id of the root element is the idPrefix, so prepend it to the path
|
|
1369
|
+
path.unshift(idPrefix);
|
|
1349
1370
|
|
|
1350
1371
|
const elementId = path.join(idSeparator);
|
|
1351
1372
|
let field = this.formElement.current.elements[elementId];
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
UIOptionsType,
|
|
15
15
|
} from '@rjsf/utils';
|
|
16
16
|
import {
|
|
17
|
+
setByPath,
|
|
17
18
|
allowAdditionalItems,
|
|
18
19
|
getTemplate,
|
|
19
20
|
getUiOptions,
|
|
@@ -22,6 +23,7 @@ import {
|
|
|
22
23
|
isCustomWidget,
|
|
23
24
|
isFixedItems,
|
|
24
25
|
isFormDataAvailable,
|
|
26
|
+
isObject,
|
|
25
27
|
optionsList,
|
|
26
28
|
shouldRenderOptionalField,
|
|
27
29
|
toFieldPathId,
|
|
@@ -30,10 +32,6 @@ import {
|
|
|
30
32
|
ID_KEY,
|
|
31
33
|
TranslatableString,
|
|
32
34
|
} from '@rjsf/utils';
|
|
33
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
34
|
-
import isObject from 'lodash/isObject';
|
|
35
|
-
import set from 'lodash/set';
|
|
36
|
-
import uniqueId from 'lodash/uniqueId';
|
|
37
35
|
|
|
38
36
|
/** Type used to represent the keyed form data used in the state */
|
|
39
37
|
interface KeyedFormDataType<T> {
|
|
@@ -42,8 +40,11 @@ interface KeyedFormDataType<T> {
|
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
/** Used to generate a unique ID for an element in a row */
|
|
43
|
+
let rowIdCounter = 0;
|
|
44
|
+
|
|
45
45
|
function generateRowId() {
|
|
46
|
-
|
|
46
|
+
rowIdCounter += 1;
|
|
47
|
+
return `rjsf-array-item-${rowIdCounter}`;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
/** Converts the `formData` into `KeyedFormDataType` data, using the `generateRowId()` function to create the key
|
|
@@ -710,10 +711,7 @@ function FixedArray<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
710
711
|
const { OptionalDataControlsField } = fields;
|
|
711
712
|
const renderOptionalField = shouldRenderOptionalField<T[], S, F>(registry, schema, required, uiSchema);
|
|
712
713
|
const hasFormData = isFormDataAvailable<T[]>(formData);
|
|
713
|
-
const schemaItems
|
|
714
|
-
() => (isObject(schema.items) ? (schema.items as S[]) : ([] as S[])),
|
|
715
|
-
[schema.items],
|
|
716
|
-
);
|
|
714
|
+
const schemaItems = useMemo<S[]>(() => (Array.isArray(schema.items) ? (schema.items as S[]) : []), [schema.items]);
|
|
717
715
|
const hasAdditionalItems = isObject(schema.additionalItems);
|
|
718
716
|
// All the children will use childFieldPathId if present in the props, falling back to the fieldPathId
|
|
719
717
|
const childFieldPathId = props.childFieldPathId ?? fieldPathId;
|
|
@@ -903,9 +901,9 @@ export default function ArrayField<T = any, S extends StrictRJSFSchema = RJSFSch
|
|
|
903
901
|
for (const idx of Object.keys(errorSchemaRef.current)) {
|
|
904
902
|
const i = parseInt(idx, 10);
|
|
905
903
|
if (index === undefined || i < index) {
|
|
906
|
-
|
|
904
|
+
setByPath(newErrorSchema, i, errorSchemaRef.current[i]);
|
|
907
905
|
} else if (i >= index) {
|
|
908
|
-
|
|
906
|
+
setByPath(newErrorSchema, i + 1, errorSchemaRef.current[i]);
|
|
909
907
|
}
|
|
910
908
|
}
|
|
911
909
|
}
|
|
@@ -943,16 +941,16 @@ export default function ArrayField<T = any, S extends StrictRJSFSchema = RJSFSch
|
|
|
943
941
|
for (const idx of Object.keys(errorSchemaRef.current)) {
|
|
944
942
|
const i = parseInt(idx, 10);
|
|
945
943
|
if (i <= index) {
|
|
946
|
-
|
|
944
|
+
setByPath(newErrorSchema, i, errorSchemaRef.current[i]);
|
|
947
945
|
} else if (i > index) {
|
|
948
|
-
|
|
946
|
+
setByPath(newErrorSchema, i + 1, errorSchemaRef.current[i]);
|
|
949
947
|
}
|
|
950
948
|
}
|
|
951
949
|
}
|
|
952
950
|
|
|
953
951
|
const newKeyedFormDataRow: KeyedFormDataType<T> = {
|
|
954
952
|
key: generateRowId(),
|
|
955
|
-
item:
|
|
953
|
+
item: structuredClone(keyedFormDataRef.current[index].item),
|
|
956
954
|
};
|
|
957
955
|
const newKeyedFormData = [...keyedFormDataRef.current];
|
|
958
956
|
if (index !== undefined) {
|
|
@@ -983,9 +981,9 @@ export default function ArrayField<T = any, S extends StrictRJSFSchema = RJSFSch
|
|
|
983
981
|
for (const idx of Object.keys(errorSchemaRef.current)) {
|
|
984
982
|
const i = parseInt(idx, 10);
|
|
985
983
|
if (i < index) {
|
|
986
|
-
|
|
984
|
+
setByPath(newErrorSchema, i, errorSchemaRef.current[i]);
|
|
987
985
|
} else if (i > index) {
|
|
988
|
-
|
|
986
|
+
setByPath(newErrorSchema, i - 1, errorSchemaRef.current[i]);
|
|
989
987
|
}
|
|
990
988
|
}
|
|
991
989
|
}
|
|
@@ -1014,11 +1012,11 @@ export default function ArrayField<T = any, S extends StrictRJSFSchema = RJSFSch
|
|
|
1014
1012
|
for (const idx of Object.keys(errorSchemaRef.current)) {
|
|
1015
1013
|
const i = parseInt(idx, 10);
|
|
1016
1014
|
if (i === index) {
|
|
1017
|
-
|
|
1015
|
+
setByPath(newErrorSchema, newIndex, errorSchemaRef.current[index]);
|
|
1018
1016
|
} else if (i === newIndex) {
|
|
1019
|
-
|
|
1017
|
+
setByPath(newErrorSchema, index, errorSchemaRef.current[newIndex]);
|
|
1020
1018
|
} else {
|
|
1021
|
-
|
|
1019
|
+
setByPath(newErrorSchema, idx, errorSchemaRef.current[i]);
|
|
1022
1020
|
}
|
|
1023
1021
|
}
|
|
1024
1022
|
}
|
|
@@ -7,8 +7,7 @@ import type {
|
|
|
7
7
|
RJSFSchema,
|
|
8
8
|
StrictRJSFSchema,
|
|
9
9
|
} from '@rjsf/utils';
|
|
10
|
-
import { getWidget, getUiOptions, optionsList, TranslatableString } from '@rjsf/utils';
|
|
11
|
-
import isObject from 'lodash/isObject';
|
|
10
|
+
import { getWidget, getUiOptions, isObject, optionsList, TranslatableString } from '@rjsf/utils';
|
|
12
11
|
|
|
13
12
|
/** The `BooleanField` component is used to render a field in the schema is boolean. It constructs `enumOptions` for the
|
|
14
13
|
* two boolean values based on the various alternatives in the schema.
|