Start work on removing formsy dependency

This commit is contained in:
SachaG 2018-06-20 10:26:15 +09:00
parent a7081f71c1
commit 7aa3718e18
3 changed files with 20 additions and 6 deletions

View file

@ -30,8 +30,8 @@
"escape-string-regexp": "^1.0.5",
"express": "^4.14.0",
"flat": "^4.0.0",
"formsy-react": "^0.19.5",
"formsy-react-components": "^0.11.1",
"formsy-react": "^1.1.4",
"formsy-react-components": "^1.0.0",
"graphql": "^0.10.5",
"graphql-anywhere": "^3.0.1",
"graphql-date": "^1.0.2",

View file

@ -80,7 +80,9 @@ class FormComponent extends Component {
Function passed to form controls (always controlled) to update their value
*/
handleChange = (name, value) => {
handleChange = (event) => {
let value = event.target.value;
// if value is an empty string, delete the field
if (value === '') {
value = null;

View file

@ -1,8 +1,20 @@
import React from 'react';
import { Input } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';
import FormGroup from 'react-bootstrap/lib/FormGroup';
import ControlLabel from 'react-bootstrap/lib/ControlLabel';
import FormControl from 'react-bootstrap/lib/FormControl';
import HelpBlock from 'react-bootstrap/lib/HelpBlock';
const Default = ({refFunction, inputProperties}) =>
<Input {...inputProperties} ref={refFunction} type="text" />;
const Default = ({ refFunction, inputProperties }) => (
<FormGroup
controlId="formBasicText"
// validationState={this.getValidationState()}
>
<ControlLabel>{inputProperties.label}</ControlLabel>
<FormControl type="text" {...inputProperties} ref={refFunction} />
{/* <FormControl.Feedback /> */}
{/* <HelpBlock>Validation is based on string length.</HelpBlock> */}
</FormGroup>
);
registerComponent('FormComponentDefault', Default);