Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onChange(e, value) {
const {properties} = this.props;
let values = _.get(properties, 'value') || _.get(properties, 'initialValue', []);
if (typeof values !== 'object') {
values = [values];
}
if (e.target.checked === true) {
values.push(value);
} else {
values.splice(_.indexOf(values, value), 1);
}
if (_.has(this.props, 'formKey')) {
this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
} else {
this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
}
}
return new Promise((resolve) => {
if (_.has(this.props, 'formKey')) {
resolve(this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, name, item.value)));
} else {
resolve(this.props.dispatch(change(this.props.formName, name, item.value)));
}
}).then(()=> {
if (!!this.props.field.submit && typeof this.props.submit === 'function') {
onChange(e, value) {
const values = this.state.selected;
if (e.target.checked === true) {
values.push(value);
} else {
values.splice(_.indexOf(values, value), 1);
}
if (_.has(this.props, 'formKey')) {
this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
} else {
this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
}
}
onChange(e, value) {
const {properties} = this.props;
let values = _.get(properties, 'value') || _.get(properties, 'initialValue', []);
if (typeof values !== 'object') {
values = [values];
}
if (e.target.checked === true) {
values.push(value);
} else {
values.splice(_.indexOf(values, value), 1);
}
if (_.has(this.props, 'formKey')) {
this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
} else {
this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
}
}
onChange(e, value) {
const {properties} = this.props;
let values = _.get(properties, 'value') || _.get(properties, 'initialValue', []);
if (typeof values !== 'object') {
values = [values];
}
if (e.target.checked === true) {
values.push(value);
} else {
values.splice(_.indexOf(values, value), 1);
}
if (_.has(this.props, 'formKey')) {
this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
} else {
this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
}
}
handleEditorChange(e) {
if (_.has(this.props, 'formKey')) {
this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, e.target.getContent()));
} else {
this.props.dispatch(change(this.props.formName, this.props.field.name, e.target.getContent()));
}
}
onChange(e) {
const values = this.state.selected;
if (e.target.checked === true) {
values.push(e.target.value);
} else {
values.splice(_.indexOf(values, e.target.value), 1);
}
if (_.has(this.props, 'formKey')) {
this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
} else {
this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
}
}
return new Promise((resolve) => {
if (_.has(this.props, 'formKey')) {
resolve(this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, name, item.value)));
} else {
resolve(this.props.dispatch(change(this.props.formName, name, item.value)));
}
}).then(()=> {
if (!!this.props.field.submit && typeof this.props.submit === 'function') {
onChange(e, value) {
const {properties} = this.props;
let values = _.get(properties, 'value') || _.get(properties, 'initialValue', []);
if (typeof values !== 'object') {
values = [values];
}
if (e.target.checked === true) {
values.push(value);
} else {
values.splice(_.indexOf(values, value), 1);
}
if (_.has(this.props, 'formKey')) {
this.props.dispatch(changeWithKey(this.props.formName, this.props.formKey, this.props.field.name, _.uniq(values)));
} else {
this.props.dispatch(change(this.props.formName, this.props.field.name, _.uniq(values)));
}
}