Socket
Socket
Sign inDemoInstall

@8base/forms

Package Overview
Dependencies
54
Maintainers
2
Versions
189
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.2.1

15

es/Form.js

@@ -17,2 +17,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import { formatDataForMutation } from '@8base/utils';

@@ -45,9 +46,19 @@ import { FormContext } from './FormContext';

tableSchema = _this$props.tableSchema,
restProps = _objectWithoutProperties(_this$props, ['mutators', 'tableSchema']);
type = _this$props.type,
schema = _this$props.schema,
onSubmit = _this$props.onSubmit,
restProps = _objectWithoutProperties(_this$props, ['mutators', 'tableSchema', 'type', 'schema', 'onSubmit']);
var collectedProps = Object.assign({
mutators: R.merge(arrayMutators, mutators),
tableSchema: tableSchema
tableSchema: tableSchema,
onSubmit: onSubmit
}, restProps);
if (type && tableSchema && schema) {
collectedProps.onSubmit = function (data, form, callback) {
return onSubmit(formatDataForMutation(type, tableSchema.name, data, schema), form, callback);
};
}
return collectedProps;

@@ -54,0 +65,0 @@ }, _this.collectContextValue = function () {

2

es/utils/withTableSchema.js

@@ -42,3 +42,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

if (tableSchema) {
return React.createElement(BaseComponent, Object.assign({}, restProps, { tableSchema: tableSchema }));
return React.createElement(BaseComponent, Object.assign({}, restProps, { tableSchema: tableSchema, schema: contextSchema }));
}

@@ -45,0 +45,0 @@

{
"name": "@8base/forms",
"version": "0.2.0",
"version": "0.2.1",
"main": "es/index.js",

@@ -48,3 +48,3 @@ "module": "es/index.js",

"dependencies": {
"@8base/table-schema-provider": "^0.1.1",
"@8base/table-schema-provider": "^0.1.2",
"@8base/utils": "^0.1.4",

@@ -51,0 +51,0 @@ "@8base/validate": "^0.1.4",

@@ -117,3 +117,3 @@ # 8base Forms

render(
<Form tableSchema={TABLE_SCHEMA} onSubmit={onSubmit}>
<Form type="CREATE" tableSchema={TABLE_SCHEMA} onSubmit={onSubmit}>
{

@@ -204,3 +204,3 @@ ({ handleSubmit }) => (

render(
<Form tableSchema={TABLE_SCHEMA} onSubmit={onSubmit}>
<Form type="CREATE" tableSchema={TABLE_SCHEMA} onSubmit={onSubmit}>
{

@@ -327,3 +327,3 @@ ({ handleSubmit }) => (

<TableSchemaProvider schema={SCHEMA}>
<Form tableSchemaName="client" onSubmit={ onSubmitClient }>
<Form type="CREATE" tableSchemaName="client" onSubmit={ onSubmitClient }>
{

@@ -340,3 +340,3 @@ ({ handleSubmit }) => (

</Form>
<Form tableSchemaName="order" onSubmit={onSubmitOrder}>
<Form type="CREATE" tableSchemaName="order" onSubmit={onSubmitOrder}>
{

@@ -539,3 +539,3 @@ ({ handleSubmit }) => (

<TableSchemaProvider value={ SCHEMA }>
<Form tableSchemaName="tableSchema" initialValues={ INITIAL_VALUES } onSubmit={ onSubmitForm }>
<Form type="CREATE" tableSchemaName="tableSchema" initialValues={ INITIAL_VALUES } onSubmit={ onSubmitForm }>
{

@@ -542,0 +542,0 @@ ({ handleSubmit }) => (

@@ -8,2 +8,3 @@ // @flow

import type { FormProps as FinalFormProps } from 'react-final-form';
import { formatDataForMutation } from '@8base/utils';

@@ -25,3 +26,3 @@ import { FormContext } from './FormContext';

collectProps = (): FinalFormProps => {
const { mutators, tableSchema, ...restProps } = this.props;
const { mutators, tableSchema, type, schema, onSubmit, ...restProps } = this.props;

@@ -31,5 +32,10 @@ const collectedProps = {

tableSchema,
onSubmit,
...restProps,
};
if (type && tableSchema && schema) {
collectedProps.onSubmit = (data, form, callback) => onSubmit(formatDataForMutation(type, tableSchema.name, data, schema), form, callback);
}
return collectedProps;

@@ -36,0 +42,0 @@ };

@@ -42,2 +42,4 @@ // @flow

tableSchema?: TableSchema,
schema?: Schema,
type?: 'CREATE' | 'UPDATE',
} & FinalFormProps;

@@ -44,0 +46,0 @@

@@ -22,3 +22,3 @@ // @flow

if (tableSchema) {
return <BaseComponent { ...restProps } tableSchema={ tableSchema } />;
return <BaseComponent { ...restProps } tableSchema={ tableSchema } schema={ contextSchema } />;
}

@@ -25,0 +25,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc