|
8 | 8 | import React, { Component } from "react";
|
9 | 9 | import PropTypes from "prop-types";
|
10 | 10 | import { getIn, FieldArray } from "formik";
|
11 |
| -import { Form, Icon } from "semantic-ui-react"; |
| 11 | +import { Form, Icon, Button } from "semantic-ui-react"; |
12 | 12 | import _isEmpty from "lodash/isEmpty";
|
13 | 13 | import _filter from "lodash/filter";
|
14 | 14 | import _matches from "lodash/matches";
|
@@ -87,30 +87,32 @@ export class ArrayField extends Component {
|
87 | 87 | const { nextKey } = this.state;
|
88 | 88 | const valuesToDisplay = this.getValues(values, fieldPath);
|
89 | 89 | return (
|
90 |
| - <Form.Field {...uiProps} {...hasError}> |
91 |
| - <FieldLabel htmlFor={fieldPath} icon={labelIcon} label={label} /> |
| 90 | + <> |
| 91 | + <Form.Field {...uiProps} {...hasError}> |
| 92 | + <FieldLabel htmlFor={fieldPath} icon={labelIcon} label={label} /> |
92 | 93 |
|
93 |
| - {valuesToDisplay.map((value, index, array) => { |
94 |
| - const arrayPath = fieldPath; |
95 |
| - const indexPath = index; |
96 |
| - const key = value.__key || index; |
| 94 | + {valuesToDisplay.map((value, index, array) => { |
| 95 | + const arrayPath = fieldPath; |
| 96 | + const indexPath = index; |
| 97 | + const key = value.__key || index; |
97 | 98 |
|
98 |
| - return ( |
99 |
| - <div key={key}> |
100 |
| - {children({ |
101 |
| - array, |
102 |
| - arrayHelpers, |
103 |
| - arrayPath, |
104 |
| - indexPath, |
105 |
| - key, |
106 |
| - value, |
107 |
| - ...props, |
108 |
| - })} |
109 |
| - </div> |
110 |
| - ); |
111 |
| - })} |
| 99 | + return ( |
| 100 | + <div key={key}> |
| 101 | + {children({ |
| 102 | + array, |
| 103 | + arrayHelpers, |
| 104 | + arrayPath, |
| 105 | + indexPath, |
| 106 | + key, |
| 107 | + value, |
| 108 | + ...props, |
| 109 | + })} |
| 110 | + </div> |
| 111 | + ); |
| 112 | + })} |
| 113 | + </Form.Field> |
112 | 114 |
|
113 |
| - {helpText && <label className="helptext">{helpText}</label>} |
| 115 | + {helpText && <label className="helptext rel-mb-1">{helpText}</label>} |
114 | 116 |
|
115 | 117 | <Form.Group>
|
116 | 118 | <Form.Button
|
|
0 commit comments