Skip to content

Commit 2c213f8

Browse files
edgarmuellereneufeld
authored andcommitted
Define parameters for the handleChange method #730
1 parent 37febf6 commit 2c213f8

21 files changed

Lines changed: 1476 additions & 1558 deletions

package-lock.json

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/src/renderers/field.util.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export interface FieldProps {
4040
enabled: boolean;
4141
dispatch: any;
4242
isValid: boolean;
43+
44+
handleChange(string, any): (void);
4345
}
4446
export const registerStartupInput = (tester: RankedTester, field: any) => {
4547
JsonForms.fields.push({
@@ -49,7 +51,7 @@ export const registerStartupInput = (tester: RankedTester, field: any) => {
4951

5052
return field;
5153
};
52-
export const mapStateToInputProps = (state, ownProps) => {
54+
export const mapStateToFieldProps = (state, ownProps) => {
5355
const path = composeWithUi(ownProps.uischema, ownProps.path);
5456
const visible = _.has(ownProps, 'visible') ? ownProps.visible : isVisible(ownProps, state);
5557
const enabled = _.has(ownProps, 'enabled') ? ownProps.enabled : isEnabled(ownProps, state);
@@ -69,4 +71,8 @@ export const mapStateToInputProps = (state, ownProps) => {
6971
isValid
7072
};
7173
};
72-
export const handleChange = (props, value) => props.dispatch(update(props.path, () => value));
74+
export const mapDispatchToFieldProps = dispatch => ({
75+
handleChange(path, value) {
76+
dispatch(update(path, () => value));
77+
},
78+
});

0 commit comments

Comments
 (0)