1- import { AccessKeyed , AccessMember , AccessScope , Binary , Binding , BindingBehavior , CallMember , Conditional , Expression , Parser , Scope , ValueConverter } from 'aurelia-binding' ;
1+ import { AccessKeyed , AccessMember , AccessScope , Binary , Binding , BindingBehavior , CallMember , Conditional , Expression , LiteralPrimitive , LiteralString , Parser , Scope , ValueConverter } from 'aurelia-binding' ;
22import { Container , Lazy } from 'aurelia-dependency-injection' ;
33import { DOM } from 'aurelia-pal' ;
44import { TaskQueue } from 'aurelia-task-queue' ;
@@ -27,6 +27,74 @@ export declare class ValidateResult {
2727 constructor ( rule : any , object : any , propertyName : string | number | null , valid : boolean , message ?: string | null ) ;
2828 toString ( ) : string | null ;
2929}
30+ /**
31+ * Validates objects and properties.
32+ */
33+ export declare abstract class Validator {
34+ /**
35+ * Validates the specified property.
36+ * @param object The object to validate.
37+ * @param propertyName The name of the property to validate.
38+ * @param rules Optional. If unspecified, the implementation should lookup the rules for the
39+ * specified object. This may not be possible for all implementations of this interface.
40+ */
41+ abstract validateProperty ( object : any , propertyName : string , rules ?: any ) : Promise < ValidateResult [ ] > ;
42+ /**
43+ * Validates all rules for specified object and it's properties.
44+ * @param object The object to validate.
45+ * @param rules Optional. If unspecified, the implementation should lookup the rules for the
46+ * specified object. This may not be possible for all implementations of this interface.
47+ */
48+ abstract validateObject ( object : any , rules ?: any ) : Promise < ValidateResult [ ] > ;
49+ /**
50+ * Determines whether a rule exists in a set of rules.
51+ * @param rules The rules to search.
52+ * @parem rule The rule to find.
53+ */
54+ abstract ruleExists ( rules : any , rule : any ) : boolean ;
55+ }
56+ /**
57+ * Validation triggers.
58+ */
59+ export declare enum validateTrigger {
60+ /**
61+ * Manual validation. Use the controller's `validate()` and `reset()` methods
62+ * to validate all bindings.
63+ */
64+ manual = 0 ,
65+ /**
66+ * Validate the binding when the binding's target element fires a DOM "blur" event.
67+ */
68+ blur = 1 ,
69+ /**
70+ * Validate the binding when it updates the model due to a change in the view.
71+ */
72+ change = 2 ,
73+ /**
74+ * Validate the binding when the binding's target element fires a DOM "blur" event and
75+ * when it updates the model due to a change in the view.
76+ */
77+ changeOrBlur = 3
78+ }
79+ export declare type ValidatorCtor = new ( ...args : any [ ] ) => Validator ;
80+ /**
81+ * Aurelia Validation Configuration API
82+ */
83+ export declare class GlobalValidationConfiguration {
84+ static DEFAULT_VALIDATION_TRIGGER : validateTrigger ;
85+ private validatorType ;
86+ private validationTrigger ;
87+ /**
88+ * Use a custom Validator implementation.
89+ */
90+ customValidator ( type : ValidatorCtor ) : this;
91+ defaultValidationTrigger ( trigger : validateTrigger ) : this;
92+ getDefaultValidationTrigger ( ) : validateTrigger ;
93+ /**
94+ * Applies the configuration.
95+ */
96+ apply ( container : Container ) : void ;
97+ }
3098/**
3199 * Instructions for the validation controller's validate method.
32100 */
@@ -85,55 +153,6 @@ export declare class PropertyAccessorParser {
85153 parse < TObject , TValue > ( property : string | number | PropertyAccessor < TObject , TValue > ) : string | number ;
86154}
87155export declare function getAccessorExpression ( fn : string ) : string ;
88- /**
89- * Validates objects and properties.
90- */
91- export declare abstract class Validator {
92- /**
93- * Validates the specified property.
94- * @param object The object to validate.
95- * @param propertyName The name of the property to validate.
96- * @param rules Optional. If unspecified, the implementation should lookup the rules for the
97- * specified object. This may not be possible for all implementations of this interface.
98- */
99- abstract validateProperty ( object : any , propertyName : string , rules ?: any ) : Promise < ValidateResult [ ] > ;
100- /**
101- * Validates all rules for specified object and it's properties.
102- * @param object The object to validate.
103- * @param rules Optional. If unspecified, the implementation should lookup the rules for the
104- * specified object. This may not be possible for all implementations of this interface.
105- */
106- abstract validateObject ( object : any , rules ?: any ) : Promise < ValidateResult [ ] > ;
107- /**
108- * Determines whether a rule exists in a set of rules.
109- * @param rules The rules to search.
110- * @parem rule The rule to find.
111- */
112- abstract ruleExists ( rules : any , rule : any ) : boolean ;
113- }
114- /**
115- * Validation triggers.
116- */
117- export declare enum validateTrigger {
118- /**
119- * Manual validation. Use the controller's `validate()` and `reset()` methods
120- * to validate all bindings.
121- */
122- manual = 0 ,
123- /**
124- * Validate the binding when the binding's target element fires a DOM "blur" event.
125- */
126- blur = 1 ,
127- /**
128- * Validate the binding when it updates the model due to a change in the view.
129- */
130- change = 2 ,
131- /**
132- * Validate the binding when the binding's target element fires a DOM "blur" event and
133- * when it updates the model due to a change in the view.
134- */
135- changeOrBlur = 3
136- }
137156/**
138157 * A result to render (or unrender) and the associated elements (if any)
139158 */
@@ -242,7 +261,7 @@ export declare class ValidateEvent {
242261export declare class ValidationController {
243262 private validator ;
244263 private propertyParser ;
245- static inject : ( typeof PropertyAccessorParser | typeof Validator ) [ ] ;
264+ static inject : ( typeof Validator | typeof GlobalValidationConfiguration | typeof PropertyAccessorParser ) [ ] ;
246265 private bindings ;
247266 private renderers ;
248267 /**
@@ -265,7 +284,7 @@ export declare class ValidationController {
265284 validateTrigger : validateTrigger ;
266285 private finishValidating ;
267286 private eventCallbacks ;
268- constructor ( validator : Validator , propertyParser : PropertyAccessorParser ) ;
287+ constructor ( validator : Validator , propertyParser : PropertyAccessorParser , config ?: GlobalValidationConfiguration ) ;
269288 /**
270289 * Subscribe to controller validate and reset events. These events occur when the
271290 * controller's "validate"" and "reset" methods are called.
@@ -499,35 +518,24 @@ export declare class Rules {
499518 */
500519 static get ( target : any ) : Rule < any , any > [ ] [ ] | null ;
501520}
502- export declare type Chain = any ;
503- export declare type Assign = any ;
504- export declare type AccessThis = any ;
505- export declare type AccessScope = any ;
506- export declare type CallScope = any ;
507- export declare type CallFunction = any ;
508- export declare type PrefixNot = any ;
509- export declare type LiteralPrimitive = any ;
510- export declare type LiteralArray = any ;
511- export declare type LiteralObject = any ;
512- export declare type LiteralString = any ;
513521declare class ExpressionVisitor {
514- visitChain ( chain : Chain ) : void ;
522+ visitChain ( chain : any ) : void ;
515523 visitBindingBehavior ( behavior : BindingBehavior ) : void ;
516524 visitValueConverter ( converter : ValueConverter ) : void ;
517- visitAssign ( assign : Assign ) : void ;
525+ visitAssign ( assign : any ) : void ;
518526 visitConditional ( conditional : Conditional ) : void ;
519- visitAccessThis ( access : AccessThis ) : void ;
527+ visitAccessThis ( access : any ) : void ;
520528 visitAccessScope ( access : AccessScope ) : void ;
521529 visitAccessMember ( access : AccessMember ) : void ;
522530 visitAccessKeyed ( access : AccessKeyed ) : void ;
523- visitCallScope ( call : CallScope ) : void ;
524- visitCallFunction ( call : CallFunction ) : void ;
531+ visitCallScope ( call : any ) : void ;
532+ visitCallFunction ( call : any ) : void ;
525533 visitCallMember ( call : CallMember ) : void ;
526- visitPrefix ( prefix : PrefixNot ) : void ;
534+ visitPrefix ( prefix : any ) : void ;
527535 visitBinary ( binary : Binary ) : void ;
528536 visitLiteralPrimitive ( literal : LiteralPrimitive ) : void ;
529- visitLiteralArray ( literal : LiteralArray ) : void ;
530- visitLiteralObject ( literal : LiteralObject ) : void ;
537+ visitLiteralArray ( literal : any ) : void ;
538+ visitLiteralObject ( literal : any ) : void ;
531539 visitLiteralString ( literal : LiteralString ) : void ;
532540 private visitArgs ;
533541}
@@ -656,7 +664,7 @@ export declare class FluentRuleCustomizer<TObject, TValue> {
656664 /**
657665 * Rules that have been defined using the fluent API.
658666 */
659- readonly rules : Rule < TObject , any > [ ] [ ] ;
667+ get rules ( ) : Rule < TObject , any > [ ] [ ] ;
660668 /**
661669 * Applies the rules to a class or object, making them discoverable by the StandardValidator.
662670 * @param target A class or object.
@@ -917,26 +925,10 @@ export interface Parsers {
917925 message : ValidationMessageParser ;
918926 property : PropertyAccessorParser ;
919927}
920- /**
921- * Aurelia Validation Configuration API
922- */
923- export declare class AureliaValidationConfiguration {
924- private validatorType ;
925- /**
926- * Use a custom Validator implementation.
927- */
928- customValidator ( type : {
929- new ( ...args : any [ ] ) : Validator ;
930- } ) : void ;
931- /**
932- * Applies the configuration.
933- */
934- apply ( container : Container ) : void ;
935- }
936928/**
937929 * Configures the plugin.
938930 */
939931export declare function configure ( frameworkConfig : {
940932 container : Container ;
941933 globalResources ?: ( ...resources : any [ ] ) => any ;
942- } , callback ?: ( config : AureliaValidationConfiguration ) => void ) : void ;
934+ } , callback ?: ( config : GlobalValidationConfiguration ) => void ) : void ;
0 commit comments