forked from rjsf-team/react-jsonschema-form
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add generic type support to the mui theme
partially fix: rjsf-team#3072 by adding generic type support to the mui theme - In `@rjsf/core` added a few missing generics to utility function calls in `CheckboxWidget`, `ObjectFieldTemplate`, `SubmitButton` and `SelectWidget` - In `@rjsf/mui` added generic type support as follows: - Updated all of the template and widget components to add the `T = any`, `S extends StrictRJSFSchema = RJSFSchema` and `F extends FormContextType = any` generics on the function definitions, types and utility function calls - Added a `generateForm<T, S, F>()` function to `MuiForm.tsx`, exporting it and exporting the default `MuiForm` as a call to `generateForm()` - Added a `generateTemplates<T, S, F>()` function to the `Templates.tsx`, exporting it and exporting the default `Templates` as a call to `generateTemplates()` - Added a `generateTheme<T, S, F>()` function to the `Theme.tsx`, exporting it and exporting the default `Theme` as a call to `generateTheme()` - Added a `generateWidgets<T, S, F>()` function to the `Widgets.tsx`, exporting it and exporting the default `Widgets` as a call to `generateWidgets()` - Updated the main `index.ts` for the theme to also export the `generateXXX()` functions - Fixed the number of new packages listes in the upgrade guide from 3 to 4 - Updated the `CHANGELOG.md` accordingly
- Loading branch information
1 parent
4fb8046
commit 768c9e8
Showing
33 changed files
with
595 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
import React from "react"; | ||
import AddIcon from "@mui/icons-material/Add"; | ||
import IconButton from "@mui/material/IconButton"; | ||
import { IconButtonProps } from "@rjsf/utils"; | ||
import { | ||
FormContextType, | ||
IconButtonProps, | ||
RJSFSchema, | ||
StrictRJSFSchema, | ||
} from "@rjsf/utils"; | ||
|
||
const AddButton: React.ComponentType<IconButtonProps> = ({ | ||
uiSchema, | ||
registry, | ||
...props | ||
}) => { | ||
/** The `AddButton` renders a button that represent the `Add` action on a form | ||
*/ | ||
export default function AddButton< | ||
T = any, | ||
S extends StrictRJSFSchema = RJSFSchema, | ||
F extends FormContextType = any | ||
>({ uiSchema, registry, ...props }: IconButtonProps<T, S, F>) { | ||
return ( | ||
<IconButton title="Add Item" {...props} color="primary"> | ||
<AddIcon /> | ||
</IconButton> | ||
); | ||
}; | ||
|
||
export default AddButton; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.