Skip to content

Commit abb2121

Browse files
authored
Merge pull request #894 from rvsia/updateManagerBranch
Update manager branch from master
2 parents 0cfd133 + 03df72b commit abb2121

File tree

410 files changed

+15280
-4581
lines changed

Some content is hidden

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

410 files changed

+15280
-4581
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@ packages/react-renderer-demo/public/vendor.css
7373

7474
# Rollup build info
7575
packages/**/size-snapshot.json
76+
77+
# Node version manager configuration
78+
.nvmrc

README.md

Lines changed: 53 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
[![codecov](https://codecov.io/gh/data-driven-forms/react-forms/branch/master/graph/badge.svg)](https://codecov.io/gh/data-driven-forms/react-forms)
22
[![CircleCI](https://circleci.com/gh/data-driven-forms/react-forms/tree/master.svg?style=svg)](https://circleci.com/gh/data-driven-forms/react-forms/tree/master)
33
[![npm version](https://badge.fury.io/js/%40data-driven-forms%2Freact-form-renderer.svg)](https://badge.fury.io/js/%40data-driven-forms%2Freact-form-renderer)
4+
[![Tweet](https://img.shields.io/twitter/url/https/github.com/tterb/hyde.svg?style=social)](https://twitter.com/intent/tweet?text=Check%20DataDrivenForms%20React%20library%21%20https%3A%2F%2Fdata-driven-forms.org%2F&hashtags=react,opensource,datadrivenforms)
5+
[![Twitter Follow](https://img.shields.io/twitter/follow/DataDrivenForms.svg?style=social)](https://twitter.com/DataDrivenForms)
46

57
[![Data Driven Form logo](https://raw.githubusercontent.com/data-driven-forms/react-forms/master/images/logo.png)](https://data-driven-forms.org/)
68

79
Data Driven Forms is a React library used for rendering and managing forms with a lot of provided features based on [React Final Form](https://github.com/final-form/react-final-form).
810

911

1012
:question: Why to use Data Driven Forms? :question:
11-
- All forms shared the same functionality!
12-
- Components are controlled in one place!
13-
- You can easily migrate to different sets of components!
14-
- All functionality is provided (see below!)
13+
- All forms **shared** the same **functionality**!
14+
- Components are **controlled** in **one place**!
15+
- You can **easily migrate** to different sets of components!
16+
- All **functionality** is **provided** (see below!)
1517

1618
:tada: Features :tada:
17-
- Easily readable schema, you don't need to know any HTML or JS to be able to write your own form schemas!
18-
- You can use your own components or use one of our provided mappers ([PatternFly 3](https://patternfly-react.surge.sh/patternfly-3/index.html), [PatternFly 4](https://patternfly-react.surge.sh/patternfly-4/), [Material-UI](https://material-ui.com/) or [Ant Design](https://ant.design/)!)
19-
- Form state managing out-of-the-box (including error states!)
20-
- Fully customizable (you can use your own buttons, actions, etc.)!
21-
- Conditional fields!
22-
- Custom field validation with basic set included!
23-
- Datatype validation!
24-
- Cross-field validation!
25-
- Asynchronous validation supported!
26-
- Supporting Wizard forms!
27-
- Supporting [Final Form Field Array](https://github.com/final-form/react-final-form-arrays)!
19+
- **Easily readable schema**, you don't need to know any HTML or JS to be able to write your own form schemas!
20+
- You can use your **own components** or use one of our **provided mappers** ([PatternFly 3](https://patternfly-react.surge.sh/patternfly-3/index.html), [PatternFly 4](https://patternfly-react.surge.sh/patternfly-4/), [Material-UI](https://material-ui.com/), [Ant Design](https://ant.design/)! and more, see below!)
21+
- **Form state manager** out-of-the-box (including error states!)
22+
- Fully **customizable** (you can use your own buttons, actions, etc.)!
23+
- **Conditional** fields!
24+
- Custom field **validation** with basic set included!
25+
- **Datatype** validation!
26+
- **Cross-field** validation!
27+
- **Asynchronous** validation supported!
28+
- Supporting **Wizard** forms!
29+
- Supporting **[Final Form Field Array](https://github.com/final-form/react-final-form-arrays)!**
2830
- ... and a lot more!
2931

3032
:book: For more information please visit the [documentation](https://data-driven-forms.org/). :book:
@@ -38,8 +40,8 @@ Data Driven Forms is a React library used for rendering and managing forms with
3840
- [PatternFly 4 Mapper](#patternfly-4-mapper)
3941
- [BlueprintJS Mapper](#blueprintjs-mapper)
4042
- [Semantic UI Mapper](#semantic-ui-mapper)
41-
- [Material-UI Mapper](#material-ui-mapper)
4243
- [Ant Design Mapper](#ant-design-mapper)
44+
- [Carbon Mapper](#carbon-mapper)
4345
- [Usage](#usage)
4446
- [Custom mapper](#custom-mapper)
4547
- [Basic provided components](#basic-provided-components)
@@ -119,9 +121,7 @@ $ npm install @data-driven-forms/suir-component-mapper -S
119121
$ yarn add @data-driven-forms/suir-component-mapper
120122
```
121123

122-
Component libraries in mappers are external dependencies. Make sure to install them in your bundles.
123-
124-
#### [Ant Design Mapper](https://www.npmjs.com/package/@data-driven-forms/ant-component-mapper)
124+
#### [Ant Design Mapper](https://data-driven-forms.org/mappers/ant-component-mapper)
125125

126126
```console
127127
$ npm install @data-driven-forms/ant-component-mapper -S
@@ -131,6 +131,18 @@ $ npm install @data-driven-forms/ant-component-mapper -S
131131
$ yarn add @data-driven-forms/ant-component-mapper
132132
```
133133

134+
#### [Carbon Mapper](https://data-driven-forms.org/mappers/carbon-component-mapper)
135+
136+
```console
137+
$ npm install @data-driven-forms/carbon-component-mapper -S
138+
```
139+
140+
```console
141+
$ yarn add @data-driven-forms/carbon-component-mapper
142+
```
143+
144+
Component libraries in mappers are external dependencies. Make sure to install them and their styles in your bundles.
145+
134146
### Usage
135147

136148
In order to Data Driven Forms in your component you need the renderer and a component mapper, which provides component mapper and form template.
@@ -200,20 +212,21 @@ Mappers can be also generated by using `yarn generate-template` [command](https:
200212

201213
Data Driven Forms supports all kinds of component, basic set is consisted of:
202214

203-
- Text input
204-
- Text area
205-
- Checkbox (Multiple checkboxes)
206-
- Select (dropdown)
207-
- Dual list select
208-
- Field array
209-
- Switch
210-
- Radio buttons
211-
- Date picker
212-
- Time picker
213-
- Tabs
214-
- Slider
215-
- Sub-form
216-
- Wizard
215+
- [Text input](https://data-driven-forms.org/mappers/text-field?mapper=mui)
216+
- [Text area](https://data-driven-forms.org/mappers/textarea?mapper=mui)
217+
- [Checkbox](https://data-driven-forms.org/mappers/checkbox?mapper=mui) ([Multiple checkboxes](https://data-driven-forms.org/mappers/checkbox-multiple?mapper=mui))
218+
- [Select (dropdown)](https://data-driven-forms.org/mappers/select?mapper=mui)
219+
- [Dual list select](https://data-driven-forms.org/mappers/dual-list-select?mapper=mui)
220+
- [Field array](https://data-driven-forms.org/mappers/field-array?mapper=mui)
221+
- [Switch](https://data-driven-forms.org/mappers/switch?mapper=mui)
222+
- [Radio buttons](https://data-driven-forms.org/mappers/radio?mapper=mui)
223+
- [Date picker](https://data-driven-forms.org/mappers/date-picker?mapper=mui)
224+
- [Time picker](https://data-driven-forms.org/mappers/time-picker?mapper=mui)
225+
- [Tabs](https://data-driven-forms.org/mappers/tabs?mapper=mui)
226+
- [Slider](https://data-driven-forms.org/mappers/slider?mapper=mui)
227+
- [Sub-form](https://data-driven-forms.org/mappers/sub-form?mapper=mui)
228+
- [Plain text](https://data-driven-forms.org/mappers/plain-text?mapper=mui)
229+
- [Wizard](https://data-driven-forms.org/mappers/wizard?mapper=mui)
217230

218231
Any other components can be added to mapper and renderer with the form renderer. Existing components can be also overriden.
219232

@@ -228,18 +241,22 @@ Please use our [documentation site](https://data-driven-forms.org/). In case of
228241
- [PatternFly 4 Design documentation](https://www.patternfly.org/v4/)
229242
- [Material-UI documentation](https://material-ui.com/)
230243
- [Ant Design documentation](https://ant.design/)
244+
- [Semantic UI React](https://react.semantic-ui.com/)
245+
- [BlueprintJS](https://blueprintjs.com/)
246+
- [IBM Carbon](https://www.carbondesignsystem.com/)
231247
- NPM
232248
- [React Form Renderer](https://www.npmjs.com/package/@data-driven-forms/react-form-renderer)
233249
- [PatternFly 3 Mapper](https://www.npmjs.com/package/@data-driven-forms/pf3-component-mapper)
234250
- [PatternFly 4 Mapper](https://www.npmjs.com/package/@data-driven-forms/pf4-component-mapper)
235251
- [MaterialUI Mapper](https://www.npmjs.com/package/@data-driven-forms/mui-component-mapper)
236252
- [Ant Design Mapper](https://www.npmjs.com/package/@data-driven-forms/ant-component-mapper)
237-
- Examples of schemas (PatternFly 3)
238-
- [ManageIQ Form Components](https://github.com/ManageIQ/manageiq-ui-classic/tree/master/app/javascript/components)
253+
- [Semantic UI Mapper](https://www.npmjs.com/package/@data-driven-forms/suir-component-mapper)
254+
- [BlueprintJS Mapper](https://www.npmjs.com/package/@data-driven-forms/blueprint-component-mapper)
255+
- [Carbon Mapper](https://www.npmjs.com/package/@data-driven-forms/carbon-component-mapper)
239256

240257
### Development setup
241258

242-
Data Driven Forms is a monorepo which uses [Lerna](https://github.com/lerna/lerna), so you can use all its commands as well.
259+
Data Driven Forms is a monorepo that uses [Lerna](https://github.com/lerna/lerna) and [yarn workspaces](https://classic.yarnpkg.com/blog/2017/08/02/introducing-workspaces/), so you can use all its commands as well.
243260

244261
1. Install
245262

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"ncp": "^2.0.0",
8181
"prettier": "^1.19.1",
8282
"replace-in-file": "^6.0.0",
83-
"semantic-release": "^16.0.4",
83+
"semantic-release": "^17.2.3",
8484
"source-map-loader": "^0.2.4",
8585
"strip-ansi": "^6.0.0",
8686
"terser-webpack-plugin": "^1.3.0",

packages/ant-component-mapper/README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[![npm version](https://badge.fury.io/js/%40data-driven-forms%2Fant-component-mapper.svg)](https://badge.fury.io/js/%40data-driven-forms%2Fant-component-mapper)
2+
[![Tweet](https://img.shields.io/twitter/url/https/github.com/tterb/hyde.svg?style=social)](https://twitter.com/intent/tweet?text=Check%20DataDrivenForms%20React%20library%21%20https%3A%2F%2Fdata-driven-forms.org%2F&hashtags=react,opensource,datadrivenforms)
3+
[![Twitter Follow](https://img.shields.io/twitter/follow/DataDrivenForms.svg?style=social)](https://twitter.com/DataDrivenForms)
24

35
[![Data Driven Form logo](images/logo.png)](https://data-driven-forms.org/)
46

@@ -23,7 +25,7 @@ Material-UI component mapper for [Data Driven Forms](https://github.com/data-dri
2325

2426
### Installation
2527

26-
You neet to add React Form Renderer
28+
You need to add React Form Renderer
2729

2830
#### [React Form Renderer](https://www.npmjs.com/package/@data-driven-forms/react-form-renderer)
2931

@@ -79,18 +81,21 @@ const Form = () => (
7981

8082
Data Driven Forms supports all kinds of component, basic set is consisted of:
8183

82-
- Text input
83-
- Text area
84-
- Checkbox (Multiple checkboxes)
85-
- Select (dropdown)
86-
- Switch
87-
- Radio buttons
88-
- Date picker
89-
- Time picker
90-
- Tabs
91-
- Sub-form
92-
- Wizard
93-
- Plain-text
84+
- [Text input](https://data-driven-forms.org/mappers/text-field?mapper=ant)
85+
- [Text area](https://data-driven-forms.org/mappers/textarea?mapper=ant)
86+
- [Checkbox](https://data-driven-forms.org/mappers/checkbox?mapper=ant) ([Multiple checkboxes](https://data-driven-forms.org/mappers/checkbox-multiple?mapper=ant))
87+
- [Select (dropdown)](https://data-driven-forms.org/mappers/select?mapper=ant)
88+
- [Dual list select](https://data-driven-forms.org/mappers/dual-list-select?mapper=ant)
89+
- [Field array](https://data-driven-forms.org/mappers/field-array?mapper=ant)
90+
- [Switch](https://data-driven-forms.org/mappers/switch?mapper=ant)
91+
- [Radio buttons](https://data-driven-forms.org/mappers/radio?mapper=ant)
92+
- [Date picker](https://data-driven-forms.org/mappers/date-picker?mapper=ant)
93+
- [Time picker](https://data-driven-forms.org/mappers/time-picker?mapper=ant)
94+
- [Tabs](https://data-driven-forms.org/mappers/tabs?mapper=ant)
95+
- [Slider](https://data-driven-forms.org/mappers/slider?mapper=ant)
96+
- [Sub-form](https://data-driven-forms.org/mappers/sub-form?mapper=ant)
97+
- [Plain text](https://data-driven-forms.org/mappers/plain-text?mapper=ant)
98+
- [Wizard](https://data-driven-forms.org/mappers/wizard?mapper=ant)
9499

95100
### Useful links
96101

@@ -103,7 +108,7 @@ Data Driven Forms supports all kinds of component, basic set is consisted of:
103108

104109
### Development setup
105110

106-
Data Driven Forms is a monorepo which uses [Lerna](https://github.com/lerna/lerna), so you can use all its commands as well.
111+
Data Driven Forms is a monorepo that uses [Lerna](https://github.com/lerna/lerna) and [yarn workspaces](https://classic.yarnpkg.com/blog/2017/08/02/introducing-workspaces/), so you can use all its commands as well.
107112

108113
1. Install
109114

packages/ant-component-mapper/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@data-driven-forms/ant-component-mapper",
3-
"version": "2.8.2",
3+
"version": "2.17.0",
44
"description": "Component mapper for Ant Design component mapper form data-driven-forms.",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",
@@ -51,7 +51,7 @@
5151
"rollup-plugin-sourcemaps": "^0.5.0",
5252
"rollup-pluginutils": "^2.8.2",
5353
"sass-loader": "^7.1.0",
54-
"semantic-release": "15.12.0",
54+
"semantic-release": "17.2.3",
5555
"style-loader": "^0.23.1",
5656
"url-loader": "^1.1.2",
5757
"webpack": "^4.25.1",
@@ -67,10 +67,10 @@
6767
"react-select": "^2.2.0"
6868
},
6969
"peerDependencies": {
70-
"@data-driven-forms/react-form-renderer": "^1.9.3",
70+
"@data-driven-forms/react-form-renderer": ">=2.4.6",
7171
"antd": "^4.2.0",
72-
"react": "^16.13.0",
73-
"react-dom": "^16.13.0"
72+
"react": ">=16.13.0",
73+
"react-dom": ">=16.13.0"
7474
},
7575
"dependencies": {},
7676
"postpublish": "export RELEASE_DEMO=true"

packages/ant-component-mapper/src/common/form-wrapper.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ import { childrenPropTypes } from '@data-driven-forms/common/src/prop-types-temp
77

88
const AntForm = ({ label, children, isRequired, FormItemProps, meta, validateOnMount, helperText, description, hideLabel }) => {
99
const invalid = validationError(meta, validateOnMount);
10-
const help = invalid || helperText || description;
10+
const warning = (meta.touched || validateOnMount) && meta.warning;
11+
const help = invalid || warning || helperText || description;
1112

1213
return (
13-
<Form.Item validateStatus={!invalid ? '' : 'error'} help={help} label={!hideLabel && label} required={isRequired} {...FormItemProps}>
14+
<Form.Item
15+
validateStatus={!invalid ? (warning ? 'warning' : '') : 'error'}
16+
help={help}
17+
label={!hideLabel && label}
18+
required={isRequired}
19+
{...FormItemProps}
20+
>
1421
{children}
1522
</Form.Item>
1623
);

packages/ant-component-mapper/src/files/form-template.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { FormTemplateRenderProps, AnyObject } from "@data-driven-forms/react-form-renderer";
1+
import FormTemplateCommonProps from "@data-driven-forms/common/src/form-template";
22

3-
export interface FormTemplateProps extends FormTemplateRenderProps {
4-
formWrapperProps?: AnyObject;
3+
export interface FormTemplateProps extends FormTemplateCommonProps {
54
layout?: string;
65
}
76

packages/ant-component-mapper/src/files/form-template.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Form.defaultProps = {
2222
layout: 'vertical'
2323
};
2424

25-
const Description = ({ children }) => (
26-
<Typography>
25+
const Description = ({ children, ...props }) => (
26+
<Typography {...props}>
2727
<Paragraph>{children}</Paragraph>
2828
</Typography>
2929
);
@@ -32,8 +32,8 @@ Description.propTypes = {
3232
children: childrenPropTypes
3333
};
3434

35-
const TitleComponent = ({ children }) => (
36-
<Typography>
35+
const TitleComponent = ({ children, ...props }) => (
36+
<Typography {...props}>
3737
<Title level={3}>{children}</Title>
3838
</Typography>
3939
);
@@ -42,7 +42,11 @@ TitleComponent.propTypes = {
4242
children: childrenPropTypes
4343
};
4444

45-
const ButtonGroup = ({ children }) => <div style={{ display: 'flex', justifyContent: 'flex-end' }}>{children}</div>;
45+
const ButtonGroup = ({ children, ...props }) => (
46+
<div style={{ display: 'flex', justifyContent: 'flex-end' }} {...props}>
47+
{children}
48+
</div>
49+
);
4650

4751
ButtonGroup.propTypes = {
4852
children: childrenPropTypes

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,29 @@ describe('formFields generated tests', () => {
103103
expect(wrapper.find('.ant-form-item-has-error').length).toBeGreaterThanOrEqual(1);
104104
});
105105

106+
it('renders with warning', async () => {
107+
const errorField = {
108+
...field,
109+
validate: [{ type: validatorTypes.REQUIRED, warning: true }],
110+
useWarnings: true,
111+
validateOnMount: true
112+
};
113+
let wrapper;
114+
115+
await act(async () => {
116+
wrapper = mount(<RendererWrapper schema={{ fields: [errorField] }} />);
117+
});
118+
wrapper.update();
119+
120+
expect(
121+
wrapper
122+
.find('.ant-form-item-explain')
123+
.last()
124+
.text()
125+
).toEqual(errorText);
126+
expect(wrapper.find('.ant-form-item-has-warning').length).toBeGreaterThanOrEqual(1);
127+
});
128+
106129
it('renders with error and validateOnMount', async () => {
107130
const errorField = {
108131
...field,

0 commit comments

Comments
 (0)