-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FormRenderer): Add Reset Button support to non-Wizard Form (#307)
* feat(FormRenderer): Add Reset button support to the non-Wizard Form * chore: Remove the unused props
- Loading branch information
1 parent
7df0bf7
commit 25da626
Showing
5 changed files
with
127 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,6 +347,51 @@ export const WithInitialValues = () => { | |
); | ||
}; | ||
|
||
export const ResetButton = () => { | ||
const initialValues = { | ||
email: '[email protected]', | ||
password: 'password', | ||
number: 10, | ||
textarea: 'textarea', | ||
checkbox: ['1', '2'], | ||
switch: true, | ||
radio: '3', | ||
select: '2', | ||
autosugguest: { | ||
value: 'Lambda', | ||
label: 'Lambda - Amazon Lambda', | ||
}, | ||
multiselect: [ | ||
{ | ||
value: 'Lambda', | ||
label: 'Lambda - Amazon Lambda', | ||
}, | ||
{ | ||
value: 'EC2', | ||
label: 'EC2 - Amazon Elastic Compute Cloud', | ||
}, | ||
], | ||
confirm: true, | ||
datePicker: new Date(2020, 1, 1), | ||
timePicker: '2020-01-01T00:00:00Z', | ||
tree: ['3', '5'], | ||
}; | ||
|
||
const resetableSchema = { | ||
...baseSchema, | ||
canReset: true, | ||
}; | ||
|
||
return ( | ||
<FormRenderer | ||
schema={resetableSchema} | ||
onSubmit={action('Submit')} | ||
onCancel={action('Cancel')} | ||
initialValues={initialValues} | ||
/> | ||
); | ||
}; | ||
|
||
export const SubForms = () => { | ||
const schema = { | ||
fields: [ | ||
|
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