Skip to content

Commit

Permalink
update: improve RJS form
Browse files Browse the repository at this point in the history
  • Loading branch information
k0stik committed Jul 29, 2024
1 parent f4633ac commit 84e5d35
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions dist/other/rjsf/RJSForm.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { FormProps } from "@rjsf/core";
import { RJSFSchema } from "@rjsf/utils";
import React from "react";
export default function RJSForm({ widgets, templates, ...props }: FormProps<any, RJSFSchema, any>): React.JSX.Element;
18 changes: 18 additions & 0 deletions dist/other/rjsf/RJSForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Form from "@rjsf/mui";
import React from "react";
import ArrayFieldItemTemplate from "./templates/ArrayFieldItemTemplate";
import ArrayFieldTemplate from "./templates/ArrayFieldTemplate";
import BaseInputTemplate from "./templates/BaseInputTemplate";
import ObjectFieldTemplate from "./templates/ObjectFieldTemplate";
import TitleFieldTemplate from "./templates/TitleFieldTemplate";
import SelectWidget from "./widgets/SelectWidget";
export default function RJSForm({ widgets, templates, ...props }) {
return (React.createElement(Form, { ...props, templates: {
ObjectFieldTemplate,
BaseInputTemplate,
ArrayFieldTemplate,
ArrayFieldItemTemplate,
TitleFieldTemplate,
...templates,
}, widgets: { SelectWidget, ...widgets } }));
}
5 changes: 3 additions & 2 deletions src/other/rjsf/RJSFForm.tsx → src/other/rjsf/RJSForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ObjectFieldTemplate from "./templates/ObjectFieldTemplate";
import TitleFieldTemplate from "./templates/TitleFieldTemplate";
import SelectWidget from "./widgets/SelectWidget";

export default function RJSFForm(props: FormProps<any, RJSFSchema, any>) {
export default function RJSForm({ widgets, templates, ...props }: FormProps<any, RJSFSchema, any>) {
return (
<Form
{...props}
Expand All @@ -21,8 +21,9 @@ export default function RJSFForm(props: FormProps<any, RJSFSchema, any>) {
ArrayFieldTemplate,
ArrayFieldItemTemplate,
TitleFieldTemplate,
...templates,
}}
widgets={{ SelectWidget }}
widgets={{ SelectWidget, ...widgets }}
/>
);
}

0 comments on commit 84e5d35

Please sign in to comment.