Skip to content

Commit e162df7

Browse files
committed
Added documentation for Ant Field Array in the mappers section
1 parent 67a702d commit e162df7

File tree

4 files changed

+76
-6
lines changed

4 files changed

+76
-6
lines changed

packages/react-renderer-demo/src/components/landing-page/landing-page-cards.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ const LandingPageCards = () => {
275275
</a>
276276
</RouterLink>
277277
</Grid>
278-
<Grid item xs={12} md={6} xl={2}>
278+
<Grid item xs={12} md={4} xl={2}>
279279
<Typography variant="h6" className={classes.textBottom}>
280280
BlueprintJS
281281
</Typography>
@@ -285,7 +285,7 @@ const LandingPageCards = () => {
285285
</a>
286286
</RouterLink>
287287
</Grid>
288-
<Grid item xs={12} md={6} xl={2}>
288+
<Grid item xs={12} md={4} xl={2}>
289289
<Typography variant="h6" className={classes.textBottom}>
290290
Semantic UI
291291
</Typography>
Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,70 @@
1-
todo
1+
**Props**
2+
3+
|Prop|Type|Description|
4+
|:---|:--:|----------:|
5+
|label|`node`|Label of the array.|
6+
|description|`node`|Description of the array.|
7+
|fields|`array`|A group of fields, which are being added to the array.|
8+
|defaultItem|`any`|Default item which is inserted into a newly created fields group. If you have nested names, don't forget you need to insert an object!|
9+
|minItems|`number`|Remove button is disabled, if the length of the array is equal or smaller.|
10+
|maxItems|`number`|Add button is disabled, if the length of the array is equal or bigger.|
11+
|noItemsMessage|`node`|A message which is shown, when there are no items in the array.|
12+
|buttonLabels|`object`|`{add: 'ADD', remove: 'REMOVE'}` sets labels of buttons.|
13+
14+
**Revert removal**
15+
16+
Ant field array allow users to revert latest removal actions.
17+
18+
**Naming**
19+
20+
Fields can contain names, then the value will be handled as array of objects.
21+
22+
```jsx
23+
const fields = [
24+
{ name: 'name', ... },
25+
{ name: 'lastname', ... }
26+
]
27+
28+
[
29+
{ name: value1.name, lastname: value1.lastname },
30+
{ name: value2.name, lastname: value2.lastname },
31+
...
32+
]
33+
```
34+
35+
Or you can put a single field with no name. In this case, values are stored as a simple array.
36+
37+
```jsx
38+
const fields = [
39+
{ component: 'text-field' }
40+
]
41+
42+
[ value1, value2, ... ]
43+
```
44+
45+
**Custom component**
46+
47+
To implement a custom component, please take a look [here](/components/field-array).
48+
49+
### Sub components props
50+
51+
|name|type|default|target component|
52+
|----|----|-------|----------------|
53+
|FormItemProps|object|`{}`|[Form](https://ant.design/components/form/#Form)|
54+
|ArrayItemProps|object|`{}`|[Row](https://ant.design/components/grid/#Row)|
55+
|FieldsContainerProps|object|`{}`|[Col](https://ant.design/components/grid/#Col)|
56+
|RemoveContainerProps|object|`{}`|[Col](https://ant.design/components/grid/#Col)|
57+
|RemoveButtonProps|object|`{}`|[Button](https://ant.design/components/button/)|
58+
|FieldArrayRowProps|object|`{}`|[Row](https://ant.design/components/grid/#Row)|
59+
|FieldArrayRowCol|object|`{}`|[Col](https://ant.design/components/grid/#Col)|
60+
|FieldArrayHeaderProps|object|`{}`|[Row](https://ant.design/components/grid/#Row)|
61+
|FieldArrayLabelProps|object|`{}`|[Title](https://ant.design/components/typography/#Typography.Title)|
62+
|FieldArrayButtonProps|object|`{}`|[Space](https://ant.design/components/space/)
63+
|UndoButtonProps|object|`{}`|[Button](https://ant.design/components/button/)|
64+
|RedoButtonProps|object|`{}`|[Button](https://ant.design/components/button/)|
65+
|AddButtonProps|object|`{}`|[Button](https://ant.design/components/button/)|
66+
|FieldArrayDescriptionProps|object|`{}`|[Text](https://ant.design/components/typography/#Typography.Text)|
67+
|NoItemsMessageProps|object|`{}`|[Text](https://ant.design/components/typography/#Typography.Text)|
68+
|ErrorMessageProps|object|`{}`|[Text](https://ant.design/components/typography/#Typography.Text)|
69+
70+

packages/react-renderer-demo/src/doc-components/wizard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import MuiWizard from './examples-texts/mui/mui-wizard.md';
44
import Pf4Wizard from './examples-texts/pf4/pf4-wizard.md';
55
import Pf3Wizard from './examples-texts/pf3/pf3-wizard.md';
66
import SuirWizard from './examples-texts/suir/suir-wizard.md';
7-
import AntWizard from './examples-texts/ant/ant-wizard.md'
7+
import AntWizard from './examples-texts/ant/ant-wizard.md';
88
import BlueprintWizard from './examples-texts/blueprint/blueprint-wizard.md';
99
import GenericMuiComponent from '../helpers/generic-mui-component';
1010

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ This field will show the error immediately.
4040

4141
Ant Design provides horizontal and vertical layouts for form. Layout can be specified by passing a `layout` prop to `formTemplate`. By default it is set to `vertical`.
4242

43-
<!-- ```jsx -->
44-
43+
```
44+
<FormTemplate layout='horizontal' />}
45+
```
4546
</DocPage>

0 commit comments

Comments
 (0)