Skip to content
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

Merged
merged 70 commits into from
Apr 13, 2022
Merged

Support customization / props of submit button using ui:submitButtonOptions #2640

merged 70 commits into from
Apr 13, 2022

Conversation

jacqueswho
Copy link
Contributor

@jacqueswho jacqueswho commented Dec 29, 2021

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

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests
    • I've updated docs if needed
    • I've updated the changelog with a description of the PR
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

@jacqueswho
Copy link
Contributor Author

@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

@jacqueswho
Copy link
Contributor Author

@epicfaace maybe I should remove all the theme related changes and put that in a separate request, when this is available?

@jacqueswho
Copy link
Contributor Author

@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

@jacqueswho
Copy link
Contributor Author

@epicfaace can this be merged in then?

Copy link
Member

@epicfaace epicfaace left a 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)

CHANGELOG.md Outdated Show resolved Hide resolved
docs/api-reference/uiSchema.md Outdated Show resolved Hide resolved
docs/api-reference/uiSchema.md Outdated Show resolved Hide resolved
docs/api-reference/uiSchema.md Outdated Show resolved Hide resolved
docs/api-reference/uiSchema.md Outdated Show resolved Hide resolved
jacqueswho and others added 4 commits January 18, 2022 18:50
Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
@jacqueswho
Copy link
Contributor Author

@epicfaace all good

@jacqueswho
Copy link
Contributor Author

jacqueswho commented Mar 5, 2022

lgtm, Please update snapshots and then we will merge.

@epicfaace So this is the part I dont understand. I have, below are the commands I have run.
git pull origin master
git pull upstream master
npm run test:update

@epicfaace
Copy link
Member

@jacqueswho I tried running tests and got some test failures as well (in addition to snapshot failures):

image

@epicfaace
Copy link
Member

Did github codespaces do the trick?

@jacqueswho
Copy link
Contributor Author

Did github codespaces do the trick?

image

I dont understand it. I updated and pushed but its still failing.

@jacqueswho jacqueswho merged commit 57f00cb into rjsf-team:master Apr 13, 2022
@jacqueswho jacqueswho deleted the feature/submit_button_props branch April 13, 2022 15:37
@dwjohnston
Copy link
Contributor

dwjohnston commented Apr 26, 2022

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";
Copy link
Member

@heath-freenome heath-freenome Apr 27, 2022

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';
Copy link
Member

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);
Copy link
Member

@heath-freenome heath-freenome Apr 27, 2022

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();

Comment on lines +97 to +112
- 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)
Copy link
Member

@heath-freenome heath-freenome Apr 27, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't display submit button
4 participants