Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-form

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-form - npm Package Compare versions

Comparing version 0.9.1 to 0.10.0

3

HISTORY.md
# History
----
## 0.10.0 / 2016-01-27
- support setFieldsInitialValue/submit/isFieldsValidating/isSubmitting method for this.props.form
## 0.9.0 / 2016-01-18

@@ -5,0 +8,0 @@

@@ -61,6 +61,9 @@ 'use strict';

}
this.state = {
submitting: false
};
this.fields = fields || {};
this.fieldsMeta = {};
this.cachedBind = {};
var bindMethods = ['getFieldProps', 'isFieldValidating', 'getFieldError', 'setFields', 'resetFields', 'validateFieldsByName', 'getFieldsValue', 'setFieldsValue', 'getFieldValue'];
var bindMethods = ['getFieldProps', 'isFieldValidating', 'submit', 'isSubmitting', 'getFieldError', 'setFields', 'resetFields', 'validateFieldsByName', 'getFieldsValue', 'setFieldsInitialValue', 'isFieldsValidating', 'setFieldsValue', 'getFieldValue'];
bindMethods.forEach(function (m) {

@@ -92,2 +95,8 @@ _this[m] = _this[m].bind(_this);

var fieldsMetaKeys = Object.keys(fieldsMeta);
fieldsMetaKeys.forEach(function (s) {
if (fieldsMeta[s].stale) {
delete fieldsMeta[s];
}
});
var fieldsKeys = Object.keys(fields);

@@ -181,4 +190,10 @@ fieldsKeys.forEach(function (s) {

var inputProps = _defineProperty({}, valuePropName, fieldOption.initialValue);
var fieldMeta = this.fieldsMeta[name] || {};
if ('initialValue' in fieldOption) {
fieldMeta.initialValue = fieldOption.initialValue;
}
var inputProps = _defineProperty({}, valuePropName, fieldMeta.initialValue);
var validateRules = validate.map(function (item) {

@@ -216,4 +231,5 @@ item.trigger = item.trigger || [];

}
this.fieldsMeta[name] = _extends({}, fieldOption, {
validate: validateRules
this.fieldsMeta[name] = _extends({}, fieldMeta, fieldOption, {
validate: validateRules,
stale: 0
});

@@ -290,5 +306,9 @@ return inputProps;

setFields: this.setFields,
setFieldsInitialValue: this.setFieldsInitialValue,
getFieldProps: this.getFieldProps,
getFieldError: this.getFieldError,
isFieldValidating: this.isFieldValidating,
isFieldsValidating: this.isFieldsValidating,
isSubmitting: this.isSubmitting,
submit: this.submit,
validateFields: this.validateFieldsByName,

@@ -351,2 +371,15 @@ resetFields: this.resetFields

}, {
key: 'setFieldsInitialValue',
value: function setFieldsInitialValue(initialValues) {
var fieldsMeta = this.fieldsMeta;
for (var _name2 in initialValues) {
if (initialValues.hasOwnProperty(_name2)) {
var fieldMeta = fieldsMeta[_name2];
fieldsMeta[_name2] = _extends({}, fieldMeta, {
initialValue: initialValues[_name2]
});
}
}
}
}, {
key: 'hasRules',

@@ -488,2 +521,28 @@ value: function hasRules(validate) {

}, {
key: 'isFieldsValidating',
value: function isFieldsValidating(ns) {
var names = ns || this.getValidFieldsName();
return names.some(this.isFieldValidating);
}
}, {
key: 'isSubmitting',
value: function isSubmitting() {
return this.state.submitting;
}
}, {
key: 'submit',
value: function submit(callback) {
var _this7 = this;
var fn = function fn() {
_this7.setState({
submitting: false
});
};
this.setState({
submitting: true
});
callback(fn);
}
}, {
key: 'resetFields',

@@ -511,3 +570,8 @@ value: function resetFields(ns) {

var formProps = _defineProperty({}, formPropName, this.getForm());
this.fieldsMeta = {};
var fieldsMeta = this.fieldsMeta;
for (var _name3 in fieldsMeta) {
if (fieldsMeta.hasOwnProperty(_name3)) {
fieldsMeta[_name3].stale = 1;
}
}
return _react2['default'].createElement(WrappedComponent, _extends({}, formProps, this.props));

@@ -514,0 +578,0 @@ }

10

package.json
{
"name": "rc-form",
"version": "0.9.1",
"version": "0.10.0",
"description": "React High Order Form Component",

@@ -27,3 +27,6 @@ "keywords": [

"config": {
"port": 8000
"port": 8000,
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},

@@ -43,2 +46,3 @@ "scripts": {

"antd": "^0.11.2",
"cz-conventional-changelog": "^1.1.5",
"expect.js": "0.3.x",

@@ -64,2 +68,2 @@ "history": "^1.16.0",

}
}
}

@@ -149,2 +149,4 @@ # rc-form

### getFieldsValue([fieldNames: String[]])

@@ -162,2 +164,6 @@

### setFieldsInitialValue(obj: Object)
Set fields initialValue by kv object. use for reset and initial display/value.
### setFields(obj: Object)

@@ -182,6 +188,18 @@

### isFieldValidating(name): Bool
### isFieldValidating(name: String): Bool
Whether this input is validating.
### isFieldsValidating(names: String[]): Bool
Whether one of the inputs is validating.
### isSubmitting(): Bool
Whether the form is submitting.
### submit(callback: Function)
Cause isSubmitting to return true, after callback called, isSubmitting return false.
### resetFields([names: String[]])

@@ -188,0 +206,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc