Skip to content

Commit 1723677

Browse files
committed
Added docs for global props settings.
1 parent b22924c commit 1723677

File tree

19 files changed

+243
-20
lines changed

19 files changed

+243
-20
lines changed

packages/mui-component-mapper/src/files/tabs.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ TabContent.propTypes = {
1212
formOptions: PropTypes.shape({ renderForm: PropTypes.func.isRequired }).isRequired
1313
};
1414

15-
const FormTabs = ({ fields, AppBarProps, TabsProps, TabProps, TabContentProps }) => {
15+
const FormTabs = ({ fields, AppBarProps, TabsProps, TabProps }) => {
1616
const formOptions = useFormApi();
1717
const [activeTab, setActiveTab] = useState(0);
1818

@@ -27,7 +27,7 @@ const FormTabs = ({ fields, AppBarProps, TabsProps, TabProps, TabContentProps })
2727
</AppBar>
2828
{fields.map((field, index) => (
2929
<div key={field.name} hidden={index !== activeTab}>
30-
<TabContent {...field} name={field.name} formOptions={formOptions} {...TabContentProps} />
30+
<TabContent {...field} name={field.name} formOptions={formOptions} />
3131
</div>
3232
))}
3333
</div>
@@ -38,15 +38,13 @@ FormTabs.propTypes = {
3838
fields: PropTypes.array.isRequired,
3939
AppBarProps: PropTypes.object,
4040
TabsProps: PropTypes.object,
41-
TabProps: PropTypes.object,
42-
TabContentProps: PropTypes.object
41+
TabProps: PropTypes.object
4342
};
4443

4544
FormTabs.defaultProps = {
4645
AppBarProps: {},
4746
TabsProps: {},
48-
TabProps: {},
49-
TabContentProps: {}
47+
TabProps: {}
5048
};
5149

5250
export default FormTabs;

packages/react-renderer-demo/src/app/pages/component-example/checkbox-multiple.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import React from 'react';
1+
import React, { Fragment } from 'react';
22
import ComponentText from '@docs/components/component-example-text';
33
import useComponentExample from '../../src/hooks/use-component-example';
44
import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/component-types';
55
import Pf4Checkbox from '@data-driven-forms/pf4-component-mapper/dist/cjs/checkbox';
66
import Pf3Checkbox from '@data-driven-forms/pf3-component-mapper/dist/cjs/checkbox';
77
import MuiCheckbox from '@data-driven-forms/mui-component-mapper/dist/cjs/checkbox';
8+
import CheckboxText from '@docs/components/mui-definitions/checkbox-text.md';
89

910
const mappers = {
1011
pf4: {
@@ -20,5 +21,10 @@ const mappers = {
2021

2122
export default () => {
2223
const [component, baseStructure, activeMapper] = useComponentExample();
23-
return <ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />;
24+
return (
25+
<Fragment>
26+
<ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />
27+
{activeMapper === 'mui' && <CheckboxText />}
28+
</Fragment>
29+
);
2430
};

packages/react-renderer-demo/src/app/pages/component-example/checkbox.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import React from 'react';
1+
import React, { Fragment } from 'react';
22
import ComponentText from '@docs/components/component-example-text';
33
import useComponentExample from '../../src/hooks/use-component-example';
44
import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/component-types';
55
import Pf4Checkbox from '@data-driven-forms/pf4-component-mapper/dist/cjs/checkbox';
66
import Pf3Checkbox from '@data-driven-forms/pf3-component-mapper/dist/cjs/checkbox';
77
import MuiCheckbox from '@data-driven-forms/mui-component-mapper/dist/cjs/checkbox';
8+
import CheckboxText from '@docs/components/mui-definitions/checkbox-text.md';
89

910
const mappers = {
1011
pf4: {
@@ -20,5 +21,10 @@ const mappers = {
2021

2122
export default () => {
2223
const [component, baseStructure, activeMapper] = useComponentExample();
23-
return <ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />;
24+
return (
25+
<Fragment>
26+
<ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />
27+
{activeMapper === 'mui' && <CheckboxText />}
28+
</Fragment>
29+
);
2430
};

packages/react-renderer-demo/src/app/pages/component-example/date-picker.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import React from 'react';
1+
import React, { Fragment } from 'react';
22
import ComponentText from '@docs/components/component-example-text';
33
import useComponentExample from '../../src/hooks/use-component-example';
44
import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/component-types';
55
import Pf4Datepicker from '@data-driven-forms/pf4-component-mapper/dist/cjs/date-picker';
66
import MuiDatepicker from '@data-driven-forms/mui-component-mapper/dist/cjs/date-picker';
7+
import DatePickerText from '@docs/components/mui-definitions/date-picker-text.md';
78

89
import dynamic from 'next/dynamic';
910

@@ -25,5 +26,10 @@ const mappers = {
2526

2627
export default () => {
2728
const [component, baseStructure, activeMapper] = useComponentExample();
28-
return <ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />;
29+
return (
30+
<Fragment>
31+
<ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />
32+
{activeMapper === 'mui' && <DatePickerText />}
33+
</Fragment>
34+
);
2935
};

packages/react-renderer-demo/src/app/pages/component-example/radio.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import React from 'react';
1+
import React, { Fragment } from 'react';
22
import ComponentText from '@docs/components/component-example-text';
33
import useComponentExample from '../../src/hooks/use-component-example';
44
import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/component-types';
55
import Pf4Radio from '@data-driven-forms/pf4-component-mapper/dist/cjs/radio';
66
import Pf3Radio from '@data-driven-forms/pf3-component-mapper/dist/cjs/radio';
77
import MuiRadio from '@data-driven-forms/mui-component-mapper/dist/cjs/radio';
8+
import RadioText from '@docs/components/mui-definitions/radio-text.md';
89

910
const mappers = {
1011
pf4: {
@@ -20,5 +21,10 @@ const mappers = {
2021

2122
export default () => {
2223
const [component, baseStructure, activeMapper] = useComponentExample();
23-
return <ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />;
24+
return (
25+
<Fragment>
26+
<ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />
27+
{activeMapper === 'mui' && <RadioText />}
28+
</Fragment>
29+
);
2430
};

packages/react-renderer-demo/src/app/pages/component-example/switch.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import React from 'react';
1+
import React, { Fragment } from 'react';
22
import ComponentText from '@docs/components/component-example-text';
33
import useComponentExample from '../../src/hooks/use-component-example';
44
import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/component-types';
55
import Pf4Switch from '@data-driven-forms/pf4-component-mapper/dist/cjs/switch';
66
import Pf3Switch from '@data-driven-forms/pf3-component-mapper/dist/cjs/switch';
77
import MuiSwitch from '@data-driven-forms/mui-component-mapper/dist/cjs/switch';
8+
import SwitchText from '@docs/components/mui-definitions/switch-text.md';
89

910
const mappers = {
1011
pf4: {
@@ -20,5 +21,10 @@ const mappers = {
2021

2122
export default () => {
2223
const [component, baseStructure, activeMapper] = useComponentExample();
23-
return <ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />;
24+
return (
25+
<Fragment>
26+
<ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />
27+
{activeMapper === 'mui' && <SwitchText />}
28+
</Fragment>
29+
);
2430
};

packages/react-renderer-demo/src/app/pages/component-example/tabs.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { Fragment } from 'react';
22
import ComponentText from '@docs/components/component-example-text';
33
import useComponentExample from '../../src/hooks/use-component-example';
44
import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/component-types';
@@ -8,6 +8,7 @@ import MuiTabs from '@data-driven-forms/mui-component-mapper/dist/cjs/tabs';
88
import Pf4TextField from '@data-driven-forms/pf4-component-mapper/dist/cjs/text-field';
99
import Pf3TextField from '@data-driven-forms/pf3-component-mapper/dist/cjs/text-field';
1010
import MuiTextField from '@data-driven-forms/mui-component-mapper/dist/cjs/text-field';
11+
import TabsText from '@docs/components/mui-definitions/tabs-text.md';
1112

1213
const mappers = {
1314
pf4: {
@@ -26,5 +27,10 @@ const mappers = {
2627

2728
export default () => {
2829
const [component, baseStructure, activeMapper] = useComponentExample();
29-
return <ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />;
30+
return (
31+
<Fragment>
32+
<ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />
33+
{activeMapper === 'mui' && <TabsText />}
34+
</Fragment>
35+
);
3036
};

packages/react-renderer-demo/src/app/pages/component-example/time-picker.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import React from 'react';
1+
import React, { Fragment } from 'react';
22
import ComponentText from '@docs/components/component-example-text';
33
import useComponentExample from '../../src/hooks/use-component-example';
44
import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/component-types';
55
import Pf4TimePicker from '@data-driven-forms/pf4-component-mapper/dist/cjs/time-picker';
66
import MuiTimePicker from '@data-driven-forms/mui-component-mapper/dist/cjs/time-picker';
7+
import TimePickerText from '@docs/components/mui-definitions/time-picker-text.md';
78

89
const mappers = {
910
pf4: {
@@ -19,5 +20,10 @@ const mappers = {
1920

2021
export default () => {
2122
const [component, baseStructure, activeMapper] = useComponentExample();
22-
return <ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />;
23+
return (
24+
<Fragment>
25+
<ComponentText component={component} baseStructure={baseStructure} activeMapper={activeMapper} componentMapper={mappers[activeMapper]} />
26+
{activeMapper === 'mui' && <TimePickerText />}
27+
</Fragment>
28+
);
2329
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import RawComponent from '@docs/raw-component';
2+
3+
# Global component props
4+
5+
If you need to set the same value to prop to every component occurance in a form, you can do so via [component mapper](/renderer/component-mapping).
6+
7+
Always keep in mind, that the props depend on component mapper.
8+
9+
## Adding global prop to
10+
11+
<RawComponent source="global-component-props/add-global-prop-to-component"/>
12+
13+
## Props priority
14+
15+
Props from **schema** have **higher** priority and will override the global props from mappers.
16+
17+
<RawComponent source="global-component-props/props-priority"/>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Common from './common.md';
2+
3+
<Common />
4+
5+
### Composite props
6+
|name|type|default|target component|
7+
|----|----|-------|----------------|
8+
|FormFieldGridProps|object|`{}`|[Grid](https://material-ui.com/api/grid/)|
9+
|FormControlProps|object|`{}`|[Form Control](https://material-ui.com/api/form-control/#formcontrol-api)|
10+
|FormGroupProps|object|`{}`|[Form Group](https://material-ui.com/api/form-group/#formgroup-api)|
11+
|FormControlLabelProps|object|`{}`|[Form Control Label](https://material-ui.com/api/form-control-label/#formcontrollabel-api)|
12+
|CheckboxProps|object|`{}`|[Checkbox](https://material-ui.com/api/checkbox/#checkbox-api)|
13+
|FormLabelProps|object|`{}`|[Form label](https://material-ui.com/api/form-label/#formlabel-api)|
14+
|FormHelperTextProps|object|`{}`|[Form helper text](https://material-ui.com/api/form-helper-text/#formhelpertext-api)|

0 commit comments

Comments
 (0)