Skip to content

Commit 4a7451c

Browse files
authored
Merge pull request #141 from rvsia/fix-links
Fix links
2 parents 2c74e02 + c6d0e00 commit 4a7451c

File tree

4 files changed

+36
-31
lines changed

4 files changed

+36
-31
lines changed

packages/react-renderer-demo/src/docs-components/condition.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
import { NavLink } from 'react-router-dom';
2+
3+
### Conditional fields
4+
15
You can show a field only if it meets a condition:
26

3-
## Schema
7+
### Schema
48

59
```jsx
610
{
@@ -23,9 +27,9 @@ You can show a field only if it meets a condition:
2327

2428
`when` - is name of field where the value is stored, **always required!**
2529

26-
## Conditions
30+
### Conditions
2731

28-
### Is
32+
#### Is
2933

3034
`is` - test if the value is equal
3135

@@ -38,7 +42,7 @@ condition: {
3842
// Foo == 'Bar' => true
3943
// Foo == 'Not a Bar' => false
4044
```
41-
### Is empty
45+
#### Is empty
4246

4347
`isEmpty` - tests if the value is empty (using [lodash function](https://lodash.com/docs/4.17.11#isEmpty))
4448

@@ -58,7 +62,7 @@ condition: {
5862
// Foo = false => true
5963
// Foo = true => false
6064
```
61-
### Is not empty
65+
#### Is not empty
6266

6367
`isNotEmpty` - tests if the value is not empty (using [lodash function](https://lodash.com/docs/4.17.11#isEmpty))
6468

@@ -78,7 +82,7 @@ condition: {
7882
// Foo = true => false
7983
// Foo = true => true
8084
```
81-
### Pattern
85+
#### Pattern
8286

8387
`pattern` - tests if the value matches the pattern
8488

@@ -92,7 +96,7 @@ condition: {
9296
// Foo = 'Foo foo baar!' => true
9397
```
9498

95-
### Not match
99+
#### Not match
96100

97101
`notMatch` - reverse `is`/`pattern` condition
98102

@@ -117,6 +121,6 @@ condition: {
117121
// Foo = 'bar' => false
118122
```
119123

120-
## Clearing values
124+
### Clearing values
121125

122-
If you need to clear values after switching fields, please see [here](/renderer/unmounting).
126+
If you need to clear values after switching fields, please see <NavLink to="/renderer/unmounting">here</NavLink>.

packages/react-renderer-demo/src/docs-components/field-provider.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1+
import { NavLink } from 'react-router-dom';
2+
3+
### Field Provider
4+
15
React form renderer is using [react-final-form](https://github.com/final-form/react-final-form) for form state management.
26
Most of its features are not directly available for consistency and performance reasons. If you want to create any custom
3-
components, you can access these features via **FieldProvider** prop.
4-
7+
components, you can access these features via `FieldProvider` prop.
58

69
FieldProvider is a wrapper component around standard
7-
[react-final-form Field component](https://github.com/final-form/react-final-form#field--reactcomponenttypefieldprops)
10+
[react-final-form Field component](https://final-form.org/docs/react-final-form/api/Field)
811
which adds additional methods that will help you to control your form state.
912

10-
## Accessing FieldProvider
13+
### Accessing FieldProvider
1114

1215
To use Fieldprovider, you first need to register a component to your component mapper.
13-
You can read more about that in [Component mapping](/renderer/component-mapping).
16+
You can read more about that in <NavLink to="/renderer/component-mapping">Component mapping</NavLink>.
1417

1518
Each component will receive FieldProvider as a prop. Be aware that pre-defined component types are
1619
automatically wrapped in FieldProvider. This is done to make it easier to create component mappers for
17-
standard form components. List of standard components is available [here](/renderer/component-api).
20+
standard form components. List of standard components is available <NavLink to="/renderer/component-api">here</NavLink>.
1821

19-
## Using FieldProvider
22+
### Using FieldProvider
2023

21-
### Register component
24+
#### Register component
2225

2326
```jsx
2427
import NewComponent from './new-component'
@@ -28,7 +31,7 @@ const formFieldsMapper = {
2831
}
2932
```
3033

31-
### Implementation of component
34+
#### Implementation of component
3235

3336
Next example shows simple input field with label and error message.
3437

@@ -54,9 +57,9 @@ const NewComponent = ({ FieldProvider, formOptions, name ...rest }) => (
5457
export default NewComponent
5558
```
5659

57-
## What are input and meta?
60+
### What are input and meta?
5861

59-
### Input
62+
#### Input
6063

6164
Input is an object which contains field values and methods that change form state. See the selection of most important attributes:
6265

@@ -72,10 +75,10 @@ Input is an object which contains field values and methods that change form stat
7275

7376
Every user interaction that updates field value in form state should also call `input.onChange` with correct value.
7477

75-
### Meta
78+
#### Meta
7679

7780
Meta is a object which contains meta information about field with given name. There is a lot of information about every field.
78-
[Full list is here](https://github.com/final-form/react-final-form#metaactive-boolean). These are commonly used meta informations
81+
[Full list is here](https://final-form.org/docs/react-final-form/types/FieldRenderProps#metaactive). These are commonly used meta informations
7982
```jsx
8083
{
8184
error: any, // whatever your validation function returns
@@ -86,7 +89,7 @@ Meta is a object which contains meta information about field with given name. Th
8689
}
8790
```
8891

89-
## FormOptions
92+
### FormOptions
9093

9194
In addition to FieldProvider, every component will also receive prop `formOptions`.
9295
This property contains a number of useful methods and attributes that will give you additional level of control
@@ -99,7 +102,7 @@ and informations about the formState.
99102
focus: (name) => void, // calls onFocus event on field with given name
100103
getFieldState: (name) => object, // returns a state of given field, state contains input and meta information of field
101104
getRegisteredFields: () => string[], // returns an array of field names that are rendered in DOM
102-
getState: () => object, // returns an object with whole form state. More info https://github.com/final-form/final-form#formstate
105+
getState: () => object, // returns an object with whole form state. More info https://final-form.org/docs/final-form/types/FormState
103106
pristine: bool, // true if the all field values is === to the initial values, false if the values are !==.
104107
renderForm: (defaultSchema) => void, // function that is used by form renderer to render form fields defined by defaultSchema; can be used for schema nesting
105108
valid: bool //true if all fields have no validation or submission errors. false otherwise.

packages/react-renderer-demo/src/docs-components/form-controls.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ If you need completely customized buttons, you can pass a component to form rend
88

99
#### Form Buttons render props
1010

11-
Your component will receive same props as provided by react-final-form FormSpy component. For most use cases you will need just a few of these which are listed below. If you require full list please visit [react-final-form documentation](https://github.com/final-form/final-form#formstate).
11+
Your component will receive same props as provided by react-final-form FormSpy component. For most use cases you will need just a few of these which are listed below. If you require full list please visit [react-final-form documentation](https://final-form.org/docs/final-form/types/FormState).
1212

1313
|Prop|Type|Description|
1414
|----|----|-----------|
@@ -19,4 +19,4 @@ Your component will receive same props as provided by react-final-form FormSpy c
1919
|valid|bool|`true` if neither the form nor any of its fields has a validation or submission error.|
2020
|validating|bool|`true` true if the form is currently being validated asynchronously.|
2121
|values|object|The current values of the form.|
22-
|form|object|reat final form [FormApi](https://github.com/final-form/final-form#formapi).|
22+
|form|object|react final form [FormApi](https://final-form.org/docs/final-form/types/FormApi).|

packages/react-renderer-demo/src/docs-components/validators.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import RawComponent from '../common/component/raw-component';
22

3-
4-
53
## Validate field
64

75
You need to provide a `validate` array in the schema to add validation to your form fields.
@@ -40,7 +38,7 @@ The function takes `value` as an argument and should return undefined when pases
4038

4139
### Async validator
4240

43-
You can use a Async function as a validator. However, the returned promise will overwrite all other validators
41+
You can use a Async function as a validator. However, the returned promise will overwrite all other validators
4442
(because it is returned last),
4543
so you need combine all validators into one function.
4644

@@ -72,8 +70,8 @@ By providing `validateOnMount` the validation will be triggered immediately afte
7270

7371
## Record Level validation
7472

75-
This form of validation enables you to create validation function for whole form. It is usefull for some cross validation between multiple fields etc.
76-
Detailed information can be found [here](https://github.com/final-form/react-final-form#validate-values-object--object--promiseobject).
73+
This form of validation enables you to create validation function for whole form. It is useful for some cross validation between multiple fields etc.
74+
Detailed information can be found [here](https://final-form.org/docs/react-final-form/examples/record-level-validation).
7775

7876
<RawComponent source="validators/record-level-validation" />
7977

0 commit comments

Comments
 (0)