Skip to content

Commit 1b79bf5

Browse files
committed
breaking(renderer): stream line build output files structure.
1 parent d7f23ff commit 1b79bf5

37 files changed

+85
-80
lines changed

packages/pf4-component-mapper/src/tests/form-fields.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import RenderWithProvider from '../../../../__mocks__/with-provider';
1515
import FormRenderer, { componentTypes } from '@data-driven-forms/react-form-renderer';
1616
import FormTemplate from '../components/form-template';
1717
import componentMapper from '../components/component-mapper';
18-
import validatorTypes from '../../../react-form-renderer/src/components/validator-types';
18+
import validatorTypes from '@data-driven-forms/react-form-renderer/dist/cjs/validator-types';
1919
import MockFieldProvider from '../../../../__mocks__/mock-field-provider';
2020
import MultipleChoiceListCommon from '@data-driven-forms/common/src/multiple-choice-list';
2121

packages/react-form-renderer/demo/form-fields-mapper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable no-unused-vars */
22
import React from 'react';
33
import { componentTypes } from '../src';
4-
import FieldProvider from '../src/components/field-provider';
5-
import useFieldApi from '../src/hooks/use-field-api';
4+
import FieldProvider from '../src/files/field-provider';
5+
import useFieldApi from '../src/files/use-field-api';
66

77
const TextField = (props) => (
88
<FieldProvider

packages/react-form-renderer/demo/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import FormRenderer, { validatorTypes } from '../src';
55
import componentMapper from './form-fields-mapper';
66
import FormTemplate from './form-template';
77
// import sandboxSchema from './sandbox';
8-
import DefaultSchemaError from '../src/parsers/schema-errors';
8+
import DefaultSchemaError from '../src/files/schema-errors';
99

1010
const intl = (name) => `translated ${name}`;
1111

packages/react-form-renderer/rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import glob from 'glob';
88
import path from 'path';
99
import sourcemaps from 'rollup-plugin-sourcemaps';
1010

11-
const outputPaths = glob.sync(path.resolve(__dirname, './src/components/*.js'));
11+
const outputPaths = glob.sync(path.resolve(__dirname, './src/files/*.js'));
1212

1313
const globals = {
1414
react: 'React',
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import dataTypes from '../files/data-types';
2+
3+
/**
4+
* Casts string true/false to boolean
5+
* @param {String} value value
6+
*/
7+
const castToBoolean = (value) => {
8+
if (typeof value === 'boolean') {
9+
return value;
10+
}
11+
12+
return value === 'true';
13+
};
14+
15+
/**
16+
* Changes the value type
17+
* @param {FieldDataTypes} dataType type for value conversion
18+
* @param {Any} value value to be converted
19+
*/
20+
const convertType = (dataType, value) =>
21+
({
22+
[dataTypes.INTEGER]: !isNaN(Number(value)) && parseInt(value),
23+
[dataTypes.FLOAT]: !isNaN(Number(value)) && parseFloat(value),
24+
[dataTypes.NUMBER]: Number(value),
25+
[dataTypes.BOOLEAN]: castToBoolean(value)
26+
}[dataType] || value);
27+
28+
export default convertType;

packages/react-form-renderer/src/parsers/default-schema-validator.js renamed to packages/react-form-renderer/src/files/default-schema-validator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable no-prototype-builtins */
22
import DefaultSchemaError from './schema-errors';
33
//import isValidComponent from './isValidComponent';
4-
import componentTypes from '../components/component-types';
5-
import dataTypes from '../components/data-types';
4+
import componentTypes from './component-types';
5+
import dataTypes from './data-types';
66

77
const componentBlackList = [componentTypes.FIELD_ARRAY, 'tab-item'];
88

0 commit comments

Comments
 (0)