rc-field-form
Advanced tools
Comparing version 0.0.0-alpha.11 to 0.0.0-alpha.12
@@ -124,5 +124,13 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var namePathMatch = namePathList && containsNamePath(namePathList, namePath); // `setFieldsValue` is a quick access to update related status | ||
if (info.type === 'valueUpdate' && info.source === 'external' && prevValue !== curValue) { | ||
_this.touched = true; | ||
_this.validatePromise = null; | ||
_this.errors = []; | ||
} | ||
switch (info.type) { | ||
case 'reset': | ||
if (!namePathList || namePathList && containsNamePath(namePathList, namePath)) { | ||
if (!namePathList || namePathMatch) { | ||
// Clean up state | ||
@@ -146,3 +154,3 @@ _this.touched = false; | ||
{ | ||
if (namePathList && containsNamePath(namePathList, namePath)) { | ||
if (namePathMatch) { | ||
var data = info.data; | ||
@@ -177,3 +185,3 @@ | ||
if (namePathList && containsNamePath(namePathList, namePath) || dependencyList.some(function (dependency) { | ||
if (namePathMatch || dependencyList.some(function (dependency) { | ||
return containsNamePath(info.relatedFields, dependency); | ||
@@ -196,5 +204,7 @@ })) { | ||
*/ | ||
if (namePathList && containsNamePath(namePathList, namePath) || dependencies.some(function (dependency) { | ||
if (namePathMatch || dependencies.some(function (dependency) { | ||
return containsNamePath(namePathList, getNamePath(dependency)); | ||
}) || (typeof shouldUpdate === 'function' ? shouldUpdate(prevStore, values, info) : prevValue !== curValue)) { | ||
}) || (typeof shouldUpdate === 'function' ? shouldUpdate(prevStore, values, 'source' in info ? { | ||
source: info.source | ||
} : {}) : prevValue !== curValue)) { | ||
_this.reRender(); | ||
@@ -201,0 +211,0 @@ |
@@ -79,5 +79,8 @@ import { ReactElement } from 'react'; | ||
export declare type ValidateFields = (nameList?: NamePath[]) => Promise<Store>; | ||
export declare type NotifyInfo = { | ||
type: 'valueUpdate' | 'validateFinish' | 'reset'; | ||
source?: 'internal' | 'external'; | ||
interface ValueUpdateInfo { | ||
type: 'valueUpdate'; | ||
source: 'internal' | 'external'; | ||
} | ||
export declare type NotifyInfo = ValueUpdateInfo | { | ||
type: 'validateFinish' | 'reset'; | ||
} | { | ||
@@ -84,0 +87,0 @@ type: 'setField'; |
@@ -404,3 +404,4 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
_this.notifyObservers(prevStore, null, { | ||
type: 'valueUpdate' | ||
type: 'valueUpdate', | ||
source: 'external' | ||
}); | ||
@@ -407,0 +408,0 @@ }; |
@@ -141,5 +141,13 @@ "use strict"; | ||
var namePathMatch = namePathList && (0, _valueUtil.containsNamePath)(namePathList, namePath); // `setFieldsValue` is a quick access to update related status | ||
if (info.type === 'valueUpdate' && info.source === 'external' && prevValue !== curValue) { | ||
_this.touched = true; | ||
_this.validatePromise = null; | ||
_this.errors = []; | ||
} | ||
switch (info.type) { | ||
case 'reset': | ||
if (!namePathList || namePathList && (0, _valueUtil.containsNamePath)(namePathList, namePath)) { | ||
if (!namePathList || namePathMatch) { | ||
// Clean up state | ||
@@ -163,3 +171,3 @@ _this.touched = false; | ||
{ | ||
if (namePathList && (0, _valueUtil.containsNamePath)(namePathList, namePath)) { | ||
if (namePathMatch) { | ||
var data = info.data; | ||
@@ -194,3 +202,3 @@ | ||
if (namePathList && (0, _valueUtil.containsNamePath)(namePathList, namePath) || dependencyList.some(function (dependency) { | ||
if (namePathMatch || dependencyList.some(function (dependency) { | ||
return (0, _valueUtil.containsNamePath)(info.relatedFields, dependency); | ||
@@ -213,5 +221,7 @@ })) { | ||
*/ | ||
if (namePathList && (0, _valueUtil.containsNamePath)(namePathList, namePath) || dependencies.some(function (dependency) { | ||
if (namePathMatch || dependencies.some(function (dependency) { | ||
return (0, _valueUtil.containsNamePath)(namePathList, (0, _valueUtil.getNamePath)(dependency)); | ||
}) || (typeof shouldUpdate === 'function' ? shouldUpdate(prevStore, values, info) : prevValue !== curValue)) { | ||
}) || (typeof shouldUpdate === 'function' ? shouldUpdate(prevStore, values, 'source' in info ? { | ||
source: info.source | ||
} : {}) : prevValue !== curValue)) { | ||
_this.reRender(); | ||
@@ -218,0 +228,0 @@ |
@@ -79,5 +79,8 @@ import { ReactElement } from 'react'; | ||
export declare type ValidateFields = (nameList?: NamePath[]) => Promise<Store>; | ||
export declare type NotifyInfo = { | ||
type: 'valueUpdate' | 'validateFinish' | 'reset'; | ||
source?: 'internal' | 'external'; | ||
interface ValueUpdateInfo { | ||
type: 'valueUpdate'; | ||
source: 'internal' | 'external'; | ||
} | ||
export declare type NotifyInfo = ValueUpdateInfo | { | ||
type: 'validateFinish' | 'reset'; | ||
} | { | ||
@@ -84,0 +87,0 @@ type: 'setField'; |
@@ -422,3 +422,4 @@ "use strict"; | ||
_this.notifyObservers(prevStore, null, { | ||
type: 'valueUpdate' | ||
type: 'valueUpdate', | ||
source: 'external' | ||
}); | ||
@@ -425,0 +426,0 @@ }; |
{ | ||
"name": "rc-field-form", | ||
"version": "0.0.0-alpha.11", | ||
"version": "0.0.0-alpha.12", | ||
"description": "React Form Component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
193473
4154