aurelia-validation
Advanced tools
Comparing version 0.6.2 to 0.6.3
{ | ||
"name": "aurelia-validation", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"description": "A validation plugin for Aurelia.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -21,3 +21,3 @@ declare module 'aurelia-validation' { | ||
} | ||
export function ensure(setupStep: any): any; | ||
export function ensure(setupStep: ((it: ValidationGroup) => void)): any; | ||
export class PathObserver { | ||
@@ -94,10 +94,10 @@ constructor(observerLocator: any, subject: any, path: any); | ||
matches(regex: any): any; | ||
passes(customFunction: any, threshold: any): any; | ||
passes(customFunction: ((newValue: any, threshold: any) => boolean), threshold: any): any; | ||
passesRule(validationRule: any): any; | ||
checkLast(): any; | ||
withMessage(message: any): any; | ||
if(conditionExpression: any): any; | ||
withMessage(message: string | ((newValue: any, threshold: any) => any)): any; | ||
if(conditionExpression: (() => boolean)): any; | ||
else(): any; | ||
endIf(): any; | ||
switch(conditionExpression: any): any; | ||
switch(conditionExpression: (() => any)): any; | ||
case(caseLabel: any): any; | ||
@@ -122,6 +122,6 @@ default(): any; | ||
constructor(subject: any, observerLocator: any, config: any); | ||
destroy(): any; | ||
destroy(): void; | ||
// TODO: what else needs to be done for proper cleanup? | ||
clear(): any; | ||
clear(): void; | ||
onBreezeEntity(): any; | ||
@@ -133,5 +133,5 @@ | ||
*/ | ||
validate(forceDirty?: any, forceExecution?: any): any; | ||
onValidate(validationFunction: any, validationFunctionFailedCallback: any): any; | ||
onPropertyValidate(validationFunction: any): any; | ||
validate(forceDirty?: boolean, forceExecution?: boolean): Promise<ValidationResult>; | ||
onValidate(validationFunction: (() => any), validationFunctionFailedCallback?: ((a: any, b: any, c: any, d: any, e: any) => any)): ValidationGroup; | ||
onPropertyValidate(validationFunction: any): ValidationGroup; | ||
@@ -144,3 +144,3 @@ /** | ||
*/ | ||
ensure(bindingPath: any, configCallback: any): any; | ||
ensure(bindingPath: string, configCallback?: ((config: ValidationConfig) => void)): ValidationGroup; | ||
@@ -151,3 +151,3 @@ /** | ||
*/ | ||
isNotEmpty(): any; | ||
isNotEmpty(): ValidationGroup; | ||
@@ -158,3 +158,3 @@ /** | ||
*/ | ||
canBeEmpty(): any; | ||
canBeEmpty(): ValidationGroup; | ||
@@ -166,3 +166,3 @@ /** | ||
*/ | ||
isGreaterThanOrEqualTo(minimumValue: any): any; | ||
isGreaterThanOrEqualTo(minimumValue: any): ValidationGroup; | ||
@@ -174,3 +174,3 @@ /** | ||
*/ | ||
isGreaterThan(minimumValue: any): any; | ||
isGreaterThan(minimumValue: any): ValidationGroup; | ||
@@ -183,3 +183,3 @@ /** | ||
*/ | ||
isBetween(minimumValue: any, maximumValue: any): any; | ||
isBetween(minimumValue: any, maximumValue: any): ValidationGroup; | ||
@@ -191,3 +191,3 @@ /** | ||
*/ | ||
isLessThanOrEqualTo(maximumValue: any): any; | ||
isLessThanOrEqualTo(maximumValue: any): ValidationGroup; | ||
@@ -199,3 +199,3 @@ /** | ||
*/ | ||
isLessThan(maximumValue: any): any; | ||
isLessThan(maximumValue: any): ValidationGroup; | ||
@@ -208,3 +208,3 @@ /** | ||
*/ | ||
isEqualTo(otherValue: any, otherValueLabel: any): any; | ||
isEqualTo(otherValue: any, otherValueLabel: any): ValidationGroup; | ||
@@ -217,3 +217,3 @@ /** | ||
*/ | ||
isNotEqualTo(otherValue: any, otherValueLabel: any): any; | ||
isNotEqualTo(otherValue: any, otherValueLabel: any): ValidationGroup; | ||
@@ -224,3 +224,3 @@ /** | ||
*/ | ||
isEmail(): any; | ||
isEmail(): ValidationGroup; | ||
@@ -231,3 +231,3 @@ /** | ||
*/ | ||
isURL(): any; | ||
isURL(): ValidationGroup; | ||
@@ -239,3 +239,3 @@ /** | ||
*/ | ||
isIn(collection: any): any; | ||
isIn(collection: any): ValidationGroup; | ||
@@ -247,3 +247,3 @@ /** | ||
*/ | ||
hasMinLength(minimumValue: any): any; | ||
hasMinLength(minimumValue: number): ValidationGroup; | ||
@@ -255,3 +255,3 @@ /** | ||
*/ | ||
hasMaxLength(maximumValue: any): any; | ||
hasMaxLength(maximumValue: number): ValidationGroup; | ||
@@ -264,3 +264,3 @@ /** | ||
*/ | ||
hasLengthBetween(minimumValue: any, maximumValue: any): any; | ||
hasLengthBetween(minimumValue: number, maximumValue: number): ValidationGroup; | ||
@@ -271,3 +271,3 @@ /** | ||
*/ | ||
isNumber(): any; | ||
isNumber(): ValidationGroup; | ||
@@ -278,3 +278,3 @@ /** | ||
*/ | ||
containsNoSpaces(): any; | ||
containsNoSpaces(): ValidationGroup; | ||
@@ -285,8 +285,8 @@ /** | ||
*/ | ||
containsOnlyDigits(): any; | ||
containsOnly(regex: any): any; | ||
containsOnlyAlpha(): any; | ||
containsOnlyAlphaOrWhitespace(): any; | ||
containsOnlyLetters(): any; | ||
containsOnlyLettersOrWhitespace(): any; | ||
containsOnlyDigits(): ValidationGroup; | ||
containsOnly(regex: any): ValidationGroup; | ||
containsOnlyAlpha(): ValidationGroup; | ||
containsOnlyAlphaOrWhitespace(): ValidationGroup; | ||
containsOnlyLetters(): ValidationGroup; | ||
containsOnlyLettersOrWhitespace(): ValidationGroup; | ||
@@ -297,3 +297,3 @@ /** | ||
*/ | ||
containsOnlyAlphanumerics(): any; | ||
containsOnlyAlphanumerics(): ValidationGroup; | ||
@@ -304,3 +304,3 @@ /** | ||
*/ | ||
containsOnlyAlphanumericsOrWhitespace(): any; | ||
containsOnlyAlphanumericsOrWhitespace(): ValidationGroup; | ||
@@ -312,3 +312,3 @@ /** | ||
*/ | ||
isStrongPassword(minimumComplexityLevel: any): any; | ||
isStrongPassword(minimumComplexityLevel: number): ValidationGroup; | ||
@@ -320,3 +320,3 @@ /** | ||
*/ | ||
matches(regex: any): any; | ||
matches(regex: any): ValidationGroup; | ||
@@ -329,10 +329,10 @@ /** | ||
*/ | ||
passes(customFunction: any, threshold: any): any; | ||
passes(customFunction: Function, threshold: any): ValidationGroup; | ||
/** | ||
* Adds the {ValidationRule} | ||
* @param validationRule {ValudationRule} The rule that needs to pass | ||
* @param validationRule {ValidationRule} The rule that needs to pass | ||
* @returns {ValidationGroup} returns this ValidationGroup, to enable fluent API | ||
*/ | ||
passesRule(validationRule: any): any; | ||
passesRule(validationRule: ValidationRule): ValidationGroup; | ||
@@ -345,3 +345,3 @@ /** | ||
*/ | ||
if(conditionExpression: any, threshold: any): any; | ||
if(conditionExpression: Function, threshold: any): ValidationGroup; | ||
@@ -353,3 +353,3 @@ /** | ||
*/ | ||
else(): any; | ||
else(): ValidationGroup; | ||
@@ -361,3 +361,3 @@ /** | ||
*/ | ||
endIf(): any; | ||
endIf(): ValidationGroup; | ||
@@ -369,3 +369,3 @@ /** | ||
*/ | ||
switch(conditionExpression: any): any; | ||
switch(conditionExpression: Function): ValidationGroup; | ||
@@ -378,3 +378,3 @@ /** | ||
*/ | ||
case(caseLabel: any): any; | ||
case(caseLabel: any): ValidationGroup; | ||
@@ -386,3 +386,3 @@ /** | ||
*/ | ||
default(): any; | ||
default(): ValidationGroup; | ||
@@ -394,3 +394,3 @@ /** | ||
*/ | ||
endSwitch(): any; | ||
endSwitch(): ValidationGroup; | ||
@@ -402,3 +402,3 @@ /** | ||
*/ | ||
withMessage(message: any): any; | ||
withMessage(message: string | ((newValue: any, threshold: any) => any)): any; | ||
} | ||
@@ -437,6 +437,6 @@ export class ValidationLocale { | ||
constructor(group: any); | ||
clear(): any; | ||
onValidate(onValidateCallback: any): any; | ||
notifyObserversOfChange(): any; | ||
setValidity(validationResponse: any, shouldBeDirty: any): any; | ||
clear(): void; | ||
onValidate(onValidateCallback: any): void; | ||
notifyObserversOfChange(): void; | ||
setValidity(validationResponse: any, shouldBeDirty: boolean): void; | ||
} | ||
@@ -479,3 +479,3 @@ export class ValidationRulesCollection { | ||
*/ | ||
validate(currentValue: any, locale: any): any; | ||
validate(currentValue: any, locale: any): Promise<any>; | ||
} | ||
@@ -596,3 +596,3 @@ export class URLValidationRule extends ValidationRule { | ||
*/ | ||
constructor(observerLocator: any, validationConfig: any); | ||
constructor(observerLocator: any, validationConfig: ValidationConfig); | ||
@@ -604,4 +604,4 @@ /** | ||
*/ | ||
on(subject: any, configCallback: any): any; | ||
onBreezeEntity(breezeEntity: any, configCallback: any): any; | ||
on(subject: any, configCallback?: ((conf: ValidationConfig) => void)): ValidationGroup; | ||
onBreezeEntity(breezeEntity: any, configCallback?: ((conf: ValidationConfig) => void)): ValidationGroup; | ||
} | ||
@@ -608,0 +608,0 @@ export class TWBootstrapViewStrategyBase extends ValidationViewStrategy { |
@@ -26,3 +26,3 @@ define(['exports', 'aurelia-metadata', './validation-group-builder', './validation-result', './decorators'], function (exports, _aureliaMetadata, _validationGroupBuilder, _validationResult, _decorators) { | ||
}); | ||
validationMetadata = _aureliaMetadata.metadata.getOwn(_decorators.ValidationMetadata.metadataKey, this.subject); | ||
validationMetadata = _aureliaMetadata.metadata.getOwn(_decorators.ValidationMetadata.metadataKey, Object.getPrototypeOf(this.subject)); | ||
if (validationMetadata) { | ||
@@ -29,0 +29,0 @@ validationMetadata.setup(this); |
@@ -21,3 +21,3 @@ declare module 'aurelia-validation' { | ||
} | ||
export function ensure(setupStep: any): any; | ||
export function ensure(setupStep: ((it: ValidationGroup) => void)): any; | ||
export class PathObserver { | ||
@@ -94,10 +94,10 @@ constructor(observerLocator: any, subject: any, path: any); | ||
matches(regex: any): any; | ||
passes(customFunction: any, threshold: any): any; | ||
passes(customFunction: ((newValue: any, threshold: any) => boolean), threshold: any): any; | ||
passesRule(validationRule: any): any; | ||
checkLast(): any; | ||
withMessage(message: any): any; | ||
if(conditionExpression: any): any; | ||
withMessage(message: string | ((newValue: any, threshold: any) => any)): any; | ||
if(conditionExpression: (() => boolean)): any; | ||
else(): any; | ||
endIf(): any; | ||
switch(conditionExpression: any): any; | ||
switch(conditionExpression: (() => any)): any; | ||
case(caseLabel: any): any; | ||
@@ -122,6 +122,6 @@ default(): any; | ||
constructor(subject: any, observerLocator: any, config: any); | ||
destroy(): any; | ||
destroy(): void; | ||
// TODO: what else needs to be done for proper cleanup? | ||
clear(): any; | ||
clear(): void; | ||
onBreezeEntity(): any; | ||
@@ -133,5 +133,5 @@ | ||
*/ | ||
validate(forceDirty?: any, forceExecution?: any): any; | ||
onValidate(validationFunction: any, validationFunctionFailedCallback: any): any; | ||
onPropertyValidate(validationFunction: any): any; | ||
validate(forceDirty?: boolean, forceExecution?: boolean): Promise<ValidationResult>; | ||
onValidate(validationFunction: (() => any), validationFunctionFailedCallback?: ((a: any, b: any, c: any, d: any, e: any) => any)): ValidationGroup; | ||
onPropertyValidate(validationFunction: any): ValidationGroup; | ||
@@ -144,3 +144,3 @@ /** | ||
*/ | ||
ensure(bindingPath: any, configCallback: any): any; | ||
ensure(bindingPath: string, configCallback?: ((config: ValidationConfig) => void)): ValidationGroup; | ||
@@ -151,3 +151,3 @@ /** | ||
*/ | ||
isNotEmpty(): any; | ||
isNotEmpty(): ValidationGroup; | ||
@@ -158,3 +158,3 @@ /** | ||
*/ | ||
canBeEmpty(): any; | ||
canBeEmpty(): ValidationGroup; | ||
@@ -166,3 +166,3 @@ /** | ||
*/ | ||
isGreaterThanOrEqualTo(minimumValue: any): any; | ||
isGreaterThanOrEqualTo(minimumValue: any): ValidationGroup; | ||
@@ -174,3 +174,3 @@ /** | ||
*/ | ||
isGreaterThan(minimumValue: any): any; | ||
isGreaterThan(minimumValue: any): ValidationGroup; | ||
@@ -183,3 +183,3 @@ /** | ||
*/ | ||
isBetween(minimumValue: any, maximumValue: any): any; | ||
isBetween(minimumValue: any, maximumValue: any): ValidationGroup; | ||
@@ -191,3 +191,3 @@ /** | ||
*/ | ||
isLessThanOrEqualTo(maximumValue: any): any; | ||
isLessThanOrEqualTo(maximumValue: any): ValidationGroup; | ||
@@ -199,3 +199,3 @@ /** | ||
*/ | ||
isLessThan(maximumValue: any): any; | ||
isLessThan(maximumValue: any): ValidationGroup; | ||
@@ -208,3 +208,3 @@ /** | ||
*/ | ||
isEqualTo(otherValue: any, otherValueLabel: any): any; | ||
isEqualTo(otherValue: any, otherValueLabel: any): ValidationGroup; | ||
@@ -217,3 +217,3 @@ /** | ||
*/ | ||
isNotEqualTo(otherValue: any, otherValueLabel: any): any; | ||
isNotEqualTo(otherValue: any, otherValueLabel: any): ValidationGroup; | ||
@@ -224,3 +224,3 @@ /** | ||
*/ | ||
isEmail(): any; | ||
isEmail(): ValidationGroup; | ||
@@ -231,3 +231,3 @@ /** | ||
*/ | ||
isURL(): any; | ||
isURL(): ValidationGroup; | ||
@@ -239,3 +239,3 @@ /** | ||
*/ | ||
isIn(collection: any): any; | ||
isIn(collection: any): ValidationGroup; | ||
@@ -247,3 +247,3 @@ /** | ||
*/ | ||
hasMinLength(minimumValue: any): any; | ||
hasMinLength(minimumValue: number): ValidationGroup; | ||
@@ -255,3 +255,3 @@ /** | ||
*/ | ||
hasMaxLength(maximumValue: any): any; | ||
hasMaxLength(maximumValue: number): ValidationGroup; | ||
@@ -264,3 +264,3 @@ /** | ||
*/ | ||
hasLengthBetween(minimumValue: any, maximumValue: any): any; | ||
hasLengthBetween(minimumValue: number, maximumValue: number): ValidationGroup; | ||
@@ -271,3 +271,3 @@ /** | ||
*/ | ||
isNumber(): any; | ||
isNumber(): ValidationGroup; | ||
@@ -278,3 +278,3 @@ /** | ||
*/ | ||
containsNoSpaces(): any; | ||
containsNoSpaces(): ValidationGroup; | ||
@@ -285,8 +285,8 @@ /** | ||
*/ | ||
containsOnlyDigits(): any; | ||
containsOnly(regex: any): any; | ||
containsOnlyAlpha(): any; | ||
containsOnlyAlphaOrWhitespace(): any; | ||
containsOnlyLetters(): any; | ||
containsOnlyLettersOrWhitespace(): any; | ||
containsOnlyDigits(): ValidationGroup; | ||
containsOnly(regex: any): ValidationGroup; | ||
containsOnlyAlpha(): ValidationGroup; | ||
containsOnlyAlphaOrWhitespace(): ValidationGroup; | ||
containsOnlyLetters(): ValidationGroup; | ||
containsOnlyLettersOrWhitespace(): ValidationGroup; | ||
@@ -297,3 +297,3 @@ /** | ||
*/ | ||
containsOnlyAlphanumerics(): any; | ||
containsOnlyAlphanumerics(): ValidationGroup; | ||
@@ -304,3 +304,3 @@ /** | ||
*/ | ||
containsOnlyAlphanumericsOrWhitespace(): any; | ||
containsOnlyAlphanumericsOrWhitespace(): ValidationGroup; | ||
@@ -312,3 +312,3 @@ /** | ||
*/ | ||
isStrongPassword(minimumComplexityLevel: any): any; | ||
isStrongPassword(minimumComplexityLevel: number): ValidationGroup; | ||
@@ -320,3 +320,3 @@ /** | ||
*/ | ||
matches(regex: any): any; | ||
matches(regex: any): ValidationGroup; | ||
@@ -329,10 +329,10 @@ /** | ||
*/ | ||
passes(customFunction: any, threshold: any): any; | ||
passes(customFunction: Function, threshold: any): ValidationGroup; | ||
/** | ||
* Adds the {ValidationRule} | ||
* @param validationRule {ValudationRule} The rule that needs to pass | ||
* @param validationRule {ValidationRule} The rule that needs to pass | ||
* @returns {ValidationGroup} returns this ValidationGroup, to enable fluent API | ||
*/ | ||
passesRule(validationRule: any): any; | ||
passesRule(validationRule: ValidationRule): ValidationGroup; | ||
@@ -345,3 +345,3 @@ /** | ||
*/ | ||
if(conditionExpression: any, threshold: any): any; | ||
if(conditionExpression: Function, threshold: any): ValidationGroup; | ||
@@ -353,3 +353,3 @@ /** | ||
*/ | ||
else(): any; | ||
else(): ValidationGroup; | ||
@@ -361,3 +361,3 @@ /** | ||
*/ | ||
endIf(): any; | ||
endIf(): ValidationGroup; | ||
@@ -369,3 +369,3 @@ /** | ||
*/ | ||
switch(conditionExpression: any): any; | ||
switch(conditionExpression: Function): ValidationGroup; | ||
@@ -378,3 +378,3 @@ /** | ||
*/ | ||
case(caseLabel: any): any; | ||
case(caseLabel: any): ValidationGroup; | ||
@@ -386,3 +386,3 @@ /** | ||
*/ | ||
default(): any; | ||
default(): ValidationGroup; | ||
@@ -394,3 +394,3 @@ /** | ||
*/ | ||
endSwitch(): any; | ||
endSwitch(): ValidationGroup; | ||
@@ -402,3 +402,3 @@ /** | ||
*/ | ||
withMessage(message: any): any; | ||
withMessage(message: string | ((newValue: any, threshold: any) => any)): any; | ||
} | ||
@@ -437,6 +437,6 @@ export class ValidationLocale { | ||
constructor(group: any); | ||
clear(): any; | ||
onValidate(onValidateCallback: any): any; | ||
notifyObserversOfChange(): any; | ||
setValidity(validationResponse: any, shouldBeDirty: any): any; | ||
clear(): void; | ||
onValidate(onValidateCallback: any): void; | ||
notifyObserversOfChange(): void; | ||
setValidity(validationResponse: any, shouldBeDirty: boolean): void; | ||
} | ||
@@ -479,3 +479,3 @@ export class ValidationRulesCollection { | ||
*/ | ||
validate(currentValue: any, locale: any): any; | ||
validate(currentValue: any, locale: any): Promise<any>; | ||
} | ||
@@ -596,3 +596,3 @@ export class URLValidationRule extends ValidationRule { | ||
*/ | ||
constructor(observerLocator: any, validationConfig: any); | ||
constructor(observerLocator: any, validationConfig: ValidationConfig); | ||
@@ -604,4 +604,4 @@ /** | ||
*/ | ||
on(subject: any, configCallback: any): any; | ||
onBreezeEntity(breezeEntity: any, configCallback: any): any; | ||
on(subject: any, configCallback?: ((conf: ValidationConfig) => void)): ValidationGroup; | ||
onBreezeEntity(breezeEntity: any, configCallback?: ((conf: ValidationConfig) => void)): ValidationGroup; | ||
} | ||
@@ -608,0 +608,0 @@ export class TWBootstrapViewStrategyBase extends ValidationViewStrategy { |
@@ -33,3 +33,3 @@ 'use strict'; | ||
}); | ||
validationMetadata = _aureliaMetadata.metadata.getOwn(_decorators.ValidationMetadata.metadataKey, this.subject); | ||
validationMetadata = _aureliaMetadata.metadata.getOwn(_decorators.ValidationMetadata.metadataKey, Object.getPrototypeOf(this.subject)); | ||
if (validationMetadata) { | ||
@@ -36,0 +36,0 @@ validationMetadata.setup(this); |
@@ -21,3 +21,3 @@ declare module 'aurelia-validation' { | ||
} | ||
export function ensure(setupStep: any): any; | ||
export function ensure(setupStep: ((it: ValidationGroup) => void)): any; | ||
export class PathObserver { | ||
@@ -94,10 +94,10 @@ constructor(observerLocator: any, subject: any, path: any); | ||
matches(regex: any): any; | ||
passes(customFunction: any, threshold: any): any; | ||
passes(customFunction: ((newValue: any, threshold: any) => boolean), threshold: any): any; | ||
passesRule(validationRule: any): any; | ||
checkLast(): any; | ||
withMessage(message: any): any; | ||
if(conditionExpression: any): any; | ||
withMessage(message: string | ((newValue: any, threshold: any) => any)): any; | ||
if(conditionExpression: (() => boolean)): any; | ||
else(): any; | ||
endIf(): any; | ||
switch(conditionExpression: any): any; | ||
switch(conditionExpression: (() => any)): any; | ||
case(caseLabel: any): any; | ||
@@ -122,6 +122,6 @@ default(): any; | ||
constructor(subject: any, observerLocator: any, config: any); | ||
destroy(): any; | ||
destroy(): void; | ||
// TODO: what else needs to be done for proper cleanup? | ||
clear(): any; | ||
clear(): void; | ||
onBreezeEntity(): any; | ||
@@ -133,5 +133,5 @@ | ||
*/ | ||
validate(forceDirty?: any, forceExecution?: any): any; | ||
onValidate(validationFunction: any, validationFunctionFailedCallback: any): any; | ||
onPropertyValidate(validationFunction: any): any; | ||
validate(forceDirty?: boolean, forceExecution?: boolean): Promise<ValidationResult>; | ||
onValidate(validationFunction: (() => any), validationFunctionFailedCallback?: ((a: any, b: any, c: any, d: any, e: any) => any)): ValidationGroup; | ||
onPropertyValidate(validationFunction: any): ValidationGroup; | ||
@@ -144,3 +144,3 @@ /** | ||
*/ | ||
ensure(bindingPath: any, configCallback: any): any; | ||
ensure(bindingPath: string, configCallback?: ((config: ValidationConfig) => void)): ValidationGroup; | ||
@@ -151,3 +151,3 @@ /** | ||
*/ | ||
isNotEmpty(): any; | ||
isNotEmpty(): ValidationGroup; | ||
@@ -158,3 +158,3 @@ /** | ||
*/ | ||
canBeEmpty(): any; | ||
canBeEmpty(): ValidationGroup; | ||
@@ -166,3 +166,3 @@ /** | ||
*/ | ||
isGreaterThanOrEqualTo(minimumValue: any): any; | ||
isGreaterThanOrEqualTo(minimumValue: any): ValidationGroup; | ||
@@ -174,3 +174,3 @@ /** | ||
*/ | ||
isGreaterThan(minimumValue: any): any; | ||
isGreaterThan(minimumValue: any): ValidationGroup; | ||
@@ -183,3 +183,3 @@ /** | ||
*/ | ||
isBetween(minimumValue: any, maximumValue: any): any; | ||
isBetween(minimumValue: any, maximumValue: any): ValidationGroup; | ||
@@ -191,3 +191,3 @@ /** | ||
*/ | ||
isLessThanOrEqualTo(maximumValue: any): any; | ||
isLessThanOrEqualTo(maximumValue: any): ValidationGroup; | ||
@@ -199,3 +199,3 @@ /** | ||
*/ | ||
isLessThan(maximumValue: any): any; | ||
isLessThan(maximumValue: any): ValidationGroup; | ||
@@ -208,3 +208,3 @@ /** | ||
*/ | ||
isEqualTo(otherValue: any, otherValueLabel: any): any; | ||
isEqualTo(otherValue: any, otherValueLabel: any): ValidationGroup; | ||
@@ -217,3 +217,3 @@ /** | ||
*/ | ||
isNotEqualTo(otherValue: any, otherValueLabel: any): any; | ||
isNotEqualTo(otherValue: any, otherValueLabel: any): ValidationGroup; | ||
@@ -224,3 +224,3 @@ /** | ||
*/ | ||
isEmail(): any; | ||
isEmail(): ValidationGroup; | ||
@@ -231,3 +231,3 @@ /** | ||
*/ | ||
isURL(): any; | ||
isURL(): ValidationGroup; | ||
@@ -239,3 +239,3 @@ /** | ||
*/ | ||
isIn(collection: any): any; | ||
isIn(collection: any): ValidationGroup; | ||
@@ -247,3 +247,3 @@ /** | ||
*/ | ||
hasMinLength(minimumValue: any): any; | ||
hasMinLength(minimumValue: number): ValidationGroup; | ||
@@ -255,3 +255,3 @@ /** | ||
*/ | ||
hasMaxLength(maximumValue: any): any; | ||
hasMaxLength(maximumValue: number): ValidationGroup; | ||
@@ -264,3 +264,3 @@ /** | ||
*/ | ||
hasLengthBetween(minimumValue: any, maximumValue: any): any; | ||
hasLengthBetween(minimumValue: number, maximumValue: number): ValidationGroup; | ||
@@ -271,3 +271,3 @@ /** | ||
*/ | ||
isNumber(): any; | ||
isNumber(): ValidationGroup; | ||
@@ -278,3 +278,3 @@ /** | ||
*/ | ||
containsNoSpaces(): any; | ||
containsNoSpaces(): ValidationGroup; | ||
@@ -285,8 +285,8 @@ /** | ||
*/ | ||
containsOnlyDigits(): any; | ||
containsOnly(regex: any): any; | ||
containsOnlyAlpha(): any; | ||
containsOnlyAlphaOrWhitespace(): any; | ||
containsOnlyLetters(): any; | ||
containsOnlyLettersOrWhitespace(): any; | ||
containsOnlyDigits(): ValidationGroup; | ||
containsOnly(regex: any): ValidationGroup; | ||
containsOnlyAlpha(): ValidationGroup; | ||
containsOnlyAlphaOrWhitespace(): ValidationGroup; | ||
containsOnlyLetters(): ValidationGroup; | ||
containsOnlyLettersOrWhitespace(): ValidationGroup; | ||
@@ -297,3 +297,3 @@ /** | ||
*/ | ||
containsOnlyAlphanumerics(): any; | ||
containsOnlyAlphanumerics(): ValidationGroup; | ||
@@ -304,3 +304,3 @@ /** | ||
*/ | ||
containsOnlyAlphanumericsOrWhitespace(): any; | ||
containsOnlyAlphanumericsOrWhitespace(): ValidationGroup; | ||
@@ -312,3 +312,3 @@ /** | ||
*/ | ||
isStrongPassword(minimumComplexityLevel: any): any; | ||
isStrongPassword(minimumComplexityLevel: number): ValidationGroup; | ||
@@ -320,3 +320,3 @@ /** | ||
*/ | ||
matches(regex: any): any; | ||
matches(regex: any): ValidationGroup; | ||
@@ -329,10 +329,10 @@ /** | ||
*/ | ||
passes(customFunction: any, threshold: any): any; | ||
passes(customFunction: Function, threshold: any): ValidationGroup; | ||
/** | ||
* Adds the {ValidationRule} | ||
* @param validationRule {ValudationRule} The rule that needs to pass | ||
* @param validationRule {ValidationRule} The rule that needs to pass | ||
* @returns {ValidationGroup} returns this ValidationGroup, to enable fluent API | ||
*/ | ||
passesRule(validationRule: any): any; | ||
passesRule(validationRule: ValidationRule): ValidationGroup; | ||
@@ -345,3 +345,3 @@ /** | ||
*/ | ||
if(conditionExpression: any, threshold: any): any; | ||
if(conditionExpression: Function, threshold: any): ValidationGroup; | ||
@@ -353,3 +353,3 @@ /** | ||
*/ | ||
else(): any; | ||
else(): ValidationGroup; | ||
@@ -361,3 +361,3 @@ /** | ||
*/ | ||
endIf(): any; | ||
endIf(): ValidationGroup; | ||
@@ -369,3 +369,3 @@ /** | ||
*/ | ||
switch(conditionExpression: any): any; | ||
switch(conditionExpression: Function): ValidationGroup; | ||
@@ -378,3 +378,3 @@ /** | ||
*/ | ||
case(caseLabel: any): any; | ||
case(caseLabel: any): ValidationGroup; | ||
@@ -386,3 +386,3 @@ /** | ||
*/ | ||
default(): any; | ||
default(): ValidationGroup; | ||
@@ -394,3 +394,3 @@ /** | ||
*/ | ||
endSwitch(): any; | ||
endSwitch(): ValidationGroup; | ||
@@ -402,3 +402,3 @@ /** | ||
*/ | ||
withMessage(message: any): any; | ||
withMessage(message: string | ((newValue: any, threshold: any) => any)): any; | ||
} | ||
@@ -437,6 +437,6 @@ export class ValidationLocale { | ||
constructor(group: any); | ||
clear(): any; | ||
onValidate(onValidateCallback: any): any; | ||
notifyObserversOfChange(): any; | ||
setValidity(validationResponse: any, shouldBeDirty: any): any; | ||
clear(): void; | ||
onValidate(onValidateCallback: any): void; | ||
notifyObserversOfChange(): void; | ||
setValidity(validationResponse: any, shouldBeDirty: boolean): void; | ||
} | ||
@@ -479,3 +479,3 @@ export class ValidationRulesCollection { | ||
*/ | ||
validate(currentValue: any, locale: any): any; | ||
validate(currentValue: any, locale: any): Promise<any>; | ||
} | ||
@@ -596,3 +596,3 @@ export class URLValidationRule extends ValidationRule { | ||
*/ | ||
constructor(observerLocator: any, validationConfig: any); | ||
constructor(observerLocator: any, validationConfig: ValidationConfig); | ||
@@ -604,4 +604,4 @@ /** | ||
*/ | ||
on(subject: any, configCallback: any): any; | ||
onBreezeEntity(breezeEntity: any, configCallback: any): any; | ||
on(subject: any, configCallback?: ((conf: ValidationConfig) => void)): ValidationGroup; | ||
onBreezeEntity(breezeEntity: any, configCallback?: ((conf: ValidationConfig) => void)): ValidationGroup; | ||
} | ||
@@ -608,0 +608,0 @@ export class TWBootstrapViewStrategyBase extends ValidationViewStrategy { |
@@ -38,3 +38,3 @@ import {metadata} from 'aurelia-metadata'; | ||
export function ensure(setupStep) { | ||
export function ensure(setupStep: (it: ValidationGroup) => void) { | ||
return function(target, propertyName) { | ||
@@ -41,0 +41,0 @@ let validationMetadata = metadata.getOrCreateOwn(ValidationMetadata.metadataKey, ValidationMetadata, target); |
@@ -178,3 +178,3 @@ import {SwitchCaseValidationRulesCollection} from './validation-rules-collection'; | ||
passes(customFunction, threshold) { | ||
passes(customFunction: (newValue: any, threshold: any) => boolean, threshold: any) { | ||
return this.passesRule(new CustomFunctionValidationRule(customFunction, threshold)); | ||
@@ -194,3 +194,3 @@ } | ||
withMessage(message) { | ||
withMessage(message: string | (newValue: any, threshold: any) => any) { | ||
this.validationRuleCollections[0].withMessage(message); | ||
@@ -201,3 +201,3 @@ this.checkLast(); | ||
if(conditionExpression) { | ||
if(conditionExpression: () => boolean) { | ||
//IF is treated as a 'switch' with case 'true' and 'default' | ||
@@ -228,3 +228,3 @@ let conditionalCollection = new SwitchCaseValidationRulesCollection(conditionExpression); | ||
switch(conditionExpression) { | ||
switch(conditionExpression: () => any) { | ||
let condition = conditionExpression; | ||
@@ -231,0 +231,0 @@ if (condition === undefined) { |
@@ -31,3 +31,3 @@ import {metadata} from 'aurelia-metadata'; | ||
}); | ||
validationMetadata = metadata.getOwn(ValidationMetadata.metadataKey, this.subject); | ||
validationMetadata = metadata.getOwn(ValidationMetadata.metadataKey, Object.getPrototypeOf(this.subject)); | ||
if (validationMetadata) { | ||
@@ -38,3 +38,3 @@ validationMetadata.setup(this); | ||
destroy() { | ||
destroy(): void { | ||
this.validationProperties.forEach(prop => { | ||
@@ -47,3 +47,3 @@ prop.destroy(); | ||
clear() { | ||
clear(): void { | ||
this.validationProperties.forEach((prop) => { | ||
@@ -98,3 +98,3 @@ prop.clear(); | ||
*/ | ||
validate(forceDirty = true, forceExecution = true) { | ||
validate(forceDirty: boolean = true, forceExecution: boolean = true): Promise<ValidationResult> { | ||
this.isValidating = true; | ||
@@ -172,3 +172,3 @@ let promise = Promise.resolve(true); | ||
onValidate(validationFunction, validationFunctionFailedCallback) { | ||
onValidate(validationFunction: () => any, validationFunctionFailedCallback?: (a: any, b: any, c: any, d: any, e: any) => any): ValidationGroup { | ||
this.onValidateCallbacks.push({validationFunction, validationFunctionFailedCallback}); | ||
@@ -178,3 +178,3 @@ return this; | ||
onPropertyValidate(validationFunction) { | ||
onPropertyValidate(validationFunction): ValidationGroup { | ||
this.onPropertyValidationCallbacks.push(validationFunction); | ||
@@ -190,3 +190,3 @@ return this; | ||
*/ | ||
ensure(bindingPath, configCallback) { | ||
ensure(bindingPath: string, configCallback?: (config: ValidationConfig) => void): ValidationGroup { | ||
this.builder.ensure(bindingPath, configCallback); | ||
@@ -203,3 +203,3 @@ this.onPropertyValidationCallbacks.forEach((callback) => { | ||
*/ | ||
isNotEmpty() { | ||
isNotEmpty(): ValidationGroup { | ||
return this.builder.isNotEmpty(); | ||
@@ -212,3 +212,3 @@ } | ||
*/ | ||
canBeEmpty() { | ||
canBeEmpty(): ValidationGroup { | ||
return this.builder.canBeEmpty(); | ||
@@ -222,3 +222,3 @@ } | ||
*/ | ||
isGreaterThanOrEqualTo(minimumValue) { | ||
isGreaterThanOrEqualTo(minimumValue): ValidationGroup { | ||
return this.builder.isGreaterThanOrEqualTo(minimumValue); | ||
@@ -232,3 +232,3 @@ } | ||
*/ | ||
isGreaterThan(minimumValue) { | ||
isGreaterThan(minimumValue): ValidationGroup { | ||
return this.builder.isGreaterThan(minimumValue); | ||
@@ -243,3 +243,3 @@ } | ||
*/ | ||
isBetween(minimumValue, maximumValue) { | ||
isBetween(minimumValue, maximumValue): ValidationGroup { | ||
return this.builder.isBetween(minimumValue, maximumValue); | ||
@@ -253,3 +253,3 @@ } | ||
*/ | ||
isLessThanOrEqualTo(maximumValue) { | ||
isLessThanOrEqualTo(maximumValue): ValidationGroup { | ||
return this.builder.isLessThanOrEqualTo(maximumValue); | ||
@@ -263,3 +263,3 @@ } | ||
*/ | ||
isLessThan(maximumValue) { | ||
isLessThan(maximumValue): ValidationGroup { | ||
return this.builder.isLessThan(maximumValue); | ||
@@ -274,3 +274,3 @@ } | ||
*/ | ||
isEqualTo(otherValue, otherValueLabel) { | ||
isEqualTo(otherValue, otherValueLabel): ValidationGroup { | ||
return this.builder.isEqualTo(otherValue, otherValueLabel); | ||
@@ -285,3 +285,3 @@ } | ||
*/ | ||
isNotEqualTo(otherValue, otherValueLabel) { | ||
isNotEqualTo(otherValue, otherValueLabel): ValidationGroup { | ||
return this.builder.isNotEqualTo(otherValue, otherValueLabel); | ||
@@ -294,3 +294,3 @@ } | ||
*/ | ||
isEmail() { | ||
isEmail(): ValidationGroup { | ||
return this.builder.isEmail(); | ||
@@ -303,3 +303,3 @@ } | ||
*/ | ||
isURL() { | ||
isURL(): ValidationGroup { | ||
return this.builder.isURL(); | ||
@@ -313,3 +313,3 @@ } | ||
*/ | ||
isIn(collection) { | ||
isIn(collection): ValidationGroup { | ||
return this.builder.isIn(collection); | ||
@@ -323,3 +323,3 @@ } | ||
*/ | ||
hasMinLength(minimumValue) { | ||
hasMinLength(minimumValue: number): ValidationGroup { | ||
return this.builder.hasMinLength(minimumValue); | ||
@@ -333,3 +333,3 @@ } | ||
*/ | ||
hasMaxLength(maximumValue) { | ||
hasMaxLength(maximumValue: number): ValidationGroup { | ||
return this.builder.hasMaxLength(maximumValue); | ||
@@ -344,3 +344,3 @@ } | ||
*/ | ||
hasLengthBetween(minimumValue, maximumValue) { | ||
hasLengthBetween(minimumValue: number, maximumValue: number): ValidationGroup { | ||
return this.builder.hasLengthBetween(minimumValue, maximumValue); | ||
@@ -353,3 +353,3 @@ } | ||
*/ | ||
isNumber() { | ||
isNumber(): ValidationGroup { | ||
return this.builder.isNumber(); | ||
@@ -362,3 +362,3 @@ } | ||
*/ | ||
containsNoSpaces() { | ||
containsNoSpaces(): ValidationGroup { | ||
return this.builder.containsNoSpaces(); | ||
@@ -371,23 +371,23 @@ } | ||
*/ | ||
containsOnlyDigits() { | ||
containsOnlyDigits(): ValidationGroup { | ||
return this.builder.containsOnlyDigits(); | ||
} | ||
containsOnly(regex) { | ||
containsOnly(regex): ValidationGroup { | ||
return this.builder.containsOnly(regex); | ||
} | ||
containsOnlyAlpha() { | ||
containsOnlyAlpha(): ValidationGroup { | ||
return this.builder.containsOnlyAlpha(); | ||
} | ||
containsOnlyAlphaOrWhitespace() { | ||
containsOnlyAlphaOrWhitespace(): ValidationGroup { | ||
return this.builder.containsOnlyAlphaOrWhitespace(); | ||
} | ||
containsOnlyLetters() { | ||
containsOnlyLetters(): ValidationGroup { | ||
return this.builder.containsOnlyAlpha(); | ||
} | ||
containsOnlyLettersOrWhitespace() { | ||
containsOnlyLettersOrWhitespace(): ValidationGroup { | ||
return this.builder.containsOnlyAlphaOrWhitespace(); | ||
@@ -400,3 +400,3 @@ } | ||
*/ | ||
containsOnlyAlphanumerics() { | ||
containsOnlyAlphanumerics(): ValidationGroup { | ||
return this.builder.containsOnlyAlphanumerics(); | ||
@@ -409,3 +409,3 @@ } | ||
*/ | ||
containsOnlyAlphanumericsOrWhitespace() { | ||
containsOnlyAlphanumericsOrWhitespace(): ValidationGroup { | ||
return this.builder.containsOnlyAlphanumericsOrWhitespace(); | ||
@@ -419,3 +419,3 @@ } | ||
*/ | ||
isStrongPassword(minimumComplexityLevel) { | ||
isStrongPassword(minimumComplexityLevel: number): ValidationGroup { | ||
return this.builder.isStrongPassword(minimumComplexityLevel); | ||
@@ -429,3 +429,3 @@ } | ||
*/ | ||
matches(regex) { | ||
matches(regex): ValidationGroup { | ||
return this.builder.matches(regex); | ||
@@ -440,3 +440,3 @@ } | ||
*/ | ||
passes(customFunction, threshold) { | ||
passes(customFunction: Function, threshold: any): ValidationGroup { | ||
return this.builder.passes(customFunction, threshold); | ||
@@ -447,6 +447,6 @@ } | ||
* Adds the {ValidationRule} | ||
* @param validationRule {ValudationRule} The rule that needs to pass | ||
* @param validationRule {ValidationRule} The rule that needs to pass | ||
* @returns {ValidationGroup} returns this ValidationGroup, to enable fluent API | ||
*/ | ||
passesRule(validationRule) { | ||
passesRule(validationRule: ValidationRule): ValidationGroup { | ||
return this.builder.passesRule(validationRule); | ||
@@ -461,3 +461,3 @@ } | ||
*/ | ||
if(conditionExpression, threshold) { | ||
if(conditionExpression: Function, threshold: any): ValidationGroup { | ||
return this.builder.if(conditionExpression, threshold); | ||
@@ -471,3 +471,3 @@ } | ||
*/ | ||
else() { | ||
else(): ValidationGroup { | ||
return this.builder.else(); | ||
@@ -481,3 +481,3 @@ } | ||
*/ | ||
endIf() { | ||
endIf(): ValidationGroup { | ||
return this.builder.endIf(); | ||
@@ -491,3 +491,3 @@ } | ||
*/ | ||
switch(conditionExpression) { | ||
switch(conditionExpression: Function): ValidationGroup { | ||
return this.builder.switch(conditionExpression); | ||
@@ -502,3 +502,3 @@ } | ||
*/ | ||
case(caseLabel) { | ||
case(caseLabel: any): ValidationGroup { | ||
return this.builder.case(caseLabel); | ||
@@ -512,3 +512,3 @@ } | ||
*/ | ||
default() { | ||
default(): ValidationGroup { | ||
return this.builder.default(); | ||
@@ -522,3 +522,3 @@ } | ||
*/ | ||
endSwitch() { | ||
endSwitch(): ValidationGroup { | ||
return this.builder.endSwitch(); | ||
@@ -532,5 +532,5 @@ } | ||
*/ | ||
withMessage(message) { | ||
withMessage(message: string | (newValue: any, threshold: any) => any) { | ||
return this.builder.withMessage(message); | ||
} | ||
} |
@@ -32,3 +32,3 @@ export class ValidationResult { | ||
} | ||
clear() { | ||
clear(): void { | ||
this.isValid = true; | ||
@@ -41,6 +41,6 @@ this.isDirty = false; | ||
} | ||
onValidate(onValidateCallback) { | ||
onValidate(onValidateCallback): void { | ||
this.onValidateCallbacks.push(onValidateCallback); | ||
} | ||
notifyObserversOfChange() { | ||
notifyObserversOfChange(): void { | ||
for (let i = 0; i < this.onValidateCallbacks.length; i++) { | ||
@@ -51,3 +51,3 @@ let callback = this.onValidateCallbacks[i]; | ||
} | ||
setValidity(validationResponse, shouldBeDirty) { | ||
setValidity(validationResponse, shouldBeDirty: boolean): void { | ||
let notifyObservers = (!this.isDirty && shouldBeDirty) | ||
@@ -54,0 +54,0 @@ || (this.isValid !== validationResponse.isValid) |
@@ -47,3 +47,3 @@ import {Utilities} from './utilities'; | ||
*/ | ||
validate(currentValue, locale) { | ||
validate(currentValue, locale): Promise<any> { | ||
if (locale === undefined) { | ||
@@ -50,0 +50,0 @@ locale = ValidationLocale.Repository.default; |
@@ -18,3 +18,3 @@ import {ObserverLocator} from 'aurelia-binding'; | ||
*/ | ||
constructor(observerLocator, validationConfig) { | ||
constructor(observerLocator, validationConfig: ValidationConfig) { | ||
this.observerLocator = observerLocator; | ||
@@ -29,3 +29,3 @@ this.config = validationConfig ? validationConfig : Validation.defaults; | ||
*/ | ||
on(subject, configCallback) { | ||
on(subject: any, configCallback? : (conf: ValidationConfig) => void): ValidationGroup { | ||
let conf = new ValidationConfig(this.config); | ||
@@ -37,3 +37,3 @@ if (configCallback !== null && configCallback !== undefined && typeof(configCallback) === 'function') { | ||
} | ||
onBreezeEntity(breezeEntity, configCallback) { | ||
onBreezeEntity(breezeEntity, configCallback? : (conf: ValidationConfig) => void): ValidationGroup { | ||
let validation = this.on(breezeEntity, configCallback); | ||
@@ -40,0 +40,0 @@ validation.onBreezeEntity(); |
@@ -21,3 +21,3 @@ declare module 'aurelia-validation' { | ||
} | ||
export function ensure(setupStep: any): any; | ||
export function ensure(setupStep: ((it: ValidationGroup) => void)): any; | ||
export class PathObserver { | ||
@@ -94,10 +94,10 @@ constructor(observerLocator: any, subject: any, path: any); | ||
matches(regex: any): any; | ||
passes(customFunction: any, threshold: any): any; | ||
passes(customFunction: ((newValue: any, threshold: any) => boolean), threshold: any): any; | ||
passesRule(validationRule: any): any; | ||
checkLast(): any; | ||
withMessage(message: any): any; | ||
if(conditionExpression: any): any; | ||
withMessage(message: string | ((newValue: any, threshold: any) => any)): any; | ||
if(conditionExpression: (() => boolean)): any; | ||
else(): any; | ||
endIf(): any; | ||
switch(conditionExpression: any): any; | ||
switch(conditionExpression: (() => any)): any; | ||
case(caseLabel: any): any; | ||
@@ -122,6 +122,6 @@ default(): any; | ||
constructor(subject: any, observerLocator: any, config: any); | ||
destroy(): any; | ||
destroy(): void; | ||
// TODO: what else needs to be done for proper cleanup? | ||
clear(): any; | ||
clear(): void; | ||
onBreezeEntity(): any; | ||
@@ -133,5 +133,5 @@ | ||
*/ | ||
validate(forceDirty?: any, forceExecution?: any): any; | ||
onValidate(validationFunction: any, validationFunctionFailedCallback: any): any; | ||
onPropertyValidate(validationFunction: any): any; | ||
validate(forceDirty?: boolean, forceExecution?: boolean): Promise<ValidationResult>; | ||
onValidate(validationFunction: (() => any), validationFunctionFailedCallback?: ((a: any, b: any, c: any, d: any, e: any) => any)): ValidationGroup; | ||
onPropertyValidate(validationFunction: any): ValidationGroup; | ||
@@ -144,3 +144,3 @@ /** | ||
*/ | ||
ensure(bindingPath: any, configCallback: any): any; | ||
ensure(bindingPath: string, configCallback?: ((config: ValidationConfig) => void)): ValidationGroup; | ||
@@ -151,3 +151,3 @@ /** | ||
*/ | ||
isNotEmpty(): any; | ||
isNotEmpty(): ValidationGroup; | ||
@@ -158,3 +158,3 @@ /** | ||
*/ | ||
canBeEmpty(): any; | ||
canBeEmpty(): ValidationGroup; | ||
@@ -166,3 +166,3 @@ /** | ||
*/ | ||
isGreaterThanOrEqualTo(minimumValue: any): any; | ||
isGreaterThanOrEqualTo(minimumValue: any): ValidationGroup; | ||
@@ -174,3 +174,3 @@ /** | ||
*/ | ||
isGreaterThan(minimumValue: any): any; | ||
isGreaterThan(minimumValue: any): ValidationGroup; | ||
@@ -183,3 +183,3 @@ /** | ||
*/ | ||
isBetween(minimumValue: any, maximumValue: any): any; | ||
isBetween(minimumValue: any, maximumValue: any): ValidationGroup; | ||
@@ -191,3 +191,3 @@ /** | ||
*/ | ||
isLessThanOrEqualTo(maximumValue: any): any; | ||
isLessThanOrEqualTo(maximumValue: any): ValidationGroup; | ||
@@ -199,3 +199,3 @@ /** | ||
*/ | ||
isLessThan(maximumValue: any): any; | ||
isLessThan(maximumValue: any): ValidationGroup; | ||
@@ -208,3 +208,3 @@ /** | ||
*/ | ||
isEqualTo(otherValue: any, otherValueLabel: any): any; | ||
isEqualTo(otherValue: any, otherValueLabel: any): ValidationGroup; | ||
@@ -217,3 +217,3 @@ /** | ||
*/ | ||
isNotEqualTo(otherValue: any, otherValueLabel: any): any; | ||
isNotEqualTo(otherValue: any, otherValueLabel: any): ValidationGroup; | ||
@@ -224,3 +224,3 @@ /** | ||
*/ | ||
isEmail(): any; | ||
isEmail(): ValidationGroup; | ||
@@ -231,3 +231,3 @@ /** | ||
*/ | ||
isURL(): any; | ||
isURL(): ValidationGroup; | ||
@@ -239,3 +239,3 @@ /** | ||
*/ | ||
isIn(collection: any): any; | ||
isIn(collection: any): ValidationGroup; | ||
@@ -247,3 +247,3 @@ /** | ||
*/ | ||
hasMinLength(minimumValue: any): any; | ||
hasMinLength(minimumValue: number): ValidationGroup; | ||
@@ -255,3 +255,3 @@ /** | ||
*/ | ||
hasMaxLength(maximumValue: any): any; | ||
hasMaxLength(maximumValue: number): ValidationGroup; | ||
@@ -264,3 +264,3 @@ /** | ||
*/ | ||
hasLengthBetween(minimumValue: any, maximumValue: any): any; | ||
hasLengthBetween(minimumValue: number, maximumValue: number): ValidationGroup; | ||
@@ -271,3 +271,3 @@ /** | ||
*/ | ||
isNumber(): any; | ||
isNumber(): ValidationGroup; | ||
@@ -278,3 +278,3 @@ /** | ||
*/ | ||
containsNoSpaces(): any; | ||
containsNoSpaces(): ValidationGroup; | ||
@@ -285,8 +285,8 @@ /** | ||
*/ | ||
containsOnlyDigits(): any; | ||
containsOnly(regex: any): any; | ||
containsOnlyAlpha(): any; | ||
containsOnlyAlphaOrWhitespace(): any; | ||
containsOnlyLetters(): any; | ||
containsOnlyLettersOrWhitespace(): any; | ||
containsOnlyDigits(): ValidationGroup; | ||
containsOnly(regex: any): ValidationGroup; | ||
containsOnlyAlpha(): ValidationGroup; | ||
containsOnlyAlphaOrWhitespace(): ValidationGroup; | ||
containsOnlyLetters(): ValidationGroup; | ||
containsOnlyLettersOrWhitespace(): ValidationGroup; | ||
@@ -297,3 +297,3 @@ /** | ||
*/ | ||
containsOnlyAlphanumerics(): any; | ||
containsOnlyAlphanumerics(): ValidationGroup; | ||
@@ -304,3 +304,3 @@ /** | ||
*/ | ||
containsOnlyAlphanumericsOrWhitespace(): any; | ||
containsOnlyAlphanumericsOrWhitespace(): ValidationGroup; | ||
@@ -312,3 +312,3 @@ /** | ||
*/ | ||
isStrongPassword(minimumComplexityLevel: any): any; | ||
isStrongPassword(minimumComplexityLevel: number): ValidationGroup; | ||
@@ -320,3 +320,3 @@ /** | ||
*/ | ||
matches(regex: any): any; | ||
matches(regex: any): ValidationGroup; | ||
@@ -329,10 +329,10 @@ /** | ||
*/ | ||
passes(customFunction: any, threshold: any): any; | ||
passes(customFunction: Function, threshold: any): ValidationGroup; | ||
/** | ||
* Adds the {ValidationRule} | ||
* @param validationRule {ValudationRule} The rule that needs to pass | ||
* @param validationRule {ValidationRule} The rule that needs to pass | ||
* @returns {ValidationGroup} returns this ValidationGroup, to enable fluent API | ||
*/ | ||
passesRule(validationRule: any): any; | ||
passesRule(validationRule: ValidationRule): ValidationGroup; | ||
@@ -345,3 +345,3 @@ /** | ||
*/ | ||
if(conditionExpression: any, threshold: any): any; | ||
if(conditionExpression: Function, threshold: any): ValidationGroup; | ||
@@ -353,3 +353,3 @@ /** | ||
*/ | ||
else(): any; | ||
else(): ValidationGroup; | ||
@@ -361,3 +361,3 @@ /** | ||
*/ | ||
endIf(): any; | ||
endIf(): ValidationGroup; | ||
@@ -369,3 +369,3 @@ /** | ||
*/ | ||
switch(conditionExpression: any): any; | ||
switch(conditionExpression: Function): ValidationGroup; | ||
@@ -378,3 +378,3 @@ /** | ||
*/ | ||
case(caseLabel: any): any; | ||
case(caseLabel: any): ValidationGroup; | ||
@@ -386,3 +386,3 @@ /** | ||
*/ | ||
default(): any; | ||
default(): ValidationGroup; | ||
@@ -394,3 +394,3 @@ /** | ||
*/ | ||
endSwitch(): any; | ||
endSwitch(): ValidationGroup; | ||
@@ -402,3 +402,3 @@ /** | ||
*/ | ||
withMessage(message: any): any; | ||
withMessage(message: string | ((newValue: any, threshold: any) => any)): any; | ||
} | ||
@@ -437,6 +437,6 @@ export class ValidationLocale { | ||
constructor(group: any); | ||
clear(): any; | ||
onValidate(onValidateCallback: any): any; | ||
notifyObserversOfChange(): any; | ||
setValidity(validationResponse: any, shouldBeDirty: any): any; | ||
clear(): void; | ||
onValidate(onValidateCallback: any): void; | ||
notifyObserversOfChange(): void; | ||
setValidity(validationResponse: any, shouldBeDirty: boolean): void; | ||
} | ||
@@ -479,3 +479,3 @@ export class ValidationRulesCollection { | ||
*/ | ||
validate(currentValue: any, locale: any): any; | ||
validate(currentValue: any, locale: any): Promise<any>; | ||
} | ||
@@ -596,3 +596,3 @@ export class URLValidationRule extends ValidationRule { | ||
*/ | ||
constructor(observerLocator: any, validationConfig: any); | ||
constructor(observerLocator: any, validationConfig: ValidationConfig); | ||
@@ -604,4 +604,4 @@ /** | ||
*/ | ||
on(subject: any, configCallback: any): any; | ||
onBreezeEntity(breezeEntity: any, configCallback: any): any; | ||
on(subject: any, configCallback?: ((conf: ValidationConfig) => void)): ValidationGroup; | ||
onBreezeEntity(breezeEntity: any, configCallback?: ((conf: ValidationConfig) => void)): ValidationGroup; | ||
} | ||
@@ -608,0 +608,0 @@ export class TWBootstrapViewStrategyBase extends ValidationViewStrategy { |
@@ -37,3 +37,3 @@ System.register(['aurelia-metadata', './validation-group-builder', './validation-result', './decorators'], function (_export) { | ||
}); | ||
validationMetadata = metadata.getOwn(ValidationMetadata.metadataKey, this.subject); | ||
validationMetadata = metadata.getOwn(ValidationMetadata.metadataKey, Object.getPrototypeOf(this.subject)); | ||
if (validationMetadata) { | ||
@@ -40,0 +40,0 @@ validationMetadata.setup(this); |
@@ -0,1 +1,11 @@ | ||
### 0.6.3 (2016-03-01) | ||
#### Features | ||
* **I18N:** | ||
* update pt-BR ([f0dd26d4](https://github.com/aurelia/validation/commit/f0dd26d4545ce378bd297d69b03c60e1be2157d7)) | ||
* add pt-BR ([f684272e](https://github.com/aurelia/validation/commit/f684272ef9fa32a1e2a8970426526d3c01e4ef67)) | ||
### 0.6.2 (2016-02-08) | ||
@@ -2,0 +12,0 @@ |
{ | ||
"name": "aurelia-validation", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"description": "A validation plugin for Aurelia.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -38,3 +38,3 @@ import {metadata} from 'aurelia-metadata'; | ||
export function ensure(setupStep) { | ||
export function ensure(setupStep: (it: ValidationGroup) => void) { | ||
return function(target, propertyName) { | ||
@@ -41,0 +41,0 @@ let validationMetadata = metadata.getOrCreateOwn(ValidationMetadata.metadataKey, ValidationMetadata, target); |
@@ -178,3 +178,3 @@ import {SwitchCaseValidationRulesCollection} from './validation-rules-collection'; | ||
passes(customFunction, threshold) { | ||
passes(customFunction: (newValue: any, threshold: any) => boolean, threshold: any) { | ||
return this.passesRule(new CustomFunctionValidationRule(customFunction, threshold)); | ||
@@ -194,3 +194,3 @@ } | ||
withMessage(message) { | ||
withMessage(message: string | (newValue: any, threshold: any) => any) { | ||
this.validationRuleCollections[0].withMessage(message); | ||
@@ -201,3 +201,3 @@ this.checkLast(); | ||
if(conditionExpression) { | ||
if(conditionExpression: () => boolean) { | ||
//IF is treated as a 'switch' with case 'true' and 'default' | ||
@@ -228,3 +228,3 @@ let conditionalCollection = new SwitchCaseValidationRulesCollection(conditionExpression); | ||
switch(conditionExpression) { | ||
switch(conditionExpression: () => any) { | ||
let condition = conditionExpression; | ||
@@ -231,0 +231,0 @@ if (condition === undefined) { |
@@ -31,3 +31,3 @@ import {metadata} from 'aurelia-metadata'; | ||
}); | ||
validationMetadata = metadata.getOwn(ValidationMetadata.metadataKey, this.subject); | ||
validationMetadata = metadata.getOwn(ValidationMetadata.metadataKey, Object.getPrototypeOf(this.subject)); | ||
if (validationMetadata) { | ||
@@ -38,3 +38,3 @@ validationMetadata.setup(this); | ||
destroy() { | ||
destroy(): void { | ||
this.validationProperties.forEach(prop => { | ||
@@ -47,3 +47,3 @@ prop.destroy(); | ||
clear() { | ||
clear(): void { | ||
this.validationProperties.forEach((prop) => { | ||
@@ -98,3 +98,3 @@ prop.clear(); | ||
*/ | ||
validate(forceDirty = true, forceExecution = true) { | ||
validate(forceDirty: boolean = true, forceExecution: boolean = true): Promise<ValidationResult> { | ||
this.isValidating = true; | ||
@@ -172,3 +172,3 @@ let promise = Promise.resolve(true); | ||
onValidate(validationFunction, validationFunctionFailedCallback) { | ||
onValidate(validationFunction: () => any, validationFunctionFailedCallback?: (a: any, b: any, c: any, d: any, e: any) => any): ValidationGroup { | ||
this.onValidateCallbacks.push({validationFunction, validationFunctionFailedCallback}); | ||
@@ -178,3 +178,3 @@ return this; | ||
onPropertyValidate(validationFunction) { | ||
onPropertyValidate(validationFunction): ValidationGroup { | ||
this.onPropertyValidationCallbacks.push(validationFunction); | ||
@@ -190,3 +190,3 @@ return this; | ||
*/ | ||
ensure(bindingPath, configCallback) { | ||
ensure(bindingPath: string, configCallback?: (config: ValidationConfig) => void): ValidationGroup { | ||
this.builder.ensure(bindingPath, configCallback); | ||
@@ -203,3 +203,3 @@ this.onPropertyValidationCallbacks.forEach((callback) => { | ||
*/ | ||
isNotEmpty() { | ||
isNotEmpty(): ValidationGroup { | ||
return this.builder.isNotEmpty(); | ||
@@ -212,3 +212,3 @@ } | ||
*/ | ||
canBeEmpty() { | ||
canBeEmpty(): ValidationGroup { | ||
return this.builder.canBeEmpty(); | ||
@@ -222,3 +222,3 @@ } | ||
*/ | ||
isGreaterThanOrEqualTo(minimumValue) { | ||
isGreaterThanOrEqualTo(minimumValue): ValidationGroup { | ||
return this.builder.isGreaterThanOrEqualTo(minimumValue); | ||
@@ -232,3 +232,3 @@ } | ||
*/ | ||
isGreaterThan(minimumValue) { | ||
isGreaterThan(minimumValue): ValidationGroup { | ||
return this.builder.isGreaterThan(minimumValue); | ||
@@ -243,3 +243,3 @@ } | ||
*/ | ||
isBetween(minimumValue, maximumValue) { | ||
isBetween(minimumValue, maximumValue): ValidationGroup { | ||
return this.builder.isBetween(minimumValue, maximumValue); | ||
@@ -253,3 +253,3 @@ } | ||
*/ | ||
isLessThanOrEqualTo(maximumValue) { | ||
isLessThanOrEqualTo(maximumValue): ValidationGroup { | ||
return this.builder.isLessThanOrEqualTo(maximumValue); | ||
@@ -263,3 +263,3 @@ } | ||
*/ | ||
isLessThan(maximumValue) { | ||
isLessThan(maximumValue): ValidationGroup { | ||
return this.builder.isLessThan(maximumValue); | ||
@@ -274,3 +274,3 @@ } | ||
*/ | ||
isEqualTo(otherValue, otherValueLabel) { | ||
isEqualTo(otherValue, otherValueLabel): ValidationGroup { | ||
return this.builder.isEqualTo(otherValue, otherValueLabel); | ||
@@ -285,3 +285,3 @@ } | ||
*/ | ||
isNotEqualTo(otherValue, otherValueLabel) { | ||
isNotEqualTo(otherValue, otherValueLabel): ValidationGroup { | ||
return this.builder.isNotEqualTo(otherValue, otherValueLabel); | ||
@@ -294,3 +294,3 @@ } | ||
*/ | ||
isEmail() { | ||
isEmail(): ValidationGroup { | ||
return this.builder.isEmail(); | ||
@@ -303,3 +303,3 @@ } | ||
*/ | ||
isURL() { | ||
isURL(): ValidationGroup { | ||
return this.builder.isURL(); | ||
@@ -313,3 +313,3 @@ } | ||
*/ | ||
isIn(collection) { | ||
isIn(collection): ValidationGroup { | ||
return this.builder.isIn(collection); | ||
@@ -323,3 +323,3 @@ } | ||
*/ | ||
hasMinLength(minimumValue) { | ||
hasMinLength(minimumValue: number): ValidationGroup { | ||
return this.builder.hasMinLength(minimumValue); | ||
@@ -333,3 +333,3 @@ } | ||
*/ | ||
hasMaxLength(maximumValue) { | ||
hasMaxLength(maximumValue: number): ValidationGroup { | ||
return this.builder.hasMaxLength(maximumValue); | ||
@@ -344,3 +344,3 @@ } | ||
*/ | ||
hasLengthBetween(minimumValue, maximumValue) { | ||
hasLengthBetween(minimumValue: number, maximumValue: number): ValidationGroup { | ||
return this.builder.hasLengthBetween(minimumValue, maximumValue); | ||
@@ -353,3 +353,3 @@ } | ||
*/ | ||
isNumber() { | ||
isNumber(): ValidationGroup { | ||
return this.builder.isNumber(); | ||
@@ -362,3 +362,3 @@ } | ||
*/ | ||
containsNoSpaces() { | ||
containsNoSpaces(): ValidationGroup { | ||
return this.builder.containsNoSpaces(); | ||
@@ -371,23 +371,23 @@ } | ||
*/ | ||
containsOnlyDigits() { | ||
containsOnlyDigits(): ValidationGroup { | ||
return this.builder.containsOnlyDigits(); | ||
} | ||
containsOnly(regex) { | ||
containsOnly(regex): ValidationGroup { | ||
return this.builder.containsOnly(regex); | ||
} | ||
containsOnlyAlpha() { | ||
containsOnlyAlpha(): ValidationGroup { | ||
return this.builder.containsOnlyAlpha(); | ||
} | ||
containsOnlyAlphaOrWhitespace() { | ||
containsOnlyAlphaOrWhitespace(): ValidationGroup { | ||
return this.builder.containsOnlyAlphaOrWhitespace(); | ||
} | ||
containsOnlyLetters() { | ||
containsOnlyLetters(): ValidationGroup { | ||
return this.builder.containsOnlyAlpha(); | ||
} | ||
containsOnlyLettersOrWhitespace() { | ||
containsOnlyLettersOrWhitespace(): ValidationGroup { | ||
return this.builder.containsOnlyAlphaOrWhitespace(); | ||
@@ -400,3 +400,3 @@ } | ||
*/ | ||
containsOnlyAlphanumerics() { | ||
containsOnlyAlphanumerics(): ValidationGroup { | ||
return this.builder.containsOnlyAlphanumerics(); | ||
@@ -409,3 +409,3 @@ } | ||
*/ | ||
containsOnlyAlphanumericsOrWhitespace() { | ||
containsOnlyAlphanumericsOrWhitespace(): ValidationGroup { | ||
return this.builder.containsOnlyAlphanumericsOrWhitespace(); | ||
@@ -419,3 +419,3 @@ } | ||
*/ | ||
isStrongPassword(minimumComplexityLevel) { | ||
isStrongPassword(minimumComplexityLevel: number): ValidationGroup { | ||
return this.builder.isStrongPassword(minimumComplexityLevel); | ||
@@ -429,3 +429,3 @@ } | ||
*/ | ||
matches(regex) { | ||
matches(regex): ValidationGroup { | ||
return this.builder.matches(regex); | ||
@@ -440,3 +440,3 @@ } | ||
*/ | ||
passes(customFunction, threshold) { | ||
passes(customFunction: Function, threshold: any): ValidationGroup { | ||
return this.builder.passes(customFunction, threshold); | ||
@@ -447,6 +447,6 @@ } | ||
* Adds the {ValidationRule} | ||
* @param validationRule {ValudationRule} The rule that needs to pass | ||
* @param validationRule {ValidationRule} The rule that needs to pass | ||
* @returns {ValidationGroup} returns this ValidationGroup, to enable fluent API | ||
*/ | ||
passesRule(validationRule) { | ||
passesRule(validationRule: ValidationRule): ValidationGroup { | ||
return this.builder.passesRule(validationRule); | ||
@@ -461,3 +461,3 @@ } | ||
*/ | ||
if(conditionExpression, threshold) { | ||
if(conditionExpression: Function, threshold: any): ValidationGroup { | ||
return this.builder.if(conditionExpression, threshold); | ||
@@ -471,3 +471,3 @@ } | ||
*/ | ||
else() { | ||
else(): ValidationGroup { | ||
return this.builder.else(); | ||
@@ -481,3 +481,3 @@ } | ||
*/ | ||
endIf() { | ||
endIf(): ValidationGroup { | ||
return this.builder.endIf(); | ||
@@ -491,3 +491,3 @@ } | ||
*/ | ||
switch(conditionExpression) { | ||
switch(conditionExpression: Function): ValidationGroup { | ||
return this.builder.switch(conditionExpression); | ||
@@ -502,3 +502,3 @@ } | ||
*/ | ||
case(caseLabel) { | ||
case(caseLabel: any): ValidationGroup { | ||
return this.builder.case(caseLabel); | ||
@@ -512,3 +512,3 @@ } | ||
*/ | ||
default() { | ||
default(): ValidationGroup { | ||
return this.builder.default(); | ||
@@ -522,3 +522,3 @@ } | ||
*/ | ||
endSwitch() { | ||
endSwitch(): ValidationGroup { | ||
return this.builder.endSwitch(); | ||
@@ -532,5 +532,5 @@ } | ||
*/ | ||
withMessage(message) { | ||
withMessage(message: string | (newValue: any, threshold: any) => any) { | ||
return this.builder.withMessage(message); | ||
} | ||
} |
@@ -32,3 +32,3 @@ export class ValidationResult { | ||
} | ||
clear() { | ||
clear(): void { | ||
this.isValid = true; | ||
@@ -41,6 +41,6 @@ this.isDirty = false; | ||
} | ||
onValidate(onValidateCallback) { | ||
onValidate(onValidateCallback): void { | ||
this.onValidateCallbacks.push(onValidateCallback); | ||
} | ||
notifyObserversOfChange() { | ||
notifyObserversOfChange(): void { | ||
for (let i = 0; i < this.onValidateCallbacks.length; i++) { | ||
@@ -51,3 +51,3 @@ let callback = this.onValidateCallbacks[i]; | ||
} | ||
setValidity(validationResponse, shouldBeDirty) { | ||
setValidity(validationResponse, shouldBeDirty: boolean): void { | ||
let notifyObservers = (!this.isDirty && shouldBeDirty) | ||
@@ -54,0 +54,0 @@ || (this.isValid !== validationResponse.isValid) |
@@ -47,3 +47,3 @@ import {Utilities} from './utilities'; | ||
*/ | ||
validate(currentValue, locale) { | ||
validate(currentValue, locale): Promise<any> { | ||
if (locale === undefined) { | ||
@@ -50,0 +50,0 @@ locale = ValidationLocale.Repository.default; |
@@ -18,3 +18,3 @@ import {ObserverLocator} from 'aurelia-binding'; | ||
*/ | ||
constructor(observerLocator, validationConfig) { | ||
constructor(observerLocator, validationConfig: ValidationConfig) { | ||
this.observerLocator = observerLocator; | ||
@@ -29,3 +29,3 @@ this.config = validationConfig ? validationConfig : Validation.defaults; | ||
*/ | ||
on(subject, configCallback) { | ||
on(subject: any, configCallback? : (conf: ValidationConfig) => void): ValidationGroup { | ||
let conf = new ValidationConfig(this.config); | ||
@@ -37,3 +37,3 @@ if (configCallback !== null && configCallback !== undefined && typeof(configCallback) === 'function') { | ||
} | ||
onBreezeEntity(breezeEntity, configCallback) { | ||
onBreezeEntity(breezeEntity, configCallback? : (conf: ValidationConfig) => void): ValidationGroup { | ||
let validation = this.on(breezeEntity, configCallback); | ||
@@ -40,0 +40,0 @@ validation.onBreezeEntity(); |
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
1451993
198
36839