@reactway/forms-core
Advanced tools
Comparing version 0.0.0-canary.a222017 to 0.0.0-canary.a86bb1e
@@ -0,1 +1,2 @@ | ||
import { Dictionary } from "./type-helpers"; | ||
export interface Validator<TValue> { | ||
@@ -8,6 +9,6 @@ name: string; | ||
export interface ValidatorHelpers { | ||
error: (message: string, code?: string) => ValidationResult & { | ||
error: (message: string, code?: string, data?: Dictionary<any>) => ValidationResult & { | ||
type: ValidationResultType.Error; | ||
}; | ||
warning: (message: string, code?: string) => ValidationResult & { | ||
warning: (message: string, code?: string, data?: Dictionary<any>) => ValidationResult & { | ||
type: ValidationResultType.Warning; | ||
@@ -21,2 +22,3 @@ }; | ||
validatorName?: string; | ||
data?: Dictionary<any>; | ||
code?: string; | ||
@@ -23,0 +25,0 @@ } |
@@ -147,5 +147,7 @@ import { TinyEmitter } from '@reactway/tiny-emitter'; | ||
mutableValidatorsOrder.push(id); | ||
fieldState.validation.results = []; | ||
return id; | ||
}, | ||
unregisterValidator: (fieldId, validatorId) => { | ||
var _a, _b; | ||
const fieldState = helpers.selectField(fieldId); | ||
@@ -156,5 +158,7 @@ if (fieldState == null || fieldState.validation.validators[validatorId] == null) { | ||
} | ||
(_b = (_a = fieldState.validation.currentValidation) === null || _a === void 0 ? void 0 : _a.cancellationToken) === null || _b === void 0 ? void 0 : _b.cancel(); | ||
const mutableValidators = fieldState.validation.validators; | ||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete | ||
delete mutableValidators[validatorId]; | ||
fieldState.validation.results = []; | ||
const validatorOrderIndex = fieldState.validation.validatorsOrder.findIndex(x => x === validatorId); | ||
@@ -257,2 +261,3 @@ if (validatorOrderIndex === -1) { | ||
}); | ||
break; | ||
} | ||
@@ -266,3 +271,3 @@ updateFieldAsync(fieldSelector, store, cancellationToken, state => { | ||
return { | ||
error: (message, code) => ({ | ||
error: (message, code, data) => ({ | ||
type: ValidationResultType.Error, | ||
@@ -272,5 +277,6 @@ message: message, | ||
origin: origin, | ||
validatorName: validatorName | ||
validatorName: validatorName, | ||
data: data | ||
}), | ||
warning: (message, code) => ({ | ||
warning: (message, code, data) => ({ | ||
type: ValidationResultType.Warning, | ||
@@ -280,3 +286,4 @@ message: message, | ||
origin: origin, | ||
validatorName: validatorName | ||
validatorName: validatorName, | ||
data: data | ||
}) | ||
@@ -283,0 +290,0 @@ }; |
@@ -150,5 +150,7 @@ 'use strict'; | ||
mutableValidatorsOrder.push(id); | ||
fieldState.validation.results = []; | ||
return id; | ||
}, | ||
unregisterValidator: (fieldId, validatorId) => { | ||
var _a, _b; | ||
const fieldState = helpers.selectField(fieldId); | ||
@@ -159,5 +161,7 @@ if (fieldState == null || fieldState.validation.validators[validatorId] == null) { | ||
} | ||
(_b = (_a = fieldState.validation.currentValidation) === null || _a === void 0 ? void 0 : _a.cancellationToken) === null || _b === void 0 ? void 0 : _b.cancel(); | ||
const mutableValidators = fieldState.validation.validators; | ||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete | ||
delete mutableValidators[validatorId]; | ||
fieldState.validation.results = []; | ||
const validatorOrderIndex = fieldState.validation.validatorsOrder.findIndex(x => x === validatorId); | ||
@@ -260,2 +264,3 @@ if (validatorOrderIndex === -1) { | ||
}); | ||
break; | ||
} | ||
@@ -269,3 +274,3 @@ updateFieldAsync(fieldSelector, store, cancellationToken, state => { | ||
return { | ||
error: (message, code) => ({ | ||
error: (message, code, data) => ({ | ||
type: exports.ValidationResultType.Error, | ||
@@ -275,5 +280,6 @@ message: message, | ||
origin: origin, | ||
validatorName: validatorName | ||
validatorName: validatorName, | ||
data: data | ||
}), | ||
warning: (message, code) => ({ | ||
warning: (message, code, data) => ({ | ||
type: exports.ValidationResultType.Warning, | ||
@@ -283,3 +289,4 @@ message: message, | ||
origin: origin, | ||
validatorName: validatorName | ||
validatorName: validatorName, | ||
data: data | ||
}) | ||
@@ -286,0 +293,0 @@ }; |
{ | ||
"name": "@reactway/forms-core", | ||
"description": "React forms.", | ||
"version": "0.0.0-canary.a222017", | ||
"version": "0.0.0-canary.a86bb1e", | ||
"author": "Reactway <dev@reactway.com> (https://github.com/reactway)", | ||
@@ -14,7 +14,7 @@ "dependencies": { | ||
"devDependencies": { | ||
"@reactway-tools/rollup": "^0.0.0-canary.a222017", | ||
"@reactway/eslint-config": "^1.0.1", | ||
"@types/debug": "^4.1.5", | ||
"eslint": "^6.8.0", | ||
"prettier": "^1.19.1", | ||
"@reactway-tools/rollup": "0.0.0-canary.a86bb1e", | ||
"@reactway/eslint-config": "1.0.1", | ||
"@types/debug": "4.1.5", | ||
"eslint": "6.8.0", | ||
"prettier": "1.19.1", | ||
"rollup": "1.32.0", | ||
@@ -21,0 +21,0 @@ "typescript": "3.8.3" |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
95042
2218
0