forked from rjsf-team/react-jsonschema-form
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 `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
ff034df
commit eae582f
Showing
31 changed files
with
597 additions
and
271 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +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, | ||
...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, ...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
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.