Skip to content

Commit 7a9d51c

Browse files
committed
Make from dual-list constant
1 parent ef044c6 commit 7a9d51c

File tree

7 files changed

+16
-29
lines changed

7 files changed

+16
-29
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const componentMapper = {
4343
[componentTypes.PLAIN_TEXT]: PlainText,
4444
[componentTypes.WIZARD]: Wizard,
4545
[componentTypes.FIELD_ARRAY]: FieldArray,
46-
'dual-list-select': DualListSelect
46+
[componentTypes.DUAL_LIST_SELECT]: DualListSelect
4747
};
4848

4949
export default componentMapper;

packages/mui-component-mapper/src/tests/dual-list-select.test.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
import React from 'react';
22
import { act } from 'react-dom/test-utils';
3-
import FormRenderer from '@data-driven-forms/react-form-renderer';
3+
import FormRenderer, { componentTypes } from '@data-driven-forms/react-form-renderer';
44
import { mount } from 'enzyme';
55

6-
import {
7-
Grid,
8-
List,
9-
ListItem,
10-
ListItemText,
11-
ListItemIcon,
12-
Checkbox,
13-
ListItemSecondaryAction,
14-
IconButton,
15-
FormControl,
16-
FormLabel,
17-
FormHelperText,
18-
Toolbar,
19-
TextField,
20-
Typography
21-
} from '@material-ui/core';
6+
import { List, ListItem, IconButton, Toolbar, TextField } from '@material-ui/core';
227

238
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
249
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
@@ -39,7 +24,7 @@ describe('DualListSelect', () => {
3924
schema = {
4025
fields: [
4126
{
42-
component: 'dual-list-select',
27+
component: componentTypes.DUAL_LIST_SELECT,
4328
name: 'dual-list',
4429
options: [
4530
{

packages/pf4-component-mapper/src/files/component-mapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const mapper = {
2929
[componentTypes.SWITCH]: Switch,
3030
[componentTypes.PLAIN_TEXT]: PlainText,
3131
[componentTypes.FIELD_ARRAY]: FieldArray,
32-
'dual-list-select': DualListSelect
32+
[componentTypes.DUAL_LIST_SELECT]: DualListSelect
3333
};
3434

3535
export default mapper;

packages/pf4-component-mapper/src/tests/dual-list-select.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { act } from 'react-dom/test-utils';
3-
import FormRenderer from '@data-driven-forms/react-form-renderer';
3+
import FormRenderer, { componentTypes } from '@data-driven-forms/react-form-renderer';
44
import { mount } from 'enzyme';
55

66
import { FormGroup, TextInput } from '@patternfly/react-core';
@@ -28,7 +28,7 @@ describe('DualListSelect', () => {
2828
schema = {
2929
fields: [
3030
{
31-
component: 'dual-list-select',
31+
component: componentTypes.DUAL_LIST_SELECT,
3232
name: 'dual-list',
3333
options: [
3434
{

packages/react-form-renderer/src/files/component-types.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const componentTypes = {
1515
PLAIN_TEXT: 'plain-text',
1616
BUTTON: 'button',
1717
INPUT_ADDON_GROUP: 'input-addon-group',
18-
INPUT_ADDON_BUTTON_GROUP: 'input-addon-button-group'
18+
INPUT_ADDON_BUTTON_GROUP: 'input-addon-button-group',
19+
DUAL_LIST_SELECT: 'dual-list-select'
1920
};
2021

2122
export default componentTypes;

packages/react-renderer-demo/src/app/pages/component-example/dual-list-select.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ import ComponentText from '@docs/components/component-example-text';
33
import useComponentExample from '../../src/hooks/use-component-example';
44
import Pf4DualListSelect from '@data-driven-forms/pf4-component-mapper/dist/cjs/dual-list-select';
55
import MuiDualListSelect from '@data-driven-forms/mui-component-mapper/dist/cjs/dual-list-select';
6+
import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/component-types';
67

78
const mappers = {
89
pf4: {
9-
'dual-list-select': Pf4DualListSelect
10+
[componentTypes.DUAL_LIST_SELECT]: Pf4DualListSelect
1011
},
1112
pf3: {
12-
'dual-list-select': () => <h2>Not implemented</h2>
13+
[componentTypes.DUAL_LIST_SELECT]: () => <h2>Not implemented</h2>
1314
},
1415
mui: {
15-
'dual-list-select': MuiDualListSelect
16+
[componentTypes.DUAL_LIST_SELECT]: MuiDualListSelect
1617
}
1718
};
1819

packages/react-renderer-demo/src/app/src/components/navigation/examples-definitions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,15 +461,15 @@ Vestibulum vulputate inceptos himenaeos.`
461461
}
462462
},
463463
{
464-
component: 'dual-list-select',
465-
link: 'dual-list-select',
464+
component: componentTypes.DUAL_LIST_SELECT,
465+
link: componentTypes.DUAL_LIST_SELECT,
466466
linkText: 'Dual list select',
467467
ContentText: DualListSelect,
468468
variants: [...formGroupVariants],
469469
value: {
470470
fields: [
471471
{
472-
component: 'dual-list-select',
472+
component: componentTypes.DUAL_LIST_SELECT,
473473
name: 'dual-list-select',
474474
options: [
475475
{

0 commit comments

Comments
 (0)