@alifd/field
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -45,3 +45,7 @@ --- | ||
}, | ||
arr: ['first', 'second'] | ||
arr: ['first', 'second'], | ||
objWithDefaults: { | ||
a: 100, | ||
b: 200 | ||
} | ||
}); | ||
@@ -48,0 +52,0 @@ } |
@@ -135,3 +135,3 @@ --- | ||
<Button type="primary" onClick={() => { | ||
this.field.validate((errors, values) => { | ||
this.field.validateCallback((errors, values) => { | ||
console.log(errors, values); | ||
@@ -138,0 +138,0 @@ }); |
@@ -54,7 +54,7 @@ --- | ||
return new Promise((resolve, reject) => { | ||
setTimeout(() => resolve('name existed'), 200); | ||
setTimeout(() => reject('name existed'), 200); | ||
}) | ||
} else { | ||
return new Promise((resolve) => { | ||
setTimeout(() => resolve(null), 200); | ||
return new Promise((resolve, reject) => { | ||
setTimeout(() => reject(), 200); | ||
}) | ||
@@ -61,0 +61,0 @@ } |
@@ -143,7 +143,4 @@ "use strict"; | ||
} else if (typeof originalProps[defaultValueName] !== 'undefined') { | ||
// here use typeof, in case of defaultValue={0} | ||
defaultValue = originalProps[defaultValueName]; | ||
} else if (parseName) { | ||
defaultValue = (0, _utils.getIn)(this.values, name); | ||
} else if (this.values && typeof this.values[name] !== 'undefined') { | ||
defaultValue = this.values[name]; | ||
} | ||
@@ -158,6 +155,6 @@ | ||
ref: originalProps.ref | ||
}); // Controlled Component | ||
}); // Controlled Component, should always equal props.value | ||
if (valueName in originalProps) { | ||
field.value = originalProps[valueName]; // When rerendering set the values | ||
field.value = originalProps[valueName]; // When rerendering set the values from props.value | ||
@@ -169,4 +166,11 @@ if (parseName) { | ||
} | ||
} | ||
} // should get value from this.values | ||
/** | ||
* a new field (value not in field) | ||
* step 1: get value from this.values | ||
* step 2: from defaultValue | ||
*/ | ||
if (!('value' in field)) { | ||
@@ -173,0 +177,0 @@ if (parseName) { |
{ | ||
"name": "@alifd/field", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Fields can be used to manage data when it comes to form data manipulation and validation. After being associated with a component, the form data can be automatically written back, read, and verified.", | ||
@@ -44,3 +44,3 @@ "files": [ | ||
"dependencies": { | ||
"@alifd/validate": "^1.1.2", | ||
"@alifd/validate": "^1.1.3", | ||
"prop-types": "^15.5.8" | ||
@@ -85,3 +85,3 @@ }, | ||
}, | ||
"homepage": "https://unpkg.com/@alifd/field@1.1.4/build/index.html", | ||
"homepage": "https://unpkg.com/@alifd/field@1.1.5/build/index.html", | ||
"bugs": "https://github.com/alibaba-fusion/field/issues", | ||
@@ -88,0 +88,0 @@ "publishConfig": { |
@@ -194,3 +194,3 @@ # Field | ||
| processErrorMessage | function to transform error objects on validation. Main usage is to add `key` prop to React component | Function(error) || | ||
| afterValidateRerender | function to perform any operations after components have rerendered to show validation results. | Function({errorGroup, options, instance}) - see [here](#afterValidateRerender) for more information || | ||
| afterValidateRerender | function to perform any operations after components have rerendered to show validation results. | Function({errorGroup, options, instance}) - see [afterValidateRerender](#afterValidateRerender) for more information || | ||
@@ -208,3 +208,4 @@ | ||
| setValue | Sets the value of a single input control (triggers render, follow the use of react time) | Function(name: String, value) | | ||
| Validate | Validate and retrieve the values of a set of input fields and Error | Function([names: String[]], [options: Object], callback: Function(errors, values)) | | | | ||
| validateCallback | Validate and retrieve the values of a set of input fields and Error. | Function([names: String[]], [options: Object], callback: Function(errors, values)) | | | | ||
| validatePromise | Validate and retrieve the values of a set of input fields and Error. Returns a promise| Function([names: String[]], [options: Object], (optional) callback: Function(errors, values)) | | | | ||
|getError | Get Error of a Single Input Control | Function(name: String) | | | | ||
@@ -211,0 +212,0 @@ |getErrors | Get Errors of a Group of Input Controls | Function([name: String]) | | | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1552177
4717
Updated@alifd/validate@^1.1.3