From 84e5d35609bc2c86a84a5748f10bf107db6c6a94 Mon Sep 17 00:00:00 2001 From: Kostiantyn Dvornik Date: Mon, 29 Jul 2024 17:21:57 +0300 Subject: [PATCH] update: improve RJS form --- dist/other/rjsf/RJSForm.d.ts | 4 ++++ dist/other/rjsf/RJSForm.js | 18 ++++++++++++++++++ src/other/rjsf/{RJSFForm.tsx => RJSForm.tsx} | 5 +++-- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 dist/other/rjsf/RJSForm.d.ts create mode 100644 dist/other/rjsf/RJSForm.js rename src/other/rjsf/{RJSFForm.tsx => RJSForm.tsx} (82%) diff --git a/dist/other/rjsf/RJSForm.d.ts b/dist/other/rjsf/RJSForm.d.ts new file mode 100644 index 0000000..0a0f148 --- /dev/null +++ b/dist/other/rjsf/RJSForm.d.ts @@ -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): React.JSX.Element; diff --git a/dist/other/rjsf/RJSForm.js b/dist/other/rjsf/RJSForm.js new file mode 100644 index 0000000..a7cb143 --- /dev/null +++ b/dist/other/rjsf/RJSForm.js @@ -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 } })); +} diff --git a/src/other/rjsf/RJSFForm.tsx b/src/other/rjsf/RJSForm.tsx similarity index 82% rename from src/other/rjsf/RJSFForm.tsx rename to src/other/rjsf/RJSForm.tsx index f6e63d9..2c20ec7 100644 --- a/src/other/rjsf/RJSFForm.tsx +++ b/src/other/rjsf/RJSForm.tsx @@ -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) { +export default function RJSForm({ widgets, templates, ...props }: FormProps) { return (
) { ArrayFieldTemplate, ArrayFieldItemTemplate, TitleFieldTemplate, + ...templates, }} - widgets={{ SelectWidget }} + widgets={{ SelectWidget, ...widgets }} /> ); }