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
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
eef9605
Merge pull request #2 from rjsf-team/master
jacqueswho Apr 9, 2020
04b3d07
Merge pull request #4 from rjsf-team/master
jacqueswho Jun 1, 2020
9e2dff9
Merge branch 'rjsf-team:master' into master
jacqueswho Oct 28, 2021
28e86ba
feat: submit button props
jacqueswho Dec 29, 2021
0f4c77c
feat: ui options playground options
jacqueswho Dec 29, 2021
807a377
feat: other themes to implement widget
jacqueswho Dec 29, 2021
43a175f
feat: remove hidden option
jacqueswho Dec 30, 2021
7656dd3
chore: required to allowed
jacqueswho Jan 14, 2022
7b4673a
chore: requested changes
jacqueswho Jan 17, 2022
1c2800d
doc: change prop
jacqueswho Jan 17, 2022
4c5960c
chore: version bump changes
jacqueswho Jan 18, 2022
ff636fe
Update CHANGELOG.md
jacqueswho Jan 18, 2022
492a2bc
Update docs/api-reference/uiSchema.md
jacqueswho Jan 18, 2022
20cf440
Update docs/api-reference/uiSchema.md
jacqueswho Jan 18, 2022
1a484d5
Update docs/api-reference/uiSchema.md
jacqueswho Jan 18, 2022
16bc002
dox: updated
jacqueswho Jan 18, 2022
29a5f3a
chore: version changes
jacqueswho Jan 25, 2022
3aeae46
chore: revert version
jacqueswho Jan 25, 2022
36f57b3
Merge branch 'rjsf-team:master' into master
jacqueswho Jan 25, 2022
911d5f3
Squashed commit of the following:
jacqueswho Jan 25, 2022
2c1ed48
Merge branch 'master' into feature/submit_button_props
jacqueswho Jan 25, 2022
1b0c918
lint: cs-check
jacqueswho Jan 25, 2022
35f5bd2
linting: js format
jacqueswho Jan 25, 2022
24b8d80
feat: updated util types
jacqueswho Jan 26, 2022
e30ea18
feat: getSubmitButtonOptions type
jacqueswho Jan 26, 2022
73f515c
chore: update tests
jacqueswho Jan 26, 2022
45405be
chore: tests updated
jacqueswho Jan 26, 2022
9b16d83
hocer: snapshots updated
jacqueswho Jan 26, 2022
d9eb5c9
chore: test:update command
jacqueswho Jan 26, 2022
3654887
Update snapshots
epicfaace Jan 26, 2022
f3aebb5
Update PR template with snapshot update command
epicfaace Jan 26, 2022
cc6d90c
feat: remove default className
jacqueswho Jan 26, 2022
c94591f
chore: update util tests
jacqueswho Jan 26, 2022
5d98df6
chore: remove classname test
jacqueswho Jan 26, 2022
629e0bb
chore: snapshots updated
jacqueswho Jan 27, 2022
d6a09eb
Merge branch 'rjsf-team:master' into master
jacqueswho Feb 16, 2022
e91212c
Squashed commit of the following:
jacqueswho Feb 16, 2022
2e3a3d8
merge with master
jacqueswho Feb 16, 2022
81347a2
Merge branch 'feature/submit_button_props' of https://github.com/jacq…
jacqueswho Feb 16, 2022
64fc369
Revert "Squashed commit of the following:"
jacqueswho Feb 18, 2022
2e17c56
Merge branch 'master' of git://github.com/rjsf-team/react-jsonschema-…
jacqueswho Feb 18, 2022
0507f87
chore: update tests
jacqueswho Feb 18, 2022
2f5a808
Merge branch 'master' into feature/submit_button_props
jacqueswho Feb 18, 2022
2a559fa
Merge branch 'master' into feature/submit_button_props
jacqueswho Feb 24, 2022
68f9d28
Merge branch 'master' of github.com:jacqueswho/react-jsonschema-form …
jacqueswho Feb 25, 2022
2d354da
Merge branch 'master' of git://github.com/rjsf-team/react-jsonschema-…
jacqueswho Feb 25, 2022
7858979
Merge branch 'master' into feature/submit_button_props
jacqueswho Mar 1, 2022
7e220d7
Merge branch 'master' into feature/submit_button_props
epicfaace Mar 4, 2022
b58c34c
Merge branch 'master' of git://github.com/rjsf-team/react-jsonschema-…
jacqueswho Mar 4, 2022
b596d2b
Merge branch 'feature/submit_button_props' of github.com:jacqueswho/r…
jacqueswho Mar 4, 2022
e6fd8cb
test: snapshots updated
jacqueswho Mar 5, 2022
cb89a03
chore: norender changes
jacqueswho Mar 5, 2022
0088b0d
Merge branch 'feature/submit_button_props' of https://github.com/jacq…
epicfaace Mar 15, 2022
62fc572
revert
epicfaace Mar 15, 2022
2f677cd
update snapshots
epicfaace Mar 15, 2022
769a035
fix: include correct code again for submit button props
jacqueswho Mar 15, 2022
386a029
chore: update snapshots
jacqueswho Mar 15, 2022
6b176aa
Merge branch 'master' into feature/submit_button_props
jacqueswho Mar 16, 2022
8ac01ee
Merge branch 'master' of github.com:rjsf-team/react-jsonschema-form i…
jacqueswho Apr 7, 2022
9b440d3
Merge branch 'master' into feature/submit_button_props
jacqueswho Apr 7, 2022
43e79a6
Merge branch 'feature/submit_button_props' of github.com:jacqueswho/r…
jacqueswho Apr 7, 2022
8ee49f5
Merge branch 'master' of github.com:rjsf-team/react-jsonschema-form i…
jacqueswho Apr 8, 2022
23dea6f
Merge branch 'master' of github.com:rjsf-team/react-jsonschema-form i…
jacqueswho Apr 12, 2022
540f456
chore: update snapshots
jacqueswho Apr 12, 2022
1fe1e4c
chore: snapshots updated
jacqueswho Apr 12, 2022
e1ebb05
chore: update snapshots semantic-ui
jacqueswho Apr 12, 2022
fe2d6ae
Merge branch 'master' of https://github.com/rjsf-team/react-jsonschem…
jacqueswho Apr 13, 2022
8462132
chore: get latest version master
jacqueswho Apr 13, 2022
4b8f901
Merge branch 'master' into feature/submit_button_props
jacqueswho Apr 13, 2022
0b436f1
chore: snapshots updated
jacqueswho Apr 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,27 @@ should change the heading of the (upcoming) version to include a major version b

# v3.2.1 (upcoming)

## Dev / docs / playground
- Enable ui options in playground, to demonstrate submit button options (https://github.com/rjsf-team/react-jsonschema-form/pull/2640)

## @rjsf/core
- Feature for ui:submitButtonOptions on the submit button for forms (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/material-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/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)

# v3.2.0

## @rjsf/core
Expand Down Expand Up @@ -45,7 +66,7 @@ should change the heading of the (upcoming) version to include a major version b
- Take into account implicitly defined types when rendering labels for fields (https://github.com/rjsf-team/react-jsonschema-form/pull/2502)

## @rjsf/antd
- Add default Form export to @rjsf/antd (https://github.com/rjsf-team/react-jsonschema-form/pull/2514)
- Add default Form export to @rjsf/antd (https://github.com/rjsf-team/react-jsonschema-form/pull/2514)

## @rjsf/fluent-ui
- Make material-ui and fluent-ui pull TextWidget from the registry; remove registry prop from <div> in TextWidget (https://github.com/rjsf-team/react-jsonschema-form/pull/2515)
Expand Down
53 changes: 52 additions & 1 deletion docs/api-reference/uiSchema.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,30 @@ In other words, the following uiSchemas are equivalent:
{
"ui:title": "Title",
"ui:description": "Description"
"ui:submitButtonOptions": {
"props": {
"disabled": false,
"className": "btn btn-info",
},
"removed": false,
"submitText": "Submit"
},
}
```

```json
{
"ui:options": {
"title": "Title",
"description": "Description"
"description": "Description",
"submitButtonOptions": {
props: {
jacqueswho marked this conversation as resolved.
Show resolved Hide resolved
"disabled": false,
"className": "btn btn-info",
},
"removed": false,
"submitText": "Submit"
},
}
}
```
Expand Down Expand Up @@ -218,5 +234,40 @@ const uiSchema = {
"ui:title": "Your password"
};
```

## submitButtonOptions

Sometimes it's convenient to change the behavior of the submit button for the form. This is the purpose of the `ui:submitButtonOptions` uiSchema directive:

You can pass any other prop to the submit button if you want, by default, this library will set the following options / props mentioned below for all submit buttons:

### `disabled` prop

You can use this option to disable the submit button

### `className` prop
jacqueswho marked this conversation as resolved.
Show resolved Hide resolved

You can use this option to specify a class name for the submit button
jacqueswho marked this conversation as resolved.
Show resolved Hide resolved

### `removed` option

jacqueswho marked this conversation as resolved.
Show resolved Hide resolved
You can use this option to remove the submit button completely from the form. Nice option, if the form is just for viewing purposes
epicfaace marked this conversation as resolved.
Show resolved Hide resolved
jacqueswho marked this conversation as resolved.
Show resolved Hide resolved

### `submitText` option

You can use this option to change the text of the submit button

```js
const uiSchema = {
"submitButtonOptions": {
jacqueswho marked this conversation as resolved.
Show resolved Hide resolved
props: {
"disabled": false,
"className": "btn btn-info",
},
"removed": false,
"submitText": "Submit"
}
};
```
## Theme Options
[Semantic UI](themes/semantic-ui/uiSchema.md)
141 changes: 1 addition & 140 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/antd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"peerDependencies": {
"@ant-design/icons": "^4.0.0",
"@rjsf/core": "^3.0.0",
"@rjsf/core": "^3.2.0",
jacqueswho marked this conversation as resolved.
Show resolved Hide resolved
"antd": "^4.0.0",
"antd-dayjs-webpack-plugin": "1.0.0",
"dayjs": "^1.8.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/antd/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import TextareaWidget from './widgets/TextareaWidget';
import TextWidget from './widgets/TextWidget';
import UpDownWidget from './widgets/UpDownWidget';
import URLWidget from './widgets/URLWidget';
import SubmitButton from './widgets/SubmitButton';

import ErrorList from './ErrorList';

Expand Down Expand Up @@ -53,6 +54,7 @@ export const Widgets = {
TextWidget,
UpDownWidget,
URLWidget,
SubmitButton,
};

export const Theme = {
Expand Down
12 changes: 12 additions & 0 deletions packages/antd/src/widgets/SubmitButton/SubmitButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { utils } from '@rjsf/core';
import React from "react";
import Button from 'antd/lib/button';
const { getSubmitButtonOptions } = utils;
export default ({ uiSchema }) => {
const { submitText, removed, props: submitButtonProps }= getSubmitButtonOptions(uiSchema);
if (removed) {return null;}
return (<Button type="submit" {...submitButtonProps}>
{submitText}
</Button>);
};

Loading