Skip to content

Commit cce82c1

Browse files
committed
Merge branch 'master' into HEAD
2 parents bc3bc1e + ae6bd1c commit cce82c1

File tree

76 files changed

+2407
-2353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2407
-2353
lines changed

.github/ISSUE_TEMPLATE/issue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Issue
3-
about: This is a general issue for Data Driven Forms library.
3+
about: Issues are intended for reporting bugs. If you have questions/ideas or if you need any help, please use Discussions first.
44
title: ''
55
labels: ''
66
assignees: ''

.github/pull_request_template.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Fixes #(issue) *(if applicable)*
2+
3+
**Description**
4+
5+
Please include a summary of the change.
6+
7+
**Schema** *(if applicable)*
8+
9+
```jsx
10+
```
11+
12+
**Checklist:** *(please see [documentation page](https://data-driven-forms.org/development-setup) for more information)*
13+
14+
- [ ] `Yarn build` passes
15+
- [ ] `Yarn lint` passes
16+
- [ ] `Yarn test` passes
17+
- [ ] Test coverage for new code *(if applicable)*
18+
- [ ] Documentation update *(if applicable)*
19+
- [ ] Correct commit message
20+
- format `fix|feat({scope}): {description}`
21+
- i.e. `fix(pf3): wizard correctly handles next button`
22+
- fix will release a new \_.\_.X version
23+
- feat will release a new \_.X.\_ version (use when you introduce new features)
24+
- we want to avoid any breaking changes, please contact us, if there is no way how to avoid them
25+
- scope: package
26+
- if you update the documentation or tests, do not use this format
27+
- i.e. `Fix button on documenation example page`

packages/ant-component-mapper/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@data-driven-forms/ant-component-mapper",
3-
"version": "2.17.0",
3+
"version": "2.19.1",
44
"description": "Component mapper for Ant Design component mapper form data-driven-forms.",
55
"main": "index.js",
66
"module": "esm/index.js",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const validationError = (meta, validateOnMount) => {
22
if (validateOnMount) {
3-
return meta.error;
3+
return meta.error || meta.submitError;
44
}
55

6-
return meta.touched && meta.error;
6+
return meta.touched && (meta.error || meta.submitError);
77
};

packages/ant-component-mapper/src/field-array/field-array.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const DynamicArray = ({ ...props }) => {
134134
...buttonLabels
135135
};
136136

137-
const { dirty, submitFailed, error } = meta;
137+
const { dirty, submitFailed, error, submitError } = meta;
138138
const isError = (dirty || submitFailed) && error && typeof error === 'string';
139139
return (
140140
<FormGroup
@@ -228,10 +228,10 @@ const DynamicArray = ({ ...props }) => {
228228
)}
229229
</Row>
230230
</Col>
231-
{isError && (
231+
{(isError || submitError) && (
232232
<Col span={12}>
233233
<Typography.Text type="danger" {...ErrorMessageProps}>
234-
{typeof error === 'object' ? error.name : error}
234+
{typeof error === 'object' ? error.name : error || submitError}
235235
</Typography.Text>
236236
</Col>
237237
)}

packages/ant-component-mapper/src/tests/components.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,21 @@ describe('formFields generated tests', () => {
288288
).toEqual(true);
289289
}
290290
});
291+
292+
it('renders with submitError', async () => {
293+
const wrapper = mount(<RendererWrapper schema={schema} onSubmit={() => ({ [field.name]: errorText })} />);
294+
await act(async () => {
295+
wrapper.find('form').simulate('submit');
296+
});
297+
wrapper.update();
298+
expect(
299+
wrapper
300+
.find('.ant-form-item-explain')
301+
.last()
302+
.text()
303+
).toEqual(errorText);
304+
expect(wrapper.find('.ant-form-item-has-error').length).toBeGreaterThanOrEqual(1);
305+
});
291306
});
292307
});
293308
});

packages/blueprint-component-mapper/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@data-driven-forms/blueprint-component-mapper",
3-
"version": "2.17.0",
3+
"version": "2.19.1",
44
"description": "Blueprint component mapper for data-driven-forms.",
55
"main": "index.js",
66
"module": "esm/index.js",

packages/blueprint-component-mapper/src/field-array/field-array.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ const FieldArray = (props) => {
6868

6969
const { required } = useContext(BlueprintContext);
7070

71-
const { error, touched } = meta;
72-
const showError = (validateOnMount || touched) && error;
71+
const { error, touched, submitError } = meta;
72+
const showError = (validateOnMount || touched) && (error || submitError);
7373

7474
const text = showError ? error : helperText || description;
7575

packages/blueprint-component-mapper/src/form-group/form-group.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export const FormGroupInternal = ({
2222
}) => {
2323
const { required } = useContext(BlueprintContext);
2424

25-
const { error, touched, warning } = meta;
26-
const showError = (validateOnMount || touched) && error;
25+
const { error, touched, warning, submitError } = meta;
26+
const showError = (validateOnMount || touched) && (error || submitError);
2727
const showWarning = (validateOnMount || touched) && warning;
2828

2929
const text = showError || showWarning || helperText || description;

packages/blueprint-component-mapper/src/tests/components.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ describe('formFields generated tests', () => {
263263
}
264264
}
265265
});
266+
267+
it('renders with error', () => {
268+
const wrapper = mount(<RendererWrapper schema={schema} onSubmit={() => ({ [field.name]: errorText })} />);
269+
wrapper.find('form').simulate('submit');
270+
expect(
271+
wrapper
272+
.find('.bp3-form-helper-text')
273+
.last()
274+
.text()
275+
).toEqual(errorText);
276+
expect(wrapper.find('.bp3-intent-danger').length).toBeGreaterThanOrEqual(1);
277+
});
266278
});
267279
});
268280
});

0 commit comments

Comments
 (0)