Skip to content

Commit 012af2e

Browse files
authored
Merge pull request #1034 from rvsia/splitRendererPropsToPage
Change Renderer props from table to list
2 parents 8546d6a + dd1b9b5 commit 012af2e

File tree

8 files changed

+156
-30
lines changed

8 files changed

+156
-30
lines changed

packages/react-renderer-demo/src/pages/components/form-template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ With using `useFormApi` hook you can get access to all form information and func
3232

3333
## Customize form buttons
3434

35-
You can customize form buttons in your [FormTemplate](/components/renderer#requiredprops) component
35+
You can customize form buttons in your [FormTemplate](/components/renderer#formtemplate) component
3636

3737
<CodeExample source="components/form-template/custom-buttons" mode="preview" />
3838

packages/react-renderer-demo/src/pages/components/renderer.md

Lines changed: 149 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,45 @@ const App = () => (<FormRenderer
1919

2020
## Required props
2121

22-
|Prop|Type|Description|
23-
|----|:--:|----------:|
24-
|[componentMapper](/mappers/custom-mapper)|object|Defines types of form field components. Field components can change the state of the form.|
25-
|[FormTemplate](/components/form-template)|Component|Components which defines a template of the form. This component receives two props from the renderer: `formFields` and `schema`. `formFields` is the content of the form. You should wrap this content into your `<form>` component and add form buttons.|
26-
|onSubmit|func|A submit callback which receives two arguments: `values` and `formApi`.|
27-
|schema|object|A schema which defines structure of the form.|
22+
### componentMapper
2823

29-
## Optional props
24+
*object*
25+
26+
Defines types of form field components. Field components can change the state of the form.
27+
28+
You can use [globally defined attributes](/mappers/global-component-props).
29+
30+
[Read more](/mappers/custom-mapper).
31+
32+
---
33+
34+
### FormTemplate
35+
36+
*Component*
37+
38+
Components which defines a template of the form. This component receives two props from the renderer: `formFields` and `schema`. `formFields` is the content of the form. You should wrap this content into your `<form>` component and add form buttons.
39+
40+
[Read more](/components/form-template).
41+
42+
---
3043

31-
|Prop|Type|Description|Default|
32-
|----|:--:|----------:|------:|
33-
|[actionMapper](/mappers/action-mapper)|object|Action mapper allows to map props to functions.||
34-
|[clearOnUnmount](/schema/clear-on-unmount)|bool|Will clear values of unmounted components. You can also set this to specific component in the form schema.|false|
35-
|[clearedValue](/schema/cleared-value)|any|Value that will be set to field with **initialValue** after deleting it. Useful for forms while editing.|undefined|
36-
|onReset|func|A reset callback. You don't need to manually clear the form values!||
37-
|onCancel|func|A cancel callback, which receives `values` as the first argument.||
38-
|debug|func|A function which will be called with every form update, i.e. `({ values }) => setValues(values)`, please take a look [here](https://final-form.org/docs/react-final-form/types/FormProps#debug)||
39-
|initialValues|object|An object of fields names as keys and values as their values.||
40-
|[schemaValidatorMapper](/mappers/schema-validator-mapper)|object|Schema validators mapper. You can control schemas of your components, validators and actions.||
41-
|subscription|object|You can pass your own [subscription](https://final-form.org/docs/react-final-form/types/FormProps#subscription), which will be added to default settings.|`{ pristine: true, submitting: true, valid: true }`|
42-
|[validate](/schema/introduction#validate)|func|A function which receives all form values and returns an object with errors.||
43-
|[validatorMapper](/mappers/validator-mapper)|object|A mapper containing custom validators, it's automatically merged with the default one.||
44+
### onSubmit
4445

45-
## Schema
46+
*(values, [formApi](/hooks/use-form-api)) => void*
4647

47-
The root object of the schema represents the Form component. Please read more [here](/schema/introduction).
48+
A submit callback which receives two arguments: `values` and `formApi`.
4849

49-
### Example
50+
[Read more]([/mappers/custom-mapper](https://final-form.org/docs/react-final-form/types/FormProps#onsubmit)).
51+
52+
---
53+
54+
### schema
55+
56+
*object*
57+
58+
A schema which defines structure of the form. Consists of [fields](/schema/introduction).
59+
60+
**Example**
5061

5162
```javascript
5263
schema = {
@@ -60,4 +71,119 @@ schema = {
6071
};
6172
```
6273

74+
---
75+
76+
## Optional props
77+
78+
### actionMapper
79+
80+
*object*
81+
82+
Action mapper allows to map functions as props.
83+
84+
[Read more](/mappers/action-mapper).
85+
86+
---
87+
88+
### clearOnUnmount
89+
90+
*boolean*
91+
92+
Will clear values of unmounted components. You can also set this to specific component in the form schema.
93+
94+
[Read more](/schema/clear-on-unmount).
95+
96+
---
97+
98+
### clearedValue
99+
100+
*any*
101+
102+
Value that will be set to field with **initialValue** after deleting it. Useful for forms while editing.
103+
104+
[Read more](/schema/cleared-value).
105+
106+
---
107+
108+
### onReset
109+
110+
*func*
111+
112+
A reset callback that refresh the form state to the initial state.
113+
114+
---
115+
116+
### onCancel
117+
118+
*(values) => void*
119+
120+
A cancel callback, which receives `values` as the first argument.
121+
122+
---
123+
124+
### debug
125+
126+
*(formState) => void*
127+
128+
A function which will be called with every form update, i.e. `({ values }) => setValues(values)`.
129+
130+
[Read more](https://final-form.org/docs/react-final-form/types/FormProps#debug)
131+
132+
---
133+
134+
### initialValues
135+
136+
*object*
137+
138+
An object of fields names as keys and values as their values.
139+
140+
**Example**
141+
142+
```jsx
143+
initialValues={{ name: 'initial-name', nested: { value: 'neste-value' }}}
144+
```
145+
146+
---
147+
148+
### schemaValidatorMapper
149+
150+
*object*
151+
152+
Schema validators mapper. You can control schemas of your components, validators and actions.
153+
154+
[Read more](/mappers/schema-validator-mapper).
155+
156+
---
157+
158+
### subscription
159+
160+
*object*
161+
162+
You can pass your own [subscription](https://final-form.org/docs/react-final-form/types/FormProps#subscription), which will be added to default settings.
163+
164+
**Default subscription**
165+
166+
`{ pristine: true, submitting: true, valid: true }`
167+
168+
---
169+
170+
### validate
171+
172+
*(values) => void | Errors*
173+
174+
A function which receives all form values and returns an object with errors.
175+
176+
[Read more]([/components/form-template](https://final-form.org/docs/react-final-form/types/FormProps#validate)).
177+
178+
---
179+
180+
### validatorMapper
181+
182+
*object*
183+
184+
A mapper containing custom validators, it's automatically merged with the default one.
185+
186+
[Read more](/mappers/validator-mapper).
187+
188+
63189
</DocPage>

packages/react-renderer-demo/src/pages/examples/resolve-props-example.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ To achieve that you need to rerender the changing field on each form change. Tha
1111

1212
## Subscription example
1313

14-
Using [subscription](/components/renderer#optionalprops) is a simple way how to let form to be rerendered each time values changed. However, this solution can bring a performance hit when used in large forms with tens of fields.
14+
Using [subscription](/components/renderer##subscription) is a simple way how to let form to be rerendered each time values changed. However, this solution can bring a performance hit when used in large forms with tens of fields.
1515

1616
<CodeExample source="components/examples/resolve-props-subscription" mode="preview" />
1717

packages/react-renderer-demo/src/pages/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import CodeExample from '@docs/code-example';
1717

1818
**A.** Right now, there are two standard ways how to update the second component:
1919

20-
1) Set [subscription](/components/renderer#optionalprops)
20+
1) Set [subscription](/components/renderer#subscription)
2121

2222
```jsx
2323
<FormRenderer

packages/react-renderer-demo/src/pages/mappers/action-mapper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import DocPage from '@docs/doc-page';
55

66
# Action Mapper
77

8-
The [ActionMapper](/components/renderer#optionalprops) allows you to map schema props to functions. This is useful when your schema is not written in JavaScript and you cannot use function inside of it, especially for schemas stored in databases.
8+
The [ActionMapper](/components/renderer#actionmapper) allows you to map schema props to functions. This is useful when your schema is not written in JavaScript and you cannot use function inside of it, especially for schemas stored in databases.
99

1010
## Mapper
1111

packages/react-renderer-demo/src/pages/mappers/schema-validator-mapper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import CodeExample from '@docs/code-example';
55

66
# Schema validation
77

8-
Data Driven Forms contains default schema validator, that controls basic schema attributes: `name`, `component`, conditions, validators, etc. If you want to control your own validators, components or actions, use [schemaValidatorMapper](/components/renderer#optionalprops) prop.
8+
Data Driven Forms contains default schema validator, that controls basic schema attributes: `name`, `component`, conditions, validators, etc. If you want to control your own validators, components or actions, use [schemaValidatorMapper](/components/renderer#schemavalidatormapper) prop.
99

1010
It's a simple object containing three keys: `components`, `actions`, `validators`. Each of these is an another object with names as keys and functions as returns. Components' validators receive the whole field object, actions'/validators' validators receive two arguments: action/validator as the first one and the name of the field as the second one.
1111

packages/react-renderer-demo/src/pages/mappers/validator-mapper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import CodeExample from '@docs/code-example';
55

66
# Validator mapper
77

8-
If you need to expand default Data Driven Forms validator types, you can use [validatorMapper](/components/renderer#optionalprops).
8+
If you need to expand default Data Driven Forms validator types, you can use [validatorMapper](/components/renderer#validatormapper).
99

1010
```jsx
1111
const customValidatorMapper = {

packages/react-renderer-demo/src/pages/schema/resolve-props.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const componentMapper = {
6262

6363
## Change props according to state of other components
6464

65-
You can get states of all other fields in the form via functions from `formOptions`. Don't forget to set the right [subscription](/components/renderer#optionalprops) to trigger `resolveProps` functions from changing other fields.
65+
You can get states of all other fields in the form via functions from `formOptions`. Don't forget to set the right [subscription](/components/renderer#subscription) to trigger `resolveProps` functions from changing other fields.
6666

6767
## Example
6868

0 commit comments

Comments
 (0)