Skip to content

Commit f91afa3

Browse files
authored
0.6.1 (#85)
* Update README.md * Fix rowIndex not defined error * Implmented strict equal * Removed redundant messages file * Fixed showWhen and enabledWhen not working on change issue * Removed unused code * 0.6.1
1 parent 53888e8 commit f91afa3

File tree

14 files changed

+34
-91
lines changed

14 files changed

+34
-91
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ containers and keys or use the ones that come with the module.
204204
| | comment | String | comment / description that goes below the field | |
205205
| | commentAs | String | define the HTML tag to be used for wrapping the comment. (Default: <small />) | |
206206
| | commentClass | String | html class for the comment element | |
207-
| | template | React Component | String | define your custom template for the field (check `src/FieldTemplate.js`) or set the template in the template registry using `registerTemplate` and pass the string key here |
207+
| | template | React Component | String | define your custom template for the field (check `src/Template/Default.js`) or set the template in the template registry using `registerTemplate` and pass the string key here |
208208
| | errorAs | String | define the HTML tag to be used for wrapping the error. (Default: <div />) | |
209209
| | errorClass | String | html class for the error element | |
210210

demo/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component } from 'react';
1+
import React from 'react';
22
import { render } from 'react-dom';
33
import forms from './schema';
44
import ExampleFormContainer from './ExampleFormContainer';

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@flipbyte/formik-json",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"description": "formik-json is a wrapper for Formik to easily create forms using JSON / Javascript Object for defining the elements",
55
"main": "lib/index.js",
66
"module": "es/index.js",

src/Container/EditableGrid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const EditableGrid = ({
118118
{ isObject === false && !!buttons && !!buttons.add &&
119119
<td colSpan={ _.size(elements) + additionalColumnCount }>
120120
{ _.isFunction(buttons.add)
121-
? buttons.add(arrayActions, arrayFields, rowIndex)
121+
? buttons.add(arrayActions, arrayFields)
122122
: (
123123
<button
124124
type="button"

src/Container/Tabs.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import _ from 'lodash';
22
import Element from '../Element';
33
import { joinNames } from '../utils';
4-
import React, { Component, useEffect, useRef, useState } from 'react';
4+
import React, { useEffect, useRef, useState } from 'react';
55
import PropTypes from 'prop-types';
66
import shallowequal from 'shallowequal';
77

@@ -80,14 +80,16 @@ const Tabs = ({ config = {} }) => {
8080
key={ key }
8181
href={ null }
8282
className={
83-
tabListItemClass + ( activeTab == key ? tabActiveClass : '' ) +
84-
( tabInvalid ? ' is-invalid ' : '' )
83+
tabListItemClass
84+
+ ( activeTab === key ? tabActiveClass : '' )
85+
+ ( tabInvalid ? ' is-invalid ' : '' )
8586
}
86-
style={ (tabInvalid
87-
? activeTab == key
87+
style={(
88+
tabInvalid ? (
89+
activeTab === key
8890
? tabPaneActiveInvalid
8991
: tabPaneInvalid
90-
: null
92+
) : null
9193
)}
9294
onClick={() => setActiveTab(key)}
9395
>
@@ -107,15 +109,15 @@ const Tabs = ({ config = {} }) => {
107109
<div
108110
key={ tabKey }
109111
className={
110-
tabPaneClass + ' ' + ( activeTab == tabKey ? tabActiveClass : '' )
112+
`${tabPaneClass} ${activeTab === tabKey ? tabActiveClass : ''}`
111113
}
112114
>
113115
{ comment && <small className={ commentClass }>{ comment }</small> }
114116
{ _.map(content, ({ name, ...rest }, key) => (
115117
<Element
116118
key={ key }
117119
config={{ ...rest, name: joinNames(containerName, tabName, name) }}
118-
update={ activeTab == tabKey }
120+
update={ activeTab === tabKey }
119121
/>
120122
))}
121123
</div>

src/Element.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import _ from 'lodash';
22
import { connect } from 'formik';
3-
import React, { useEffect, useLayoutEffect, useState } from 'react';
3+
import React, { useEffect, useState } from 'react';
44
import ElementRenderer from './Renderer';
55
import { FIELD } from './registry';
66
import shallowequal from 'shallowequal';
77

88
const Element = ({ config, update, formik }) => {
9-
const { configSource, dataSource, name } = config;
9+
const { configSource, dataSource } = config;
1010
const [ hasLoadedConfig, setHasLoadedConfig ] = useState(false);
1111
const [ hasLoadedData, setHasLoadedData ] = useState(dataSource ? false : true);
1212
const [ hasMounted, setHasMounted ] = useState(update !== false);
13-
const [ submitCount, setSubmitCount ] = useState();
1413
const [ loadedConfig, setLoadedConfig ] = useState(undefined);
1514

1615
/**

src/Field/Autocomplete.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,7 @@ class Autocomplete extends Component {
4848

4949
render() {
5050
const { config, formik, error, value } = this.props;
51-
const {
52-
name,
53-
type,
54-
attributes,
55-
defaultValue,
56-
options = {}
57-
} = config;
51+
const { name } = config;
5852
const { setFieldValue, handleBlur } = formik;
5953

6054
this.autosuggestOptions.inputProps.name = name;

src/Field/FileUploader.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import PropTypes from 'prop-types';
2-
import React, { useMemo, useEffect, Fragment } from 'react';
1+
import React, { useMemo } from 'react';
32
import { useDropzone } from 'react-dropzone';
43
import { changeHandler } from '../utils';
54

src/Form.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import _ from 'lodash';
22
import React, { useEffect, useCallback, useState } from 'react';
33
import { Formik } from 'formik';
4-
import messages from './messages';
54
import Element from './Element';
65
import { SchemaProvider } from './withFormConfig';
76
import { prepareValidationSchema } from './utils';

0 commit comments

Comments
 (0)