-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support customization / props of submit button using ui:submitButtonOptions #2640
Support customization / props of submit button using ui:submitButtonOptions #2640
Conversation
Merging latest changes
Merge latest changes
@epicfaace I have made the feature regarding submitButtonProps. Not sure how I can make the other themes pass without the functionality not existing as of yet. So how do I update the tests of the other themes if getSubmitButtonProps does not exist yet |
@epicfaace maybe I should remove all the theme related changes and put that in a separate request, when this is available? |
@epicfaace please let me know what I need to change. If you want me to exclude the other theme changes as separate pull request after this is merged in I can do that |
@epicfaace can this be merged in then? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ui:submitOptions": {"props": {}, "allowed": true}}
Remove "allowed" to "removed" ("removed" is set to false by default)
Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
@epicfaace all good |
@epicfaace So this is the part I dont understand. I have, below are the commands I have run. |
…ueswho/react-jsonschema-form into jacqueswho-feature/submit_button_props
@jacqueswho I tried running tests and got some test failures as well (in addition to snapshot failures): |
…nto feature/submit_button_props
…eact-jsonschema-form into feature/submit_button_props
…nto feature/submit_button_props
Did github codespaces do the trick? |
CC @jacqueswho I'm wondering if this PR had an error, or the package has not published properly - see #2831 According to NPM - last publish was a month ago - so possibly the latter. |
@@ -0,0 +1,20 @@ | |||
import React from 'react'; | |||
import Box from "@material-ui/core/Box"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@epicfaace @jacqueswho The pattern for @material-ui
is different, we don't import directly from @material-ui/core
anymore.
import Box from "@material-ui/core/Box"; | ||
import { WidgetProps, utils } from '@rjsf/core'; | ||
|
||
import Button from '@material-ui/core/Button'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto on import, instead, this should be:
import { useMuiComponent } from '../MuiComponentContext';
|
||
const { getSubmitButtonOptions } = utils; | ||
const SubmitButton: React.FC<WidgetProps> = props => { | ||
const { submitText, norender, props: submitButtonProps }= getSubmitButtonOptions(props.uiSchema); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get the Box
and Button
from the context.
const { Box, Button } = useMuiComponent();
- Feature for ui:submitButtonOptions on the submit button for forms (https://github.com/rjsf-team/react-jsonschema-form/pull/2640) | ||
|
||
## Dev / docs / playground | ||
- Enable ui options in playground, to demonstrate submit button options (https://github.com/rjsf-team/react-jsonschema-form/pull/2640) | ||
|
||
## @rjsf/bootstrap-4 | ||
- SubmitButton widget to use new ui:submitButtonOptions on the submit button for forms (https://github.com/rjsf-team/react-jsonschema-form/pull/2640) | ||
|
||
## @rjsf/semantic-ui | ||
- SubmitButton widget to use new ui:submitButtonOptions on the submit button for forms (https://github.com/rjsf-team/react-jsonschema-form/pull/2640) | ||
|
||
## @rjsf/antd | ||
- SubmitButton widget to use new ui:submitButtonOptions on the submit button for forms (https://github.com/rjsf-team/react-jsonschema-form/pull/2640) | ||
|
||
## @rjsf/fluent-ui | ||
- SubmitButton widget to use new ui:submitButtonOptions on the submit button for forms (https://github.com/rjsf-team/react-jsonschema-form/pull/2640) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacqueswho This should be moved up under a new 4.2.0
section (4.1.1 was already released) rather than being under v3.2.1
and include ## @material-ui
as well, since we actually haven't published this feature yet.
Reasons for making this change
Currently there is no options to hide the submit button or change the text of the button. ui:submitButtonProps will allow you to change the text, if it is required for readonly forms and disable it. Fixes #1602
Checklist