diff --git a/bower.json b/bower.json index f5977018..ba2a4166 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-validation", - "version": "0.14.0", + "version": "1.0.0-beta.1.0.0", "description": "Validation for Aurelia applications", "keywords": [ "aurelia", diff --git a/dist/amd/aurelia-validation.d.ts b/dist/amd/aurelia-validation.d.ts index b73b53e1..9897cc10 100644 --- a/dist/amd/aurelia-validation.d.ts +++ b/dist/amd/aurelia-validation.d.ts @@ -1,8 +1,11 @@ +export * from './controller-validate-result'; +export * from './property-info'; export * from './validate-binding-behavior'; +export * from './validate-instruction'; +export * from './validate-result'; export * from './validate-trigger'; export * from './validation-controller'; export * from './validation-controller-factory'; -export * from './validation-error'; export * from './validation-errors-custom-attribute'; export * from './validation-renderer-custom-attribute'; export * from './validation-renderer'; diff --git a/dist/amd/aurelia-validation.js b/dist/amd/aurelia-validation.js index 2376dce3..4e07f5a6 100644 --- a/dist/amd/aurelia-validation.js +++ b/dist/amd/aurelia-validation.js @@ -1,14 +1,15 @@ // Exports -define(["require", "exports", './validate-binding-behavior', './validate-trigger', './validation-controller', './validation-controller-factory', './validation-error', './validation-errors-custom-attribute', './validation-renderer-custom-attribute', './validator', './implementation/rules', './implementation/standard-validator', './implementation/validation-messages', './implementation/validation-parser', './implementation/validation-rules', './validator', './implementation/standard-validator', './implementation/validation-parser', './implementation/validation-rules'], function (require, exports, validate_binding_behavior_1, validate_trigger_1, validation_controller_1, validation_controller_factory_1, validation_error_1, validation_errors_custom_attribute_1, validation_renderer_custom_attribute_1, validator_1, rules_1, standard_validator_1, validation_messages_1, validation_parser_1, validation_rules_1, validator_2, standard_validator_2, validation_parser_2, validation_rules_2) { +define(["require", "exports", "./property-info", "./validate-binding-behavior", "./validate-result", "./validate-trigger", "./validation-controller", "./validation-controller-factory", "./validation-errors-custom-attribute", "./validation-renderer-custom-attribute", "./validator", "./implementation/rules", "./implementation/standard-validator", "./implementation/validation-messages", "./implementation/validation-parser", "./implementation/validation-rules", "./validator", "./implementation/standard-validator", "./implementation/validation-parser", "./implementation/validation-rules"], function (require, exports, property_info_1, validate_binding_behavior_1, validate_result_1, validate_trigger_1, validation_controller_1, validation_controller_factory_1, validation_errors_custom_attribute_1, validation_renderer_custom_attribute_1, validator_1, rules_1, standard_validator_1, validation_messages_1, validation_parser_1, validation_rules_1, validator_2, standard_validator_2, validation_parser_2, validation_rules_2) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } + __export(property_info_1); __export(validate_binding_behavior_1); + __export(validate_result_1); __export(validate_trigger_1); __export(validation_controller_1); __export(validation_controller_factory_1); - __export(validation_error_1); __export(validation_errors_custom_attribute_1); __export(validation_renderer_custom_attribute_1); __export(validator_1); diff --git a/dist/amd/controller-validate-result.d.ts b/dist/amd/controller-validate-result.d.ts new file mode 100644 index 00000000..5f814ed0 --- /dev/null +++ b/dist/amd/controller-validate-result.d.ts @@ -0,0 +1,19 @@ +import { ValidateResult } from './validate-result'; +import { ValidateInstruction } from './validate-instruction'; +/** + * The result of a call to the validation controller's validate method. + */ +export interface ControllerValidateResult { + /** + * Whether validation passed. + */ + valid: boolean; + /** + * The validation result of every rule that was evaluated. + */ + results: ValidateResult[]; + /** + * The instruction passed to the controller's validate method. + */ + instruction?: ValidateInstruction; +} diff --git a/dist/amd/controller-validate-result.js b/dist/amd/controller-validate-result.js new file mode 100644 index 00000000..d4db9673 --- /dev/null +++ b/dist/amd/controller-validate-result.js @@ -0,0 +1,3 @@ +define(["require", "exports"], function (require, exports) { + "use strict"; +}); diff --git a/dist/amd/implementation/rules.js b/dist/amd/implementation/rules.js index 45b077ab..ed9f8590 100644 --- a/dist/amd/implementation/rules.js +++ b/dist/amd/implementation/rules.js @@ -30,11 +30,11 @@ define(["require", "exports"], function (require, exports) { Rules.get = function (target) { return target[Rules.key] || null; }; - /** - * The name of the property that stores the rules. - */ - Rules.key = '__rules__'; return Rules; }()); + /** + * The name of the property that stores the rules. + */ + Rules.key = '__rules__'; exports.Rules = Rules; }); diff --git a/dist/amd/implementation/standard-validator.d.ts b/dist/amd/implementation/standard-validator.d.ts index dfe55f31..4d8054ef 100644 --- a/dist/amd/implementation/standard-validator.d.ts +++ b/dist/amd/implementation/standard-validator.d.ts @@ -1,6 +1,6 @@ import { ViewResources } from 'aurelia-templating'; import { Validator } from '../validator'; -import { ValidationError } from '../validation-error'; +import { ValidateResult } from '../validate-result'; import { Rule } from './rule'; import { ValidationMessageProvider } from './validation-messages'; /** @@ -8,7 +8,7 @@ import { ValidationMessageProvider } from './validation-messages'; * Responsible for validating objects and properties. */ export declare class StandardValidator extends Validator { - static inject: (typeof ValidationMessageProvider | typeof ViewResources)[]; + static inject: (typeof ViewResources | typeof ValidationMessageProvider)[]; private messageProvider; private lookupFunctions; private getDisplayName; @@ -20,14 +20,14 @@ export declare class StandardValidator extends Validator { * @param rules Optional. If unspecified, the rules will be looked up using the metadata * for the object created by ValidationRules....on(class/object) */ - validateProperty(object: any, propertyName: string, rules?: any): Promise; + validateProperty(object: any, propertyName: string, rules?: any): Promise; /** * Validates all rules for specified object and it's properties. * @param object The object to validate. * @param rules Optional. If unspecified, the rules will be looked up using the metadata * for the object created by ValidationRules....on(class/object) */ - validateObject(object: any, rules?: any): Promise; + validateObject(object: any, rules?: any): Promise; /** * Determines whether a rule exists in a set of rules. * @param rules The rules to search. @@ -35,6 +35,6 @@ export declare class StandardValidator extends Validator { */ ruleExists(rules: Rule[][], rule: Rule): boolean; private getMessage(rule, object, value); - private validateRuleSequence(object, propertyName, ruleSequence, sequence); + private validateRuleSequence(object, propertyName, ruleSequence, sequence, results); private validate(object, propertyName, rules); } diff --git a/dist/amd/implementation/standard-validator.js b/dist/amd/implementation/standard-validator.js index 96826407..6300b16a 100644 --- a/dist/amd/implementation/standard-validator.js +++ b/dist/amd/implementation/standard-validator.js @@ -3,7 +3,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -define(["require", "exports", 'aurelia-templating', '../validator', '../validation-error', './rules', './validation-messages'], function (require, exports, aurelia_templating_1, validator_1, validation_error_1, rules_1, validation_messages_1) { +define(["require", "exports", "aurelia-templating", "../validator", "../validate-result", "./rules", "./validation-messages"], function (require, exports, aurelia_templating_1, validator_1, validate_result_1, rules_1, validation_messages_1) { "use strict"; /** * Validates. @@ -12,10 +12,11 @@ define(["require", "exports", 'aurelia-templating', '../validator', '../validati var StandardValidator = (function (_super) { __extends(StandardValidator, _super); function StandardValidator(messageProvider, resources) { - _super.call(this); - this.messageProvider = messageProvider; - this.lookupFunctions = resources.lookupFunctions; - this.getDisplayName = messageProvider.getDisplayName.bind(messageProvider); + var _this = _super.call(this) || this; + _this.messageProvider = messageProvider; + _this.lookupFunctions = resources.lookupFunctions; + _this.getDisplayName = messageProvider.getDisplayName.bind(messageProvider); + return _this; } /** * Validates the specified property. @@ -53,8 +54,8 @@ define(["require", "exports", 'aurelia-templating', '../validator', '../validati StandardValidator.prototype.getMessage = function (rule, object, value) { var expression = rule.message || this.messageProvider.getMessage(rule.messageKey); var _a = rule.property, propertyName = _a.name, displayName = _a.displayName; - if (displayName === null && propertyName !== null) { - displayName = this.messageProvider.getDisplayName(propertyName); + if (propertyName !== null) { + displayName = this.messageProvider.getDisplayName(propertyName, displayName); } var overrideContext = { $displayName: displayName, @@ -66,15 +67,15 @@ define(["require", "exports", 'aurelia-templating', '../validator', '../validati }; return expression.evaluate({ bindingContext: object, overrideContext: overrideContext }, this.lookupFunctions); }; - StandardValidator.prototype.validateRuleSequence = function (object, propertyName, ruleSequence, sequence) { + StandardValidator.prototype.validateRuleSequence = function (object, propertyName, ruleSequence, sequence, results) { var _this = this; // are we validating all properties or a single property? var validateAllProperties = propertyName === null || propertyName === undefined; var rules = ruleSequence[sequence]; - var errors = []; + var allValid = true; // validate each rule. var promises = []; - var _loop_1 = function(i) { + var _loop_1 = function (i) { var rule = rules[i]; // is the rule related to the property we're validating. if (!validateAllProperties && rule.property.name !== propertyName) { @@ -90,11 +91,11 @@ define(["require", "exports", 'aurelia-templating', '../validator', '../validati if (!(promiseOrBoolean instanceof Promise)) { promiseOrBoolean = Promise.resolve(promiseOrBoolean); } - promises.push(promiseOrBoolean.then(function (isValid) { - if (!isValid) { - var message = _this.getMessage(rule, object, value); - errors.push(new validation_error_1.ValidationError(rule, message, object, rule.property.name)); - } + promises.push(promiseOrBoolean.then(function (valid) { + var message = valid ? null : _this.getMessage(rule, object, value); + results.push(new validate_result_1.ValidateResult(rule, object, rule.property.name, valid, message)); + allValid = allValid && valid; + return valid; })); }; for (var i = 0; i < rules.length; i++) { @@ -103,10 +104,10 @@ define(["require", "exports", 'aurelia-templating', '../validator', '../validati return Promise.all(promises) .then(function () { sequence++; - if (errors.length === 0 && sequence < ruleSequence.length) { - return _this.validateRuleSequence(object, propertyName, ruleSequence, sequence); + if (allValid && sequence < ruleSequence.length) { + return _this.validateRuleSequence(object, propertyName, ruleSequence, sequence, results); } - return errors; + return results; }); }; StandardValidator.prototype.validate = function (object, propertyName, rules) { @@ -119,10 +120,10 @@ define(["require", "exports", 'aurelia-templating', '../validator', '../validati if (!rules) { return Promise.resolve([]); } - return this.validateRuleSequence(object, propertyName, rules, 0); + return this.validateRuleSequence(object, propertyName, rules, 0, []); }; - StandardValidator.inject = [validation_messages_1.ValidationMessageProvider, aurelia_templating_1.ViewResources]; return StandardValidator; }(validator_1.Validator)); + StandardValidator.inject = [validation_messages_1.ValidationMessageProvider, aurelia_templating_1.ViewResources]; exports.StandardValidator = StandardValidator; }); diff --git a/dist/amd/implementation/validation-messages.d.ts b/dist/amd/implementation/validation-messages.d.ts index d9a09450..7a0978d7 100644 --- a/dist/amd/implementation/validation-messages.d.ts +++ b/dist/amd/implementation/validation-messages.d.ts @@ -20,10 +20,10 @@ export declare class ValidationMessageProvider { */ getMessage(key: string): Expression; /** - * When a display name is not provided, this method is used to formulate - * a display name using the property name. + * Formulates a property display name using the property name and the configured + * displayName (if provided). * Override this with your own custom logic. * @param propertyName The property name. */ - getDisplayName(propertyName: string): string; + getDisplayName(propertyName: string, displayName: string | null | undefined): string; } diff --git a/dist/amd/implementation/validation-messages.js b/dist/amd/implementation/validation-messages.js index 48152bed..51eb2587 100644 --- a/dist/amd/implementation/validation-messages.js +++ b/dist/amd/implementation/validation-messages.js @@ -1,4 +1,4 @@ -define(["require", "exports", './validation-parser'], function (require, exports, validation_parser_1) { +define(["require", "exports", "./validation-parser"], function (require, exports, validation_parser_1) { "use strict"; /** * Dictionary of validation messages. [messageKey]: messageExpression @@ -39,19 +39,22 @@ define(["require", "exports", './validation-parser'], function (require, exports return this.parser.parseMessage(message); }; /** - * When a display name is not provided, this method is used to formulate - * a display name using the property name. + * Formulates a property display name using the property name and the configured + * displayName (if provided). * Override this with your own custom logic. * @param propertyName The property name. */ - ValidationMessageProvider.prototype.getDisplayName = function (propertyName) { + ValidationMessageProvider.prototype.getDisplayName = function (propertyName, displayName) { + if (displayName !== null && displayName !== undefined) { + return displayName; + } // split on upper-case letters. var words = propertyName.split(/(?=[A-Z])/).join(' '); // capitalize first letter. return words.charAt(0).toUpperCase() + words.slice(1); }; - ValidationMessageProvider.inject = [validation_parser_1.ValidationParser]; return ValidationMessageProvider; }()); + ValidationMessageProvider.inject = [validation_parser_1.ValidationParser]; exports.ValidationMessageProvider = ValidationMessageProvider; }); diff --git a/dist/amd/implementation/validation-parser.js b/dist/amd/implementation/validation-parser.js index 80203554..fef4a064 100644 --- a/dist/amd/implementation/validation-parser.js +++ b/dist/amd/implementation/validation-parser.js @@ -3,7 +3,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -define(["require", "exports", 'aurelia-binding', 'aurelia-templating', './util', 'aurelia-logging'], function (require, exports, aurelia_binding_1, aurelia_templating_1, util_1, LogManager) { +define(["require", "exports", "aurelia-binding", "aurelia-templating", "./util", "aurelia-logging"], function (require, exports, aurelia_binding_1, aurelia_templating_1, util_1, LogManager) { "use strict"; var ValidationParser = (function () { function ValidationParser(parser, bindinqLanguage) { @@ -57,15 +57,16 @@ define(["require", "exports", 'aurelia-binding', 'aurelia-templating', './util', } return this.parser.parse(match[1]); }; - ValidationParser.inject = [aurelia_binding_1.Parser, aurelia_templating_1.BindingLanguage]; return ValidationParser; }()); + ValidationParser.inject = [aurelia_binding_1.Parser, aurelia_templating_1.BindingLanguage]; exports.ValidationParser = ValidationParser; var MessageExpressionValidator = (function (_super) { __extends(MessageExpressionValidator, _super); function MessageExpressionValidator(originalMessage) { - _super.call(this, []); - this.originalMessage = originalMessage; + var _this = _super.call(this, []) || this; + _this.originalMessage = originalMessage; + return _this; } MessageExpressionValidator.validate = function (expression, originalMessage) { var visitor = new MessageExpressionValidator(originalMessage); diff --git a/dist/amd/implementation/validation-rules.d.ts b/dist/amd/implementation/validation-rules.d.ts index 59ba7410..13251d4d 100644 --- a/dist/amd/implementation/validation-rules.d.ts +++ b/dist/amd/implementation/validation-rules.d.ts @@ -122,6 +122,12 @@ export declare class FluentRules { argsToConfig?: (...args: any[]) => any; }; }; + /** + * Current rule sequence number. Used to postpone evaluation of rules until rules + * with lower sequence number have successfully validated. The "then" fluent API method + * manages this property, there's usually no need to set it directly. + */ + sequence: number; constructor(fluentEnsure: FluentEnsure, parser: ValidationParser, property: RuleProperty); /** * Sets the display name of the ensured property. @@ -191,7 +197,6 @@ export declare class FluentEnsure { * Rules that have been defined using the fluent API. */ rules: Rule[][]; - _sequence: number; constructor(parser: ValidationParser); /** * Target a property with validation rules. diff --git a/dist/amd/implementation/validation-rules.js b/dist/amd/implementation/validation-rules.js index 75d98847..033f494d 100644 --- a/dist/amd/implementation/validation-rules.js +++ b/dist/amd/implementation/validation-rules.js @@ -1,4 +1,4 @@ -define(["require", "exports", './util', './rules', './validation-messages'], function (require, exports, util_1, rules_1, validation_messages_1) { +define(["require", "exports", "./util", "./rules", "./validation-messages"], function (require, exports, util_1, rules_1, validation_messages_1) { "use strict"; /** * Part of the fluent rule API. Enables customizing property rules. @@ -16,7 +16,7 @@ define(["require", "exports", './util', './rules', './validation-messages'], fun when: null, messageKey: 'default', message: null, - sequence: fluentEnsure._sequence + sequence: fluentRules.sequence }; this.fluentEnsure._addRule(this.rule); } @@ -26,7 +26,7 @@ define(["require", "exports", './util', './rules', './validation-messages'], fun * rules until less expensive rules pass validation. */ FluentRuleCustomizer.prototype.then = function () { - this.fluentEnsure._sequence++; + this.fluentRules.sequence++; return this; }; /** @@ -184,6 +184,12 @@ define(["require", "exports", './util', './rules', './validation-messages'], fun this.fluentEnsure = fluentEnsure; this.parser = parser; this.property = property; + /** + * Current rule sequence number. Used to postpone evaluation of rules until rules + * with lower sequence number have successfully validated. The "then" fluent API method + * manages this property, there's usually no need to set it directly. + */ + this.sequence = 0; } /** * Sets the display name of the ensured property. @@ -222,7 +228,10 @@ define(["require", "exports", './util', './rules', './validation-messages'], fun throw new Error("Rule with name \"" + name + "\" does not exist."); } var config = rule.argsToConfig ? rule.argsToConfig.apply(rule, args) : undefined; - return this.satisfies(function (value, obj) { return (_a = rule.condition).call.apply(_a, [_this, value, obj].concat(args)); var _a; }, config) + return this.satisfies(function (value, obj) { + return (_a = rule.condition).call.apply(_a, [_this, value, obj].concat(args)); + var _a; + }, config) .withMessageKey(name); }; /** @@ -295,23 +304,20 @@ define(["require", "exports", './util', './rules', './validation-messages'], fun return this.satisfies(function (value) { return value === null || value === undefined || value === '' || value === expectedValue; }, { expectedValue: expectedValue }) .withMessageKey('equals'); }; - FluentRules.customRules = {}; return FluentRules; }()); + FluentRules.customRules = {}; exports.FluentRules = FluentRules; /** * Part of the fluent rule API. Enables targeting properties and objects with rules. */ var FluentEnsure = (function () { - /* tslint:enable */ function FluentEnsure(parser) { this.parser = parser; /** * Rules that have been defined using the fluent API. */ this.rules = []; - /* tslint:disable */ - this._sequence = 0; } /** * Target a property with validation rules. diff --git a/dist/amd/property-info.js b/dist/amd/property-info.js index 85cbe2ed..a58a00fd 100644 --- a/dist/amd/property-info.js +++ b/dist/amd/property-info.js @@ -1,4 +1,4 @@ -define(["require", "exports", 'aurelia-binding'], function (require, exports, aurelia_binding_1) { +define(["require", "exports", "aurelia-binding"], function (require, exports, aurelia_binding_1) { "use strict"; function getObject(expression, objectExpression, source) { var value = objectExpression.evaluate(source, null); diff --git a/dist/amd/validate-binding-behavior-base.js b/dist/amd/validate-binding-behavior-base.js index 9ecc7469..440a5b56 100644 --- a/dist/amd/validate-binding-behavior-base.js +++ b/dist/amd/validate-binding-behavior-base.js @@ -1,4 +1,4 @@ -define(["require", "exports", 'aurelia-dependency-injection', 'aurelia-pal', './validation-controller', './validate-trigger'], function (require, exports, aurelia_dependency_injection_1, aurelia_pal_1, validation_controller_1, validate_trigger_1) { +define(["require", "exports", "aurelia-dependency-injection", "aurelia-pal", "./validation-controller", "./validate-trigger"], function (require, exports, aurelia_dependency_injection_1, aurelia_pal_1, validation_controller_1, validate_trigger_1) { "use strict"; /** * Binding behavior. Indicates the bound property should be validated. diff --git a/dist/amd/validate-binding-behavior.js b/dist/amd/validate-binding-behavior.js index c5411a76..dec7911b 100644 --- a/dist/amd/validate-binding-behavior.js +++ b/dist/amd/validate-binding-behavior.js @@ -3,7 +3,7 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -define(["require", "exports", 'aurelia-task-queue', './validate-trigger', './validate-binding-behavior-base'], function (require, exports, aurelia_task_queue_1, validate_trigger_1, validate_binding_behavior_base_1) { +define(["require", "exports", "aurelia-task-queue", "./validate-trigger", "./validate-binding-behavior-base"], function (require, exports, aurelia_task_queue_1, validate_trigger_1, validate_binding_behavior_base_1) { "use strict"; /** * Binding behavior. Indicates the bound property should be validated @@ -13,14 +13,14 @@ define(["require", "exports", 'aurelia-task-queue', './validate-trigger', './val var ValidateBindingBehavior = (function (_super) { __extends(ValidateBindingBehavior, _super); function ValidateBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateBindingBehavior.prototype.getValidateTrigger = function (controller) { return controller.validateTrigger; }; - ValidateBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); + ValidateBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports.ValidateBindingBehavior = ValidateBindingBehavior; /** * Binding behavior. Indicates the bound property will be validated @@ -30,14 +30,14 @@ define(["require", "exports", 'aurelia-task-queue', './validate-trigger', './val var ValidateManuallyBindingBehavior = (function (_super) { __extends(ValidateManuallyBindingBehavior, _super); function ValidateManuallyBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateManuallyBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.manual; }; - ValidateManuallyBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateManuallyBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); + ValidateManuallyBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports.ValidateManuallyBindingBehavior = ValidateManuallyBindingBehavior; /** * Binding behavior. Indicates the bound property should be validated @@ -46,14 +46,14 @@ define(["require", "exports", 'aurelia-task-queue', './validate-trigger', './val var ValidateOnBlurBindingBehavior = (function (_super) { __extends(ValidateOnBlurBindingBehavior, _super); function ValidateOnBlurBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateOnBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.blur; }; - ValidateOnBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateOnBlurBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); + ValidateOnBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports.ValidateOnBlurBindingBehavior = ValidateOnBlurBindingBehavior; /** * Binding behavior. Indicates the bound property should be validated @@ -63,14 +63,14 @@ define(["require", "exports", 'aurelia-task-queue', './validate-trigger', './val var ValidateOnChangeBindingBehavior = (function (_super) { __extends(ValidateOnChangeBindingBehavior, _super); function ValidateOnChangeBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateOnChangeBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.change; }; - ValidateOnChangeBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateOnChangeBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); + ValidateOnChangeBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports.ValidateOnChangeBindingBehavior = ValidateOnChangeBindingBehavior; /** * Binding behavior. Indicates the bound property should be validated @@ -80,13 +80,13 @@ define(["require", "exports", 'aurelia-task-queue', './validate-trigger', './val var ValidateOnChangeOrBlurBindingBehavior = (function (_super) { __extends(ValidateOnChangeOrBlurBindingBehavior, _super); function ValidateOnChangeOrBlurBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateOnChangeOrBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.changeOrBlur; }; - ValidateOnChangeOrBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateOnChangeOrBlurBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); + ValidateOnChangeOrBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports.ValidateOnChangeOrBlurBindingBehavior = ValidateOnChangeOrBlurBindingBehavior; }); diff --git a/dist/amd/validate-instruction.d.ts b/dist/amd/validate-instruction.d.ts new file mode 100644 index 00000000..2f792a70 --- /dev/null +++ b/dist/amd/validate-instruction.d.ts @@ -0,0 +1,17 @@ +/** + * Instructions for the validation controller's validate method. + */ +export interface ValidateInstruction { + /** + * The object to validate. + */ + object: any; + /** + * The property to validate. Optional. + */ + propertyName?: any; + /** + * The rules to validate. Optional. + */ + rules?: any; +} diff --git a/dist/amd/validate-instruction.js b/dist/amd/validate-instruction.js new file mode 100644 index 00000000..d4db9673 --- /dev/null +++ b/dist/amd/validate-instruction.js @@ -0,0 +1,3 @@ +define(["require", "exports"], function (require, exports) { + "use strict"; +}); diff --git a/dist/amd/validate-result.d.ts b/dist/amd/validate-result.d.ts new file mode 100644 index 00000000..461c2318 --- /dev/null +++ b/dist/amd/validate-result.d.ts @@ -0,0 +1,23 @@ +/** + * The result of validating an individual validation rule. + */ +export declare class ValidateResult { + rule: any; + object: any; + propertyName: string | null; + valid: boolean; + message: string | null; + private static nextId; + /** + * A number that uniquely identifies the result instance. + */ + id: number; + /** + * @param rule The rule associated with the result. Validator implementation specific. + * @param object The object that was validated. + * @param propertyName The name of the property that was validated. + * @param error The error, if the result is a validation error. + */ + constructor(rule: any, object: any, propertyName: string | null, valid: boolean, message?: string | null); + toString(): string | null; +} diff --git a/dist/amd/validate-result.js b/dist/amd/validate-result.js new file mode 100644 index 00000000..12480ffc --- /dev/null +++ b/dist/amd/validate-result.js @@ -0,0 +1,29 @@ +define(["require", "exports"], function (require, exports) { + "use strict"; + /** + * The result of validating an individual validation rule. + */ + var ValidateResult = (function () { + /** + * @param rule The rule associated with the result. Validator implementation specific. + * @param object The object that was validated. + * @param propertyName The name of the property that was validated. + * @param error The error, if the result is a validation error. + */ + function ValidateResult(rule, object, propertyName, valid, message) { + if (message === void 0) { message = null; } + this.rule = rule; + this.object = object; + this.propertyName = propertyName; + this.valid = valid; + this.message = message; + this.id = ValidateResult.nextId++; + } + ValidateResult.prototype.toString = function () { + return this.valid ? 'Valid.' : this.message; + }; + return ValidateResult; + }()); + ValidateResult.nextId = 0; + exports.ValidateResult = ValidateResult; +}); diff --git a/dist/amd/validation-controller-factory.js b/dist/amd/validation-controller-factory.js index 344a4c56..4cd9219e 100644 --- a/dist/amd/validation-controller-factory.js +++ b/dist/amd/validation-controller-factory.js @@ -1,4 +1,4 @@ -define(["require", "exports", './validation-controller', './validator'], function (require, exports, validation_controller_1, validator_1) { +define(["require", "exports", "./validation-controller", "./validator"], function (require, exports, validation_controller_1, validator_1) { "use strict"; /** * Creates ValidationController instances. diff --git a/dist/amd/validation-controller.d.ts b/dist/amd/validation-controller.d.ts index a65621f3..d88935e5 100644 --- a/dist/amd/validation-controller.d.ts +++ b/dist/amd/validation-controller.d.ts @@ -1,25 +1,13 @@ import { Binding } from 'aurelia-binding'; import { Validator } from './validator'; import { ValidationRenderer } from './validation-renderer'; -import { ValidationError } from './validation-error'; -export interface ValidateInstruction { - /** - * The object to validate. - */ - object: any; - /** - * The property to validate. Optional. - */ - propertyName?: any; - /** - * The rules to validate. Optional. - */ - rules?: any; -} +import { ValidateResult } from './validate-result'; +import { ValidateInstruction } from './validate-instruction'; +import { ControllerValidateResult } from './controller-validate-result'; /** * Orchestrates validation. * Manages a set of bindings, renderers and objects. - * Exposes the current list of validation errors for binding purposes. + * Exposes the current list of validation results for binding purposes. */ export declare class ValidationController { private validator; @@ -27,9 +15,13 @@ export declare class ValidationController { private bindings; private renderers; /** - * Errors that have been rendered by the controller. + * Validation results that have been rendered by the controller. + */ + private results; + /** + * Validation errors that have been rendered by the controller. */ - errors: ValidationError[]; + errors: ValidateResult[]; /** * Whether the controller is currently validating. */ @@ -54,13 +46,13 @@ export declare class ValidationController { */ removeObject(object: any): void; /** - * Adds and renders a ValidationError. + * Adds and renders an error. */ - addError(message: string, object: any, propertyName?: string): ValidationError; + addError(message: string, object: any, propertyName?: string | null): ValidateResult; /** - * Removes and unrenders a ValidationError. + * Removes and unrenders an error. */ - removeError(error: ValidationError): void; + removeError(result: ValidateResult): void; /** * Adds a renderer. * @param renderer The renderer. @@ -85,31 +77,32 @@ export declare class ValidationController { unregisterBinding(binding: Binding): void; /** * Interprets the instruction and returns a predicate that will identify - * relevant errors in the list of rendered errors. + * relevant results in the list of rendered validation results. */ private getInstructionPredicate(instruction?); /** - * Validates and renders errors. + * Validates and renders results. * @param instruction Optional. Instructions on what to validate. If undefined, all * objects and bindings will be validated. */ - validate(instruction?: ValidateInstruction): Promise; + validate(instruction?: ValidateInstruction): Promise; /** - * Resets any rendered errors (unrenders). - * @param instruction Optional. Instructions on what to reset. If unspecified all rendered errors will be unrendered. + * Resets any rendered validation results (unrenders). + * @param instruction Optional. Instructions on what to reset. If unspecified all rendered results + * will be unrendered. */ reset(instruction?: ValidateInstruction): void; /** * Gets the elements associated with an object and propertyName (if any). */ private getAssociatedElements({object, propertyName}); - private processErrorDelta(kind, oldErrors, newErrors); + private processResultDelta(kind, oldResults, newResults); /** * Validates the property associated with a binding. */ validateBinding(binding: Binding): void; /** - * Resets the errors for a property associated with a binding. + * Resets the results for a property associated with a binding. */ resetBinding(binding: Binding): void; } diff --git a/dist/amd/validation-controller.js b/dist/amd/validation-controller.js index 26fcd248..68439c15 100644 --- a/dist/amd/validation-controller.js +++ b/dist/amd/validation-controller.js @@ -1,9 +1,9 @@ -define(["require", "exports", './validator', './validate-trigger', './property-info', './validation-error'], function (require, exports, validator_1, validate_trigger_1, property_info_1, validation_error_1) { +define(["require", "exports", "./validator", "./validate-trigger", "./property-info", "./validate-result"], function (require, exports, validator_1, validate_trigger_1, property_info_1, validate_result_1) { "use strict"; /** * Orchestrates validation. * Manages a set of bindings, renderers and objects. - * Exposes the current list of validation errors for binding purposes. + * Exposes the current list of validation results for binding purposes. */ var ValidationController = (function () { function ValidationController(validator) { @@ -13,14 +13,18 @@ define(["require", "exports", './validator', './validate-trigger', './property-i // Renderers that have been added to the controller instance. this.renderers = []; /** - * Errors that have been rendered by the controller. + * Validation results that have been rendered by the controller. + */ + this.results = []; + /** + * Validation errors that have been rendered by the controller. */ this.errors = []; /** * Whether the controller is currently validating. */ this.validating = false; - // Elements related to errors that have been rendered. + // Elements related to validation results that have been rendered. this.elements = new Map(); // Objects that have been added to the controller instance (entity-style validation). this.objects = new Map(); @@ -45,22 +49,23 @@ define(["require", "exports", './validator', './validate-trigger', './property-i */ ValidationController.prototype.removeObject = function (object) { this.objects.delete(object); - this.processErrorDelta('reset', this.errors.filter(function (error) { return error.object === object; }), []); + this.processResultDelta('reset', this.results.filter(function (result) { return result.object === object; }), []); }; /** - * Adds and renders a ValidationError. + * Adds and renders an error. */ ValidationController.prototype.addError = function (message, object, propertyName) { - var error = new validation_error_1.ValidationError({}, message, object, propertyName); - this.processErrorDelta('validate', [], [error]); - return error; + if (propertyName === void 0) { propertyName = null; } + var result = new validate_result_1.ValidateResult({}, object, propertyName, false, message); + this.processResultDelta('validate', [], [result]); + return result; }; /** - * Removes and unrenders a ValidationError. + * Removes and unrenders an error. */ - ValidationController.prototype.removeError = function (error) { - if (this.errors.indexOf(error) !== -1) { - this.processErrorDelta('reset', [error], []); + ValidationController.prototype.removeError = function (result) { + if (this.results.indexOf(result) !== -1) { + this.processResultDelta('reset', [result], []); } }; /** @@ -72,7 +77,7 @@ define(["require", "exports", './validator', './validate-trigger', './property-i this.renderers.push(renderer); renderer.render({ kind: 'validate', - render: this.errors.map(function (error) { return ({ error: error, elements: _this.elements.get(error) }); }), + render: this.results.map(function (result) { return ({ result: result, elements: _this.elements.get(result) }); }), unrender: [] }); }; @@ -86,7 +91,7 @@ define(["require", "exports", './validator', './validate-trigger', './property-i renderer.render({ kind: 'reset', render: [], - unrender: this.errors.map(function (error) { return ({ error: error, elements: _this.elements.get(error) }); }) + unrender: this.results.map(function (result) { return ({ result: result, elements: _this.elements.get(result) }); }) }); }; /** @@ -108,7 +113,7 @@ define(["require", "exports", './validator', './validate-trigger', './property-i }; /** * Interprets the instruction and returns a predicate that will identify - * relevant errors in the list of rendered errors. + * relevant results in the list of rendered validation results. */ ValidationController.prototype.getInstructionPredicate = function (instruction) { var _this = this; @@ -131,7 +136,7 @@ define(["require", "exports", './validator', './validate-trigger', './property-i } }; /** - * Validates and renders errors. + * Validates and renders results. * @param instruction Optional. Instructions on what to validate. If undefined, all * objects and bindings will be validated. */ @@ -169,39 +174,45 @@ define(["require", "exports", './validator', './validate-trigger', './property-i } promises.push(_this.validator.validateProperty(propertyInfo.object, propertyInfo.propertyName, rules)); } - return Promise.all(promises).then(function (errorSets) { return errorSets.reduce(function (a, b) { return a.concat(b); }, []); }); + return Promise.all(promises).then(function (resultSets) { return resultSets.reduce(function (a, b) { return a.concat(b); }, []); }); }; } - // Wait for any existing validation to finish, execute the instruction, render the errors. + // Wait for any existing validation to finish, execute the instruction, render the results. this.validating = true; - var result = this.finishValidating + var returnPromise = this.finishValidating .then(execute) - .then(function (newErrors) { + .then(function (newResults) { var predicate = _this.getInstructionPredicate(instruction); - var oldErrors = _this.errors.filter(predicate); - _this.processErrorDelta('validate', oldErrors, newErrors); - if (result === _this.finishValidating) { + var oldResults = _this.results.filter(predicate); + _this.processResultDelta('validate', oldResults, newResults); + if (returnPromise === _this.finishValidating) { _this.validating = false; } - return newErrors; + var result = { + instruction: instruction, + valid: newResults.find(function (x) { return !x.valid; }) === undefined, + results: newResults + }; + return result; }) - .catch(function (error) { + .catch(function (exception) { // recover, to enable subsequent calls to validate() _this.validating = false; _this.finishValidating = Promise.resolve(); - return Promise.reject(error); + return Promise.reject(exception); }); - this.finishValidating = result; - return result; + this.finishValidating = returnPromise; + return returnPromise; }; /** - * Resets any rendered errors (unrenders). - * @param instruction Optional. Instructions on what to reset. If unspecified all rendered errors will be unrendered. + * Resets any rendered validation results (unrenders). + * @param instruction Optional. Instructions on what to reset. If unspecified all rendered results + * will be unrendered. */ ValidationController.prototype.reset = function (instruction) { var predicate = this.getInstructionPredicate(instruction); - var oldErrors = this.errors.filter(predicate); - this.processErrorDelta('reset', oldErrors, []); + var oldResults = this.results.filter(predicate); + this.processResultDelta('reset', oldResults, []); }; /** * Gets the elements associated with an object and propertyName (if any). @@ -218,54 +229,66 @@ define(["require", "exports", './validator', './validate-trigger', './property-i } return elements; }; - ValidationController.prototype.processErrorDelta = function (kind, oldErrors, newErrors) { + ValidationController.prototype.processResultDelta = function (kind, oldResults, newResults) { // prepare the instruction. var instruction = { kind: kind, render: [], unrender: [] }; - // create a shallow copy of newErrors so we can mutate it without causing side-effects. - newErrors = newErrors.slice(0); - // create unrender instructions from the old errors. - var _loop_1 = function(oldError) { - // get the elements associated with the old error. - var elements = this_1.elements.get(oldError); - // remove the old error from the element map. - this_1.elements.delete(oldError); + // create a shallow copy of newResults so we can mutate it without causing side-effects. + newResults = newResults.slice(0); + var _loop_1 = function (oldResult) { + // get the elements associated with the old result. + var elements = this_1.elements.get(oldResult); + // remove the old result from the element map. + this_1.elements.delete(oldResult); // create the unrender instruction. - instruction.unrender.push({ error: oldError, elements: elements }); - // determine if there's a corresponding new error for the old error we are unrendering. - var newErrorIndex = newErrors.findIndex(function (x) { return x.rule === oldError.rule && x.object === oldError.object && x.propertyName === oldError.propertyName; }); - if (newErrorIndex === -1) { - // no corresponding new error... simple remove. - this_1.errors.splice(this_1.errors.indexOf(oldError), 1); + instruction.unrender.push({ result: oldResult, elements: elements }); + // determine if there's a corresponding new result for the old result we are unrendering. + var newResultIndex = newResults.findIndex(function (x) { return x.rule === oldResult.rule && x.object === oldResult.object && x.propertyName === oldResult.propertyName; }); + if (newResultIndex === -1) { + // no corresponding new result... simple remove. + this_1.results.splice(this_1.results.indexOf(oldResult), 1); + if (!oldResult.valid) { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1); + } } else { - // there is a corresponding new error... - var newError = newErrors.splice(newErrorIndex, 1)[0]; - // get the elements that are associated with the new error. - var elements_1 = this_1.getAssociatedElements(newError); - this_1.elements.set(newError, elements_1); - // create a render instruction for the new error. - instruction.render.push({ error: newError, elements: elements_1 }); - // do an in-place replacement of the old error with the new error. - // this ensures any repeats bound to this.errors will not thrash. - this_1.errors.splice(this_1.errors.indexOf(oldError), 1, newError); + // there is a corresponding new result... + var newResult = newResults.splice(newResultIndex, 1)[0]; + // get the elements that are associated with the new result. + var elements_1 = this_1.getAssociatedElements(newResult); + this_1.elements.set(newResult, elements_1); + // create a render instruction for the new result. + instruction.render.push({ result: newResult, elements: elements_1 }); + // do an in-place replacement of the old result with the new result. + // this ensures any repeats bound to this.results will not thrash. + this_1.results.splice(this_1.results.indexOf(oldResult), 1, newResult); + if (newResult.valid) { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1); + } + else { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1, newResult); + } } }; var this_1 = this; - for (var _i = 0, oldErrors_1 = oldErrors; _i < oldErrors_1.length; _i++) { - var oldError = oldErrors_1[_i]; - _loop_1(oldError); + // create unrender instructions from the old results. + for (var _i = 0, oldResults_1 = oldResults; _i < oldResults_1.length; _i++) { + var oldResult = oldResults_1[_i]; + _loop_1(oldResult); } - // create render instructions from the remaining new errors. - for (var _a = 0, newErrors_1 = newErrors; _a < newErrors_1.length; _a++) { - var error = newErrors_1[_a]; - var elements = this.getAssociatedElements(error); - instruction.render.push({ error: error, elements: elements }); - this.elements.set(error, elements); - this.errors.push(error); + // create render instructions from the remaining new results. + for (var _a = 0, newResults_1 = newResults; _a < newResults_1.length; _a++) { + var result = newResults_1[_a]; + var elements = this.getAssociatedElements(result); + instruction.render.push({ result: result, elements: elements }); + this.elements.set(result, elements); + this.results.push(result); + if (!result.valid) { + this.errors.push(result); + } } // render. for (var _b = 0, _c = this.renderers; _b < _c.length; _b++) { @@ -294,7 +317,7 @@ define(["require", "exports", './validator', './validate-trigger', './property-i this.validate({ object: object, propertyName: propertyName, rules: rules }); }; /** - * Resets the errors for a property associated with a binding. + * Resets the results for a property associated with a binding. */ ValidationController.prototype.resetBinding = function (binding) { var registeredBinding = this.bindings.get(binding); @@ -311,8 +334,8 @@ define(["require", "exports", './validator', './validate-trigger', './property-i var object = propertyInfo.object, propertyName = propertyInfo.propertyName; this.reset({ object: object, propertyName: propertyName }); }; - ValidationController.inject = [validator_1.Validator]; return ValidationController; }()); + ValidationController.inject = [validator_1.Validator]; exports.ValidationController = ValidationController; }); diff --git a/dist/amd/validation-error.d.ts b/dist/amd/validation-error.d.ts deleted file mode 100644 index 34064d03..00000000 --- a/dist/amd/validation-error.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A validation error. - */ -export declare class ValidationError { - rule: any; - message: string; - object: any; - propertyName: string | null; - private static nextId; - /** - * A number that uniquely identifies the error instance. - */ - id: number; - /** - * @param rule The rule associated with the error. Validator implementation specific. - * @param message The error message. - * @param object The invalid object - * @param propertyName The name of the invalid property. Optional. - */ - constructor(rule: any, message: string, object: any, propertyName?: string | null); - toString(): string; -} diff --git a/dist/amd/validation-error.js b/dist/amd/validation-error.js deleted file mode 100644 index 8d575a8f..00000000 --- a/dist/amd/validation-error.js +++ /dev/null @@ -1,28 +0,0 @@ -define(["require", "exports"], function (require, exports) { - "use strict"; - /** - * A validation error. - */ - var ValidationError = (function () { - /** - * @param rule The rule associated with the error. Validator implementation specific. - * @param message The error message. - * @param object The invalid object - * @param propertyName The name of the invalid property. Optional. - */ - function ValidationError(rule, message, object, propertyName) { - if (propertyName === void 0) { propertyName = null; } - this.rule = rule; - this.message = message; - this.object = object; - this.propertyName = propertyName; - this.id = ValidationError.nextId++; - } - ValidationError.prototype.toString = function () { - return this.message; - }; - ValidationError.nextId = 0; - return ValidationError; - }()); - exports.ValidationError = ValidationError; -}); diff --git a/dist/amd/validation-errors-custom-attribute.d.ts b/dist/amd/validation-errors-custom-attribute.d.ts index 9342dd0d..73340e73 100644 --- a/dist/amd/validation-errors-custom-attribute.d.ts +++ b/dist/amd/validation-errors-custom-attribute.d.ts @@ -1,9 +1,9 @@ import { Lazy } from 'aurelia-dependency-injection'; import { ValidationController } from './validation-controller'; -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; import { ValidationRenderer, RenderInstruction } from './validation-renderer'; export interface RenderedError { - error: ValidationError; + error: ValidateResult; targets: Element[]; } export declare class ValidationErrorsCustomAttribute implements ValidationRenderer { diff --git a/dist/amd/validation-errors-custom-attribute.js b/dist/amd/validation-errors-custom-attribute.js index 9f38186b..77fe1bd4 100644 --- a/dist/amd/validation-errors-custom-attribute.js +++ b/dist/amd/validation-errors-custom-attribute.js @@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -define(["require", "exports", 'aurelia-binding', 'aurelia-dependency-injection', 'aurelia-templating', './validation-controller'], function (require, exports, aurelia_binding_1, aurelia_dependency_injection_1, aurelia_templating_1, validation_controller_1) { +define(["require", "exports", "aurelia-binding", "aurelia-dependency-injection", "aurelia-templating", "./validation-controller"], function (require, exports, aurelia_binding_1, aurelia_dependency_injection_1, aurelia_templating_1, validation_controller_1) { "use strict"; var ValidationErrorsCustomAttribute = (function () { function ValidationErrorsCustomAttribute(boundaryElement, controllerAccessor) { @@ -27,22 +27,25 @@ define(["require", "exports", 'aurelia-binding', 'aurelia-dependency-injection', return elements.filter(function (e) { return _this.boundaryElement.contains(e); }); }; ValidationErrorsCustomAttribute.prototype.render = function (instruction) { - var _loop_1 = function(error) { - var index = this_1.errors.findIndex(function (x) { return x.error === error; }); + var _loop_1 = function (result) { + var index = this_1.errors.findIndex(function (x) { return x.error === result; }); if (index !== -1) { this_1.errors.splice(index, 1); } }; var this_1 = this; for (var _i = 0, _a = instruction.unrender; _i < _a.length; _i++) { - var error = _a[_i].error; - _loop_1(error); + var result = _a[_i].result; + _loop_1(result); } for (var _b = 0, _c = instruction.render; _b < _c.length; _b++) { - var _d = _c[_b], error = _d.error, elements = _d.elements; + var _d = _c[_b], result = _d.result, elements = _d.elements; + if (result.valid) { + continue; + } var targets = this.interestingElements(elements); if (targets.length) { - this.errors.push({ error: error, targets: targets }); + this.errors.push({ error: result, targets: targets }); } } this.sort(); @@ -55,11 +58,11 @@ define(["require", "exports", 'aurelia-binding', 'aurelia-dependency-injection', ValidationErrorsCustomAttribute.prototype.unbind = function () { this.controllerAccessor().removeRenderer(this); }; - ValidationErrorsCustomAttribute.inject = [Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; - ValidationErrorsCustomAttribute = __decorate([ - aurelia_templating_1.customAttribute('validation-errors', aurelia_binding_1.bindingMode.twoWay) - ], ValidationErrorsCustomAttribute); return ValidationErrorsCustomAttribute; }()); + ValidationErrorsCustomAttribute.inject = [Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; + ValidationErrorsCustomAttribute = __decorate([ + aurelia_templating_1.customAttribute('validation-errors', aurelia_binding_1.bindingMode.twoWay) + ], ValidationErrorsCustomAttribute); exports.ValidationErrorsCustomAttribute = ValidationErrorsCustomAttribute; }); diff --git a/dist/amd/validation-renderer-custom-attribute.js b/dist/amd/validation-renderer-custom-attribute.js index dd21ba99..6d526d6f 100644 --- a/dist/amd/validation-renderer-custom-attribute.js +++ b/dist/amd/validation-renderer-custom-attribute.js @@ -1,4 +1,4 @@ -define(["require", "exports", './validation-controller'], function (require, exports, validation_controller_1) { +define(["require", "exports", "./validation-controller"], function (require, exports, validation_controller_1) { "use strict"; var ValidationRendererCustomAttribute = (function () { function ValidationRendererCustomAttribute() { diff --git a/dist/amd/validation-renderer.d.ts b/dist/amd/validation-renderer.d.ts index 0422409b..eb430d9d 100644 --- a/dist/amd/validation-renderer.d.ts +++ b/dist/amd/validation-renderer.d.ts @@ -1,19 +1,19 @@ -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; /** - * An error to render (or unrender) and the associated elements (if any) + * A result to render (or unrender) and the associated elements (if any) */ -export interface RenderErrorInstruction { +export interface ResultInstruction { /** - * The validation error. + * The validation result. */ - error: ValidationError; + result: ValidateResult; /** * The associated elements (if any). */ elements: Element[]; } /** - * Defines which errors to render and which errors to unrender. + * Defines which validation results to render and which validation results to unrender. */ export interface RenderInstruction { /** @@ -21,22 +21,22 @@ export interface RenderInstruction { */ kind: 'validate' | 'reset'; /** - * The errors to render. + * The results to render. */ - render: RenderErrorInstruction[]; + render: ResultInstruction[]; /** - * The errors to unrender. + * The results to unrender. */ - unrender: RenderErrorInstruction[]; + unrender: ResultInstruction[]; } /** - * Renders validation errors. + * Renders validation results. */ export interface ValidationRenderer { /** - * Render the errors. - * @param instruction The render instruction. Defines which errors to render and which - * errors to unrender. + * Render the validation results. + * @param instruction The render instruction. Defines which results to render and which + * results to unrender. */ render(instruction: RenderInstruction): void; } diff --git a/dist/amd/validator.d.ts b/dist/amd/validator.d.ts index edaa3f40..82c045e8 100644 --- a/dist/amd/validator.d.ts +++ b/dist/amd/validator.d.ts @@ -1,7 +1,6 @@ -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; /** - * Validates. - * Responsible for validating objects and properties. + * Validates objects and properties. */ export declare abstract class Validator { /** @@ -11,14 +10,14 @@ export declare abstract class Validator { * @param rules Optional. If unspecified, the implementation should lookup the rules for the * specified object. This may not be possible for all implementations of this interface. */ - abstract validateProperty(object: any, propertyName: string, rules?: any): Promise; + abstract validateProperty(object: any, propertyName: string, rules?: any): Promise; /** * Validates all rules for specified object and it's properties. * @param object The object to validate. * @param rules Optional. If unspecified, the implementation should lookup the rules for the * specified object. This may not be possible for all implementations of this interface. */ - abstract validateObject(object: any, rules?: any): Promise; + abstract validateObject(object: any, rules?: any): Promise; /** * Determines whether a rule exists in a set of rules. * @param rules The rules to search. diff --git a/dist/amd/validator.js b/dist/amd/validator.js index f9fa19a1..14961fa5 100644 --- a/dist/amd/validator.js +++ b/dist/amd/validator.js @@ -1,8 +1,7 @@ define(["require", "exports"], function (require, exports) { "use strict"; /** - * Validates. - * Responsible for validating objects and properties. + * Validates objects and properties. */ var Validator = (function () { function Validator() { diff --git a/dist/commonjs/aurelia-validation.d.ts b/dist/commonjs/aurelia-validation.d.ts index b73b53e1..9897cc10 100644 --- a/dist/commonjs/aurelia-validation.d.ts +++ b/dist/commonjs/aurelia-validation.d.ts @@ -1,8 +1,11 @@ +export * from './controller-validate-result'; +export * from './property-info'; export * from './validate-binding-behavior'; +export * from './validate-instruction'; +export * from './validate-result'; export * from './validate-trigger'; export * from './validation-controller'; export * from './validation-controller-factory'; -export * from './validation-error'; export * from './validation-errors-custom-attribute'; export * from './validation-renderer-custom-attribute'; export * from './validation-renderer'; diff --git a/dist/commonjs/aurelia-validation.js b/dist/commonjs/aurelia-validation.js index af4277f2..1b69a7eb 100644 --- a/dist/commonjs/aurelia-validation.js +++ b/dist/commonjs/aurelia-validation.js @@ -3,29 +3,30 @@ function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } -__export(require('./validate-binding-behavior')); -__export(require('./validate-trigger')); -__export(require('./validation-controller')); -__export(require('./validation-controller-factory')); -__export(require('./validation-error')); -__export(require('./validation-errors-custom-attribute')); -__export(require('./validation-renderer-custom-attribute')); -__export(require('./validator')); -__export(require('./implementation/rules')); -__export(require('./implementation/standard-validator')); -__export(require('./implementation/validation-messages')); -__export(require('./implementation/validation-parser')); -__export(require('./implementation/validation-rules')); -var validator_2 = require('./validator'); -var standard_validator_2 = require('./implementation/standard-validator'); -var validation_parser_2 = require('./implementation/validation-parser'); -var validation_rules_2 = require('./implementation/validation-rules'); +__export(require("./property-info")); +__export(require("./validate-binding-behavior")); +__export(require("./validate-result")); +__export(require("./validate-trigger")); +__export(require("./validation-controller")); +__export(require("./validation-controller-factory")); +__export(require("./validation-errors-custom-attribute")); +__export(require("./validation-renderer-custom-attribute")); +__export(require("./validator")); +__export(require("./implementation/rules")); +__export(require("./implementation/standard-validator")); +__export(require("./implementation/validation-messages")); +__export(require("./implementation/validation-parser")); +__export(require("./implementation/validation-rules")); +var validator_1 = require("./validator"); +var standard_validator_1 = require("./implementation/standard-validator"); +var validation_parser_1 = require("./implementation/validation-parser"); +var validation_rules_1 = require("./implementation/validation-rules"); /** * Aurelia Validation Configuration API */ var AureliaValidationConfiguration = (function () { function AureliaValidationConfiguration() { - this.validatorType = standard_validator_2.StandardValidator; + this.validatorType = standard_validator_1.StandardValidator; } /** * Use a custom Validator implementation. @@ -38,7 +39,7 @@ var AureliaValidationConfiguration = (function () { */ AureliaValidationConfiguration.prototype.apply = function (container) { var validator = container.get(this.validatorType); - container.registerInstance(validator_2.Validator, validator); + container.registerInstance(validator_1.Validator, validator); }; return AureliaValidationConfiguration; }()); @@ -49,8 +50,8 @@ exports.AureliaValidationConfiguration = AureliaValidationConfiguration; function configure(frameworkConfig, callback) { // the fluent rule definition API needs the parser to translate messages // to interpolation expressions. - var parser = frameworkConfig.container.get(validation_parser_2.ValidationParser); - validation_rules_2.ValidationRules.initialize(parser); + var parser = frameworkConfig.container.get(validation_parser_1.ValidationParser); + validation_rules_1.ValidationRules.initialize(parser); // configure... var config = new AureliaValidationConfiguration(); if (callback instanceof Function) { diff --git a/dist/commonjs/controller-validate-result.d.ts b/dist/commonjs/controller-validate-result.d.ts new file mode 100644 index 00000000..5f814ed0 --- /dev/null +++ b/dist/commonjs/controller-validate-result.d.ts @@ -0,0 +1,19 @@ +import { ValidateResult } from './validate-result'; +import { ValidateInstruction } from './validate-instruction'; +/** + * The result of a call to the validation controller's validate method. + */ +export interface ControllerValidateResult { + /** + * Whether validation passed. + */ + valid: boolean; + /** + * The validation result of every rule that was evaluated. + */ + results: ValidateResult[]; + /** + * The instruction passed to the controller's validate method. + */ + instruction?: ValidateInstruction; +} diff --git a/dist/commonjs/controller-validate-result.js b/dist/commonjs/controller-validate-result.js new file mode 100644 index 00000000..3918c74e --- /dev/null +++ b/dist/commonjs/controller-validate-result.js @@ -0,0 +1 @@ +"use strict"; diff --git a/dist/commonjs/implementation/rules.js b/dist/commonjs/implementation/rules.js index 3a9b0094..561b7f30 100644 --- a/dist/commonjs/implementation/rules.js +++ b/dist/commonjs/implementation/rules.js @@ -29,10 +29,10 @@ var Rules = (function () { Rules.get = function (target) { return target[Rules.key] || null; }; - /** - * The name of the property that stores the rules. - */ - Rules.key = '__rules__'; return Rules; }()); +/** + * The name of the property that stores the rules. + */ +Rules.key = '__rules__'; exports.Rules = Rules; diff --git a/dist/commonjs/implementation/standard-validator.d.ts b/dist/commonjs/implementation/standard-validator.d.ts index dfe55f31..4d8054ef 100644 --- a/dist/commonjs/implementation/standard-validator.d.ts +++ b/dist/commonjs/implementation/standard-validator.d.ts @@ -1,6 +1,6 @@ import { ViewResources } from 'aurelia-templating'; import { Validator } from '../validator'; -import { ValidationError } from '../validation-error'; +import { ValidateResult } from '../validate-result'; import { Rule } from './rule'; import { ValidationMessageProvider } from './validation-messages'; /** @@ -8,7 +8,7 @@ import { ValidationMessageProvider } from './validation-messages'; * Responsible for validating objects and properties. */ export declare class StandardValidator extends Validator { - static inject: (typeof ValidationMessageProvider | typeof ViewResources)[]; + static inject: (typeof ViewResources | typeof ValidationMessageProvider)[]; private messageProvider; private lookupFunctions; private getDisplayName; @@ -20,14 +20,14 @@ export declare class StandardValidator extends Validator { * @param rules Optional. If unspecified, the rules will be looked up using the metadata * for the object created by ValidationRules....on(class/object) */ - validateProperty(object: any, propertyName: string, rules?: any): Promise; + validateProperty(object: any, propertyName: string, rules?: any): Promise; /** * Validates all rules for specified object and it's properties. * @param object The object to validate. * @param rules Optional. If unspecified, the rules will be looked up using the metadata * for the object created by ValidationRules....on(class/object) */ - validateObject(object: any, rules?: any): Promise; + validateObject(object: any, rules?: any): Promise; /** * Determines whether a rule exists in a set of rules. * @param rules The rules to search. @@ -35,6 +35,6 @@ export declare class StandardValidator extends Validator { */ ruleExists(rules: Rule[][], rule: Rule): boolean; private getMessage(rule, object, value); - private validateRuleSequence(object, propertyName, ruleSequence, sequence); + private validateRuleSequence(object, propertyName, ruleSequence, sequence, results); private validate(object, propertyName, rules); } diff --git a/dist/commonjs/implementation/standard-validator.js b/dist/commonjs/implementation/standard-validator.js index ba08aa86..7924b6fc 100644 --- a/dist/commonjs/implementation/standard-validator.js +++ b/dist/commonjs/implementation/standard-validator.js @@ -4,11 +4,11 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var aurelia_templating_1 = require('aurelia-templating'); -var validator_1 = require('../validator'); -var validation_error_1 = require('../validation-error'); -var rules_1 = require('./rules'); -var validation_messages_1 = require('./validation-messages'); +var aurelia_templating_1 = require("aurelia-templating"); +var validator_1 = require("../validator"); +var validate_result_1 = require("../validate-result"); +var rules_1 = require("./rules"); +var validation_messages_1 = require("./validation-messages"); /** * Validates. * Responsible for validating objects and properties. @@ -16,10 +16,11 @@ var validation_messages_1 = require('./validation-messages'); var StandardValidator = (function (_super) { __extends(StandardValidator, _super); function StandardValidator(messageProvider, resources) { - _super.call(this); - this.messageProvider = messageProvider; - this.lookupFunctions = resources.lookupFunctions; - this.getDisplayName = messageProvider.getDisplayName.bind(messageProvider); + var _this = _super.call(this) || this; + _this.messageProvider = messageProvider; + _this.lookupFunctions = resources.lookupFunctions; + _this.getDisplayName = messageProvider.getDisplayName.bind(messageProvider); + return _this; } /** * Validates the specified property. @@ -57,8 +58,8 @@ var StandardValidator = (function (_super) { StandardValidator.prototype.getMessage = function (rule, object, value) { var expression = rule.message || this.messageProvider.getMessage(rule.messageKey); var _a = rule.property, propertyName = _a.name, displayName = _a.displayName; - if (displayName === null && propertyName !== null) { - displayName = this.messageProvider.getDisplayName(propertyName); + if (propertyName !== null) { + displayName = this.messageProvider.getDisplayName(propertyName, displayName); } var overrideContext = { $displayName: displayName, @@ -70,15 +71,15 @@ var StandardValidator = (function (_super) { }; return expression.evaluate({ bindingContext: object, overrideContext: overrideContext }, this.lookupFunctions); }; - StandardValidator.prototype.validateRuleSequence = function (object, propertyName, ruleSequence, sequence) { + StandardValidator.prototype.validateRuleSequence = function (object, propertyName, ruleSequence, sequence, results) { var _this = this; // are we validating all properties or a single property? var validateAllProperties = propertyName === null || propertyName === undefined; var rules = ruleSequence[sequence]; - var errors = []; + var allValid = true; // validate each rule. var promises = []; - var _loop_1 = function(i) { + var _loop_1 = function (i) { var rule = rules[i]; // is the rule related to the property we're validating. if (!validateAllProperties && rule.property.name !== propertyName) { @@ -94,11 +95,11 @@ var StandardValidator = (function (_super) { if (!(promiseOrBoolean instanceof Promise)) { promiseOrBoolean = Promise.resolve(promiseOrBoolean); } - promises.push(promiseOrBoolean.then(function (isValid) { - if (!isValid) { - var message = _this.getMessage(rule, object, value); - errors.push(new validation_error_1.ValidationError(rule, message, object, rule.property.name)); - } + promises.push(promiseOrBoolean.then(function (valid) { + var message = valid ? null : _this.getMessage(rule, object, value); + results.push(new validate_result_1.ValidateResult(rule, object, rule.property.name, valid, message)); + allValid = allValid && valid; + return valid; })); }; for (var i = 0; i < rules.length; i++) { @@ -107,10 +108,10 @@ var StandardValidator = (function (_super) { return Promise.all(promises) .then(function () { sequence++; - if (errors.length === 0 && sequence < ruleSequence.length) { - return _this.validateRuleSequence(object, propertyName, ruleSequence, sequence); + if (allValid && sequence < ruleSequence.length) { + return _this.validateRuleSequence(object, propertyName, ruleSequence, sequence, results); } - return errors; + return results; }); }; StandardValidator.prototype.validate = function (object, propertyName, rules) { @@ -123,9 +124,9 @@ var StandardValidator = (function (_super) { if (!rules) { return Promise.resolve([]); } - return this.validateRuleSequence(object, propertyName, rules, 0); + return this.validateRuleSequence(object, propertyName, rules, 0, []); }; - StandardValidator.inject = [validation_messages_1.ValidationMessageProvider, aurelia_templating_1.ViewResources]; return StandardValidator; }(validator_1.Validator)); +StandardValidator.inject = [validation_messages_1.ValidationMessageProvider, aurelia_templating_1.ViewResources]; exports.StandardValidator = StandardValidator; diff --git a/dist/commonjs/implementation/validation-messages.d.ts b/dist/commonjs/implementation/validation-messages.d.ts index d9a09450..7a0978d7 100644 --- a/dist/commonjs/implementation/validation-messages.d.ts +++ b/dist/commonjs/implementation/validation-messages.d.ts @@ -20,10 +20,10 @@ export declare class ValidationMessageProvider { */ getMessage(key: string): Expression; /** - * When a display name is not provided, this method is used to formulate - * a display name using the property name. + * Formulates a property display name using the property name and the configured + * displayName (if provided). * Override this with your own custom logic. * @param propertyName The property name. */ - getDisplayName(propertyName: string): string; + getDisplayName(propertyName: string, displayName: string | null | undefined): string; } diff --git a/dist/commonjs/implementation/validation-messages.js b/dist/commonjs/implementation/validation-messages.js index e3eaded9..c231310e 100644 --- a/dist/commonjs/implementation/validation-messages.js +++ b/dist/commonjs/implementation/validation-messages.js @@ -1,5 +1,5 @@ "use strict"; -var validation_parser_1 = require('./validation-parser'); +var validation_parser_1 = require("./validation-parser"); /** * Dictionary of validation messages. [messageKey]: messageExpression */ @@ -39,18 +39,21 @@ var ValidationMessageProvider = (function () { return this.parser.parseMessage(message); }; /** - * When a display name is not provided, this method is used to formulate - * a display name using the property name. + * Formulates a property display name using the property name and the configured + * displayName (if provided). * Override this with your own custom logic. * @param propertyName The property name. */ - ValidationMessageProvider.prototype.getDisplayName = function (propertyName) { + ValidationMessageProvider.prototype.getDisplayName = function (propertyName, displayName) { + if (displayName !== null && displayName !== undefined) { + return displayName; + } // split on upper-case letters. var words = propertyName.split(/(?=[A-Z])/).join(' '); // capitalize first letter. return words.charAt(0).toUpperCase() + words.slice(1); }; - ValidationMessageProvider.inject = [validation_parser_1.ValidationParser]; return ValidationMessageProvider; }()); +ValidationMessageProvider.inject = [validation_parser_1.ValidationParser]; exports.ValidationMessageProvider = ValidationMessageProvider; diff --git a/dist/commonjs/implementation/validation-parser.js b/dist/commonjs/implementation/validation-parser.js index dc6801d6..c3a6f2f1 100644 --- a/dist/commonjs/implementation/validation-parser.js +++ b/dist/commonjs/implementation/validation-parser.js @@ -4,10 +4,10 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var aurelia_binding_1 = require('aurelia-binding'); -var aurelia_templating_1 = require('aurelia-templating'); -var util_1 = require('./util'); -var LogManager = require('aurelia-logging'); +var aurelia_binding_1 = require("aurelia-binding"); +var aurelia_templating_1 = require("aurelia-templating"); +var util_1 = require("./util"); +var LogManager = require("aurelia-logging"); var ValidationParser = (function () { function ValidationParser(parser, bindinqLanguage) { this.parser = parser; @@ -60,15 +60,16 @@ var ValidationParser = (function () { } return this.parser.parse(match[1]); }; - ValidationParser.inject = [aurelia_binding_1.Parser, aurelia_templating_1.BindingLanguage]; return ValidationParser; }()); +ValidationParser.inject = [aurelia_binding_1.Parser, aurelia_templating_1.BindingLanguage]; exports.ValidationParser = ValidationParser; var MessageExpressionValidator = (function (_super) { __extends(MessageExpressionValidator, _super); function MessageExpressionValidator(originalMessage) { - _super.call(this, []); - this.originalMessage = originalMessage; + var _this = _super.call(this, []) || this; + _this.originalMessage = originalMessage; + return _this; } MessageExpressionValidator.validate = function (expression, originalMessage) { var visitor = new MessageExpressionValidator(originalMessage); diff --git a/dist/commonjs/implementation/validation-rules.d.ts b/dist/commonjs/implementation/validation-rules.d.ts index 59ba7410..13251d4d 100644 --- a/dist/commonjs/implementation/validation-rules.d.ts +++ b/dist/commonjs/implementation/validation-rules.d.ts @@ -122,6 +122,12 @@ export declare class FluentRules { argsToConfig?: (...args: any[]) => any; }; }; + /** + * Current rule sequence number. Used to postpone evaluation of rules until rules + * with lower sequence number have successfully validated. The "then" fluent API method + * manages this property, there's usually no need to set it directly. + */ + sequence: number; constructor(fluentEnsure: FluentEnsure, parser: ValidationParser, property: RuleProperty); /** * Sets the display name of the ensured property. @@ -191,7 +197,6 @@ export declare class FluentEnsure { * Rules that have been defined using the fluent API. */ rules: Rule[][]; - _sequence: number; constructor(parser: ValidationParser); /** * Target a property with validation rules. diff --git a/dist/commonjs/implementation/validation-rules.js b/dist/commonjs/implementation/validation-rules.js index 2726596e..5e0ce156 100644 --- a/dist/commonjs/implementation/validation-rules.js +++ b/dist/commonjs/implementation/validation-rules.js @@ -1,7 +1,7 @@ "use strict"; -var util_1 = require('./util'); -var rules_1 = require('./rules'); -var validation_messages_1 = require('./validation-messages'); +var util_1 = require("./util"); +var rules_1 = require("./rules"); +var validation_messages_1 = require("./validation-messages"); /** * Part of the fluent rule API. Enables customizing property rules. */ @@ -18,7 +18,7 @@ var FluentRuleCustomizer = (function () { when: null, messageKey: 'default', message: null, - sequence: fluentEnsure._sequence + sequence: fluentRules.sequence }; this.fluentEnsure._addRule(this.rule); } @@ -28,7 +28,7 @@ var FluentRuleCustomizer = (function () { * rules until less expensive rules pass validation. */ FluentRuleCustomizer.prototype.then = function () { - this.fluentEnsure._sequence++; + this.fluentRules.sequence++; return this; }; /** @@ -186,6 +186,12 @@ var FluentRules = (function () { this.fluentEnsure = fluentEnsure; this.parser = parser; this.property = property; + /** + * Current rule sequence number. Used to postpone evaluation of rules until rules + * with lower sequence number have successfully validated. The "then" fluent API method + * manages this property, there's usually no need to set it directly. + */ + this.sequence = 0; } /** * Sets the display name of the ensured property. @@ -224,7 +230,10 @@ var FluentRules = (function () { throw new Error("Rule with name \"" + name + "\" does not exist."); } var config = rule.argsToConfig ? rule.argsToConfig.apply(rule, args) : undefined; - return this.satisfies(function (value, obj) { return (_a = rule.condition).call.apply(_a, [_this, value, obj].concat(args)); var _a; }, config) + return this.satisfies(function (value, obj) { + return (_a = rule.condition).call.apply(_a, [_this, value, obj].concat(args)); + var _a; + }, config) .withMessageKey(name); }; /** @@ -297,23 +306,20 @@ var FluentRules = (function () { return this.satisfies(function (value) { return value === null || value === undefined || value === '' || value === expectedValue; }, { expectedValue: expectedValue }) .withMessageKey('equals'); }; - FluentRules.customRules = {}; return FluentRules; }()); +FluentRules.customRules = {}; exports.FluentRules = FluentRules; /** * Part of the fluent rule API. Enables targeting properties and objects with rules. */ var FluentEnsure = (function () { - /* tslint:enable */ function FluentEnsure(parser) { this.parser = parser; /** * Rules that have been defined using the fluent API. */ this.rules = []; - /* tslint:disable */ - this._sequence = 0; } /** * Target a property with validation rules. diff --git a/dist/commonjs/property-info.js b/dist/commonjs/property-info.js index b639dbd3..adf83ce6 100644 --- a/dist/commonjs/property-info.js +++ b/dist/commonjs/property-info.js @@ -1,5 +1,5 @@ "use strict"; -var aurelia_binding_1 = require('aurelia-binding'); +var aurelia_binding_1 = require("aurelia-binding"); function getObject(expression, objectExpression, source) { var value = objectExpression.evaluate(source, null); if (value === null || value === undefined || value instanceof Object) { diff --git a/dist/commonjs/validate-binding-behavior-base.js b/dist/commonjs/validate-binding-behavior-base.js index b54e1aac..8efc5786 100644 --- a/dist/commonjs/validate-binding-behavior-base.js +++ b/dist/commonjs/validate-binding-behavior-base.js @@ -1,8 +1,8 @@ "use strict"; -var aurelia_dependency_injection_1 = require('aurelia-dependency-injection'); -var aurelia_pal_1 = require('aurelia-pal'); -var validation_controller_1 = require('./validation-controller'); -var validate_trigger_1 = require('./validate-trigger'); +var aurelia_dependency_injection_1 = require("aurelia-dependency-injection"); +var aurelia_pal_1 = require("aurelia-pal"); +var validation_controller_1 = require("./validation-controller"); +var validate_trigger_1 = require("./validate-trigger"); /** * Binding behavior. Indicates the bound property should be validated. */ diff --git a/dist/commonjs/validate-binding-behavior.js b/dist/commonjs/validate-binding-behavior.js index e19b1c20..0f5aa1ff 100644 --- a/dist/commonjs/validate-binding-behavior.js +++ b/dist/commonjs/validate-binding-behavior.js @@ -4,9 +4,9 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var aurelia_task_queue_1 = require('aurelia-task-queue'); -var validate_trigger_1 = require('./validate-trigger'); -var validate_binding_behavior_base_1 = require('./validate-binding-behavior-base'); +var aurelia_task_queue_1 = require("aurelia-task-queue"); +var validate_trigger_1 = require("./validate-trigger"); +var validate_binding_behavior_base_1 = require("./validate-binding-behavior-base"); /** * Binding behavior. Indicates the bound property should be validated * when the validate trigger specified by the associated controller's @@ -15,14 +15,14 @@ var validate_binding_behavior_base_1 = require('./validate-binding-behavior-base var ValidateBindingBehavior = (function (_super) { __extends(ValidateBindingBehavior, _super); function ValidateBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateBindingBehavior.prototype.getValidateTrigger = function (controller) { return controller.validateTrigger; }; - ValidateBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); +ValidateBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports.ValidateBindingBehavior = ValidateBindingBehavior; /** * Binding behavior. Indicates the bound property will be validated @@ -32,14 +32,14 @@ exports.ValidateBindingBehavior = ValidateBindingBehavior; var ValidateManuallyBindingBehavior = (function (_super) { __extends(ValidateManuallyBindingBehavior, _super); function ValidateManuallyBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateManuallyBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.manual; }; - ValidateManuallyBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateManuallyBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); +ValidateManuallyBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports.ValidateManuallyBindingBehavior = ValidateManuallyBindingBehavior; /** * Binding behavior. Indicates the bound property should be validated @@ -48,14 +48,14 @@ exports.ValidateManuallyBindingBehavior = ValidateManuallyBindingBehavior; var ValidateOnBlurBindingBehavior = (function (_super) { __extends(ValidateOnBlurBindingBehavior, _super); function ValidateOnBlurBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateOnBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.blur; }; - ValidateOnBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateOnBlurBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); +ValidateOnBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports.ValidateOnBlurBindingBehavior = ValidateOnBlurBindingBehavior; /** * Binding behavior. Indicates the bound property should be validated @@ -65,14 +65,14 @@ exports.ValidateOnBlurBindingBehavior = ValidateOnBlurBindingBehavior; var ValidateOnChangeBindingBehavior = (function (_super) { __extends(ValidateOnChangeBindingBehavior, _super); function ValidateOnChangeBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateOnChangeBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.change; }; - ValidateOnChangeBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateOnChangeBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); +ValidateOnChangeBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports.ValidateOnChangeBindingBehavior = ValidateOnChangeBindingBehavior; /** * Binding behavior. Indicates the bound property should be validated @@ -82,12 +82,12 @@ exports.ValidateOnChangeBindingBehavior = ValidateOnChangeBindingBehavior; var ValidateOnChangeOrBlurBindingBehavior = (function (_super) { __extends(ValidateOnChangeOrBlurBindingBehavior, _super); function ValidateOnChangeOrBlurBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateOnChangeOrBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.changeOrBlur; }; - ValidateOnChangeOrBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateOnChangeOrBlurBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); +ValidateOnChangeOrBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports.ValidateOnChangeOrBlurBindingBehavior = ValidateOnChangeOrBlurBindingBehavior; diff --git a/dist/commonjs/validate-instruction.d.ts b/dist/commonjs/validate-instruction.d.ts new file mode 100644 index 00000000..2f792a70 --- /dev/null +++ b/dist/commonjs/validate-instruction.d.ts @@ -0,0 +1,17 @@ +/** + * Instructions for the validation controller's validate method. + */ +export interface ValidateInstruction { + /** + * The object to validate. + */ + object: any; + /** + * The property to validate. Optional. + */ + propertyName?: any; + /** + * The rules to validate. Optional. + */ + rules?: any; +} diff --git a/dist/commonjs/validate-instruction.js b/dist/commonjs/validate-instruction.js new file mode 100644 index 00000000..3918c74e --- /dev/null +++ b/dist/commonjs/validate-instruction.js @@ -0,0 +1 @@ +"use strict"; diff --git a/dist/commonjs/validate-result.d.ts b/dist/commonjs/validate-result.d.ts new file mode 100644 index 00000000..461c2318 --- /dev/null +++ b/dist/commonjs/validate-result.d.ts @@ -0,0 +1,23 @@ +/** + * The result of validating an individual validation rule. + */ +export declare class ValidateResult { + rule: any; + object: any; + propertyName: string | null; + valid: boolean; + message: string | null; + private static nextId; + /** + * A number that uniquely identifies the result instance. + */ + id: number; + /** + * @param rule The rule associated with the result. Validator implementation specific. + * @param object The object that was validated. + * @param propertyName The name of the property that was validated. + * @param error The error, if the result is a validation error. + */ + constructor(rule: any, object: any, propertyName: string | null, valid: boolean, message?: string | null); + toString(): string | null; +} diff --git a/dist/commonjs/validate-result.js b/dist/commonjs/validate-result.js new file mode 100644 index 00000000..82031a67 --- /dev/null +++ b/dist/commonjs/validate-result.js @@ -0,0 +1,27 @@ +"use strict"; +/** + * The result of validating an individual validation rule. + */ +var ValidateResult = (function () { + /** + * @param rule The rule associated with the result. Validator implementation specific. + * @param object The object that was validated. + * @param propertyName The name of the property that was validated. + * @param error The error, if the result is a validation error. + */ + function ValidateResult(rule, object, propertyName, valid, message) { + if (message === void 0) { message = null; } + this.rule = rule; + this.object = object; + this.propertyName = propertyName; + this.valid = valid; + this.message = message; + this.id = ValidateResult.nextId++; + } + ValidateResult.prototype.toString = function () { + return this.valid ? 'Valid.' : this.message; + }; + return ValidateResult; +}()); +ValidateResult.nextId = 0; +exports.ValidateResult = ValidateResult; diff --git a/dist/commonjs/validation-controller-factory.js b/dist/commonjs/validation-controller-factory.js index f358350e..c2ca0172 100644 --- a/dist/commonjs/validation-controller-factory.js +++ b/dist/commonjs/validation-controller-factory.js @@ -1,6 +1,6 @@ "use strict"; -var validation_controller_1 = require('./validation-controller'); -var validator_1 = require('./validator'); +var validation_controller_1 = require("./validation-controller"); +var validator_1 = require("./validator"); /** * Creates ValidationController instances. */ diff --git a/dist/commonjs/validation-controller.d.ts b/dist/commonjs/validation-controller.d.ts index a65621f3..d88935e5 100644 --- a/dist/commonjs/validation-controller.d.ts +++ b/dist/commonjs/validation-controller.d.ts @@ -1,25 +1,13 @@ import { Binding } from 'aurelia-binding'; import { Validator } from './validator'; import { ValidationRenderer } from './validation-renderer'; -import { ValidationError } from './validation-error'; -export interface ValidateInstruction { - /** - * The object to validate. - */ - object: any; - /** - * The property to validate. Optional. - */ - propertyName?: any; - /** - * The rules to validate. Optional. - */ - rules?: any; -} +import { ValidateResult } from './validate-result'; +import { ValidateInstruction } from './validate-instruction'; +import { ControllerValidateResult } from './controller-validate-result'; /** * Orchestrates validation. * Manages a set of bindings, renderers and objects. - * Exposes the current list of validation errors for binding purposes. + * Exposes the current list of validation results for binding purposes. */ export declare class ValidationController { private validator; @@ -27,9 +15,13 @@ export declare class ValidationController { private bindings; private renderers; /** - * Errors that have been rendered by the controller. + * Validation results that have been rendered by the controller. + */ + private results; + /** + * Validation errors that have been rendered by the controller. */ - errors: ValidationError[]; + errors: ValidateResult[]; /** * Whether the controller is currently validating. */ @@ -54,13 +46,13 @@ export declare class ValidationController { */ removeObject(object: any): void; /** - * Adds and renders a ValidationError. + * Adds and renders an error. */ - addError(message: string, object: any, propertyName?: string): ValidationError; + addError(message: string, object: any, propertyName?: string | null): ValidateResult; /** - * Removes and unrenders a ValidationError. + * Removes and unrenders an error. */ - removeError(error: ValidationError): void; + removeError(result: ValidateResult): void; /** * Adds a renderer. * @param renderer The renderer. @@ -85,31 +77,32 @@ export declare class ValidationController { unregisterBinding(binding: Binding): void; /** * Interprets the instruction and returns a predicate that will identify - * relevant errors in the list of rendered errors. + * relevant results in the list of rendered validation results. */ private getInstructionPredicate(instruction?); /** - * Validates and renders errors. + * Validates and renders results. * @param instruction Optional. Instructions on what to validate. If undefined, all * objects and bindings will be validated. */ - validate(instruction?: ValidateInstruction): Promise; + validate(instruction?: ValidateInstruction): Promise; /** - * Resets any rendered errors (unrenders). - * @param instruction Optional. Instructions on what to reset. If unspecified all rendered errors will be unrendered. + * Resets any rendered validation results (unrenders). + * @param instruction Optional. Instructions on what to reset. If unspecified all rendered results + * will be unrendered. */ reset(instruction?: ValidateInstruction): void; /** * Gets the elements associated with an object and propertyName (if any). */ private getAssociatedElements({object, propertyName}); - private processErrorDelta(kind, oldErrors, newErrors); + private processResultDelta(kind, oldResults, newResults); /** * Validates the property associated with a binding. */ validateBinding(binding: Binding): void; /** - * Resets the errors for a property associated with a binding. + * Resets the results for a property associated with a binding. */ resetBinding(binding: Binding): void; } diff --git a/dist/commonjs/validation-controller.js b/dist/commonjs/validation-controller.js index 461e099b..d3415b61 100644 --- a/dist/commonjs/validation-controller.js +++ b/dist/commonjs/validation-controller.js @@ -1,12 +1,12 @@ "use strict"; -var validator_1 = require('./validator'); -var validate_trigger_1 = require('./validate-trigger'); -var property_info_1 = require('./property-info'); -var validation_error_1 = require('./validation-error'); +var validator_1 = require("./validator"); +var validate_trigger_1 = require("./validate-trigger"); +var property_info_1 = require("./property-info"); +var validate_result_1 = require("./validate-result"); /** * Orchestrates validation. * Manages a set of bindings, renderers and objects. - * Exposes the current list of validation errors for binding purposes. + * Exposes the current list of validation results for binding purposes. */ var ValidationController = (function () { function ValidationController(validator) { @@ -16,14 +16,18 @@ var ValidationController = (function () { // Renderers that have been added to the controller instance. this.renderers = []; /** - * Errors that have been rendered by the controller. + * Validation results that have been rendered by the controller. + */ + this.results = []; + /** + * Validation errors that have been rendered by the controller. */ this.errors = []; /** * Whether the controller is currently validating. */ this.validating = false; - // Elements related to errors that have been rendered. + // Elements related to validation results that have been rendered. this.elements = new Map(); // Objects that have been added to the controller instance (entity-style validation). this.objects = new Map(); @@ -48,22 +52,23 @@ var ValidationController = (function () { */ ValidationController.prototype.removeObject = function (object) { this.objects.delete(object); - this.processErrorDelta('reset', this.errors.filter(function (error) { return error.object === object; }), []); + this.processResultDelta('reset', this.results.filter(function (result) { return result.object === object; }), []); }; /** - * Adds and renders a ValidationError. + * Adds and renders an error. */ ValidationController.prototype.addError = function (message, object, propertyName) { - var error = new validation_error_1.ValidationError({}, message, object, propertyName); - this.processErrorDelta('validate', [], [error]); - return error; + if (propertyName === void 0) { propertyName = null; } + var result = new validate_result_1.ValidateResult({}, object, propertyName, false, message); + this.processResultDelta('validate', [], [result]); + return result; }; /** - * Removes and unrenders a ValidationError. + * Removes and unrenders an error. */ - ValidationController.prototype.removeError = function (error) { - if (this.errors.indexOf(error) !== -1) { - this.processErrorDelta('reset', [error], []); + ValidationController.prototype.removeError = function (result) { + if (this.results.indexOf(result) !== -1) { + this.processResultDelta('reset', [result], []); } }; /** @@ -75,7 +80,7 @@ var ValidationController = (function () { this.renderers.push(renderer); renderer.render({ kind: 'validate', - render: this.errors.map(function (error) { return ({ error: error, elements: _this.elements.get(error) }); }), + render: this.results.map(function (result) { return ({ result: result, elements: _this.elements.get(result) }); }), unrender: [] }); }; @@ -89,7 +94,7 @@ var ValidationController = (function () { renderer.render({ kind: 'reset', render: [], - unrender: this.errors.map(function (error) { return ({ error: error, elements: _this.elements.get(error) }); }) + unrender: this.results.map(function (result) { return ({ result: result, elements: _this.elements.get(result) }); }) }); }; /** @@ -111,7 +116,7 @@ var ValidationController = (function () { }; /** * Interprets the instruction and returns a predicate that will identify - * relevant errors in the list of rendered errors. + * relevant results in the list of rendered validation results. */ ValidationController.prototype.getInstructionPredicate = function (instruction) { var _this = this; @@ -134,7 +139,7 @@ var ValidationController = (function () { } }; /** - * Validates and renders errors. + * Validates and renders results. * @param instruction Optional. Instructions on what to validate. If undefined, all * objects and bindings will be validated. */ @@ -172,39 +177,45 @@ var ValidationController = (function () { } promises.push(_this.validator.validateProperty(propertyInfo.object, propertyInfo.propertyName, rules)); } - return Promise.all(promises).then(function (errorSets) { return errorSets.reduce(function (a, b) { return a.concat(b); }, []); }); + return Promise.all(promises).then(function (resultSets) { return resultSets.reduce(function (a, b) { return a.concat(b); }, []); }); }; } - // Wait for any existing validation to finish, execute the instruction, render the errors. + // Wait for any existing validation to finish, execute the instruction, render the results. this.validating = true; - var result = this.finishValidating + var returnPromise = this.finishValidating .then(execute) - .then(function (newErrors) { + .then(function (newResults) { var predicate = _this.getInstructionPredicate(instruction); - var oldErrors = _this.errors.filter(predicate); - _this.processErrorDelta('validate', oldErrors, newErrors); - if (result === _this.finishValidating) { + var oldResults = _this.results.filter(predicate); + _this.processResultDelta('validate', oldResults, newResults); + if (returnPromise === _this.finishValidating) { _this.validating = false; } - return newErrors; + var result = { + instruction: instruction, + valid: newResults.find(function (x) { return !x.valid; }) === undefined, + results: newResults + }; + return result; }) - .catch(function (error) { + .catch(function (exception) { // recover, to enable subsequent calls to validate() _this.validating = false; _this.finishValidating = Promise.resolve(); - return Promise.reject(error); + return Promise.reject(exception); }); - this.finishValidating = result; - return result; + this.finishValidating = returnPromise; + return returnPromise; }; /** - * Resets any rendered errors (unrenders). - * @param instruction Optional. Instructions on what to reset. If unspecified all rendered errors will be unrendered. + * Resets any rendered validation results (unrenders). + * @param instruction Optional. Instructions on what to reset. If unspecified all rendered results + * will be unrendered. */ ValidationController.prototype.reset = function (instruction) { var predicate = this.getInstructionPredicate(instruction); - var oldErrors = this.errors.filter(predicate); - this.processErrorDelta('reset', oldErrors, []); + var oldResults = this.results.filter(predicate); + this.processResultDelta('reset', oldResults, []); }; /** * Gets the elements associated with an object and propertyName (if any). @@ -221,54 +232,66 @@ var ValidationController = (function () { } return elements; }; - ValidationController.prototype.processErrorDelta = function (kind, oldErrors, newErrors) { + ValidationController.prototype.processResultDelta = function (kind, oldResults, newResults) { // prepare the instruction. var instruction = { kind: kind, render: [], unrender: [] }; - // create a shallow copy of newErrors so we can mutate it without causing side-effects. - newErrors = newErrors.slice(0); - // create unrender instructions from the old errors. - var _loop_1 = function(oldError) { - // get the elements associated with the old error. - var elements = this_1.elements.get(oldError); - // remove the old error from the element map. - this_1.elements.delete(oldError); + // create a shallow copy of newResults so we can mutate it without causing side-effects. + newResults = newResults.slice(0); + var _loop_1 = function (oldResult) { + // get the elements associated with the old result. + var elements = this_1.elements.get(oldResult); + // remove the old result from the element map. + this_1.elements.delete(oldResult); // create the unrender instruction. - instruction.unrender.push({ error: oldError, elements: elements }); - // determine if there's a corresponding new error for the old error we are unrendering. - var newErrorIndex = newErrors.findIndex(function (x) { return x.rule === oldError.rule && x.object === oldError.object && x.propertyName === oldError.propertyName; }); - if (newErrorIndex === -1) { - // no corresponding new error... simple remove. - this_1.errors.splice(this_1.errors.indexOf(oldError), 1); + instruction.unrender.push({ result: oldResult, elements: elements }); + // determine if there's a corresponding new result for the old result we are unrendering. + var newResultIndex = newResults.findIndex(function (x) { return x.rule === oldResult.rule && x.object === oldResult.object && x.propertyName === oldResult.propertyName; }); + if (newResultIndex === -1) { + // no corresponding new result... simple remove. + this_1.results.splice(this_1.results.indexOf(oldResult), 1); + if (!oldResult.valid) { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1); + } } else { - // there is a corresponding new error... - var newError = newErrors.splice(newErrorIndex, 1)[0]; - // get the elements that are associated with the new error. - var elements_1 = this_1.getAssociatedElements(newError); - this_1.elements.set(newError, elements_1); - // create a render instruction for the new error. - instruction.render.push({ error: newError, elements: elements_1 }); - // do an in-place replacement of the old error with the new error. - // this ensures any repeats bound to this.errors will not thrash. - this_1.errors.splice(this_1.errors.indexOf(oldError), 1, newError); + // there is a corresponding new result... + var newResult = newResults.splice(newResultIndex, 1)[0]; + // get the elements that are associated with the new result. + var elements_1 = this_1.getAssociatedElements(newResult); + this_1.elements.set(newResult, elements_1); + // create a render instruction for the new result. + instruction.render.push({ result: newResult, elements: elements_1 }); + // do an in-place replacement of the old result with the new result. + // this ensures any repeats bound to this.results will not thrash. + this_1.results.splice(this_1.results.indexOf(oldResult), 1, newResult); + if (newResult.valid) { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1); + } + else { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1, newResult); + } } }; var this_1 = this; - for (var _i = 0, oldErrors_1 = oldErrors; _i < oldErrors_1.length; _i++) { - var oldError = oldErrors_1[_i]; - _loop_1(oldError); + // create unrender instructions from the old results. + for (var _i = 0, oldResults_1 = oldResults; _i < oldResults_1.length; _i++) { + var oldResult = oldResults_1[_i]; + _loop_1(oldResult); } - // create render instructions from the remaining new errors. - for (var _a = 0, newErrors_1 = newErrors; _a < newErrors_1.length; _a++) { - var error = newErrors_1[_a]; - var elements = this.getAssociatedElements(error); - instruction.render.push({ error: error, elements: elements }); - this.elements.set(error, elements); - this.errors.push(error); + // create render instructions from the remaining new results. + for (var _a = 0, newResults_1 = newResults; _a < newResults_1.length; _a++) { + var result = newResults_1[_a]; + var elements = this.getAssociatedElements(result); + instruction.render.push({ result: result, elements: elements }); + this.elements.set(result, elements); + this.results.push(result); + if (!result.valid) { + this.errors.push(result); + } } // render. for (var _b = 0, _c = this.renderers; _b < _c.length; _b++) { @@ -297,7 +320,7 @@ var ValidationController = (function () { this.validate({ object: object, propertyName: propertyName, rules: rules }); }; /** - * Resets the errors for a property associated with a binding. + * Resets the results for a property associated with a binding. */ ValidationController.prototype.resetBinding = function (binding) { var registeredBinding = this.bindings.get(binding); @@ -314,7 +337,7 @@ var ValidationController = (function () { var object = propertyInfo.object, propertyName = propertyInfo.propertyName; this.reset({ object: object, propertyName: propertyName }); }; - ValidationController.inject = [validator_1.Validator]; return ValidationController; }()); +ValidationController.inject = [validator_1.Validator]; exports.ValidationController = ValidationController; diff --git a/dist/commonjs/validation-error.d.ts b/dist/commonjs/validation-error.d.ts deleted file mode 100644 index 34064d03..00000000 --- a/dist/commonjs/validation-error.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A validation error. - */ -export declare class ValidationError { - rule: any; - message: string; - object: any; - propertyName: string | null; - private static nextId; - /** - * A number that uniquely identifies the error instance. - */ - id: number; - /** - * @param rule The rule associated with the error. Validator implementation specific. - * @param message The error message. - * @param object The invalid object - * @param propertyName The name of the invalid property. Optional. - */ - constructor(rule: any, message: string, object: any, propertyName?: string | null); - toString(): string; -} diff --git a/dist/commonjs/validation-error.js b/dist/commonjs/validation-error.js deleted file mode 100644 index e6dd0cc0..00000000 --- a/dist/commonjs/validation-error.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -/** - * A validation error. - */ -var ValidationError = (function () { - /** - * @param rule The rule associated with the error. Validator implementation specific. - * @param message The error message. - * @param object The invalid object - * @param propertyName The name of the invalid property. Optional. - */ - function ValidationError(rule, message, object, propertyName) { - if (propertyName === void 0) { propertyName = null; } - this.rule = rule; - this.message = message; - this.object = object; - this.propertyName = propertyName; - this.id = ValidationError.nextId++; - } - ValidationError.prototype.toString = function () { - return this.message; - }; - ValidationError.nextId = 0; - return ValidationError; -}()); -exports.ValidationError = ValidationError; diff --git a/dist/commonjs/validation-errors-custom-attribute.d.ts b/dist/commonjs/validation-errors-custom-attribute.d.ts index 9342dd0d..73340e73 100644 --- a/dist/commonjs/validation-errors-custom-attribute.d.ts +++ b/dist/commonjs/validation-errors-custom-attribute.d.ts @@ -1,9 +1,9 @@ import { Lazy } from 'aurelia-dependency-injection'; import { ValidationController } from './validation-controller'; -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; import { ValidationRenderer, RenderInstruction } from './validation-renderer'; export interface RenderedError { - error: ValidationError; + error: ValidateResult; targets: Element[]; } export declare class ValidationErrorsCustomAttribute implements ValidationRenderer { diff --git a/dist/commonjs/validation-errors-custom-attribute.js b/dist/commonjs/validation-errors-custom-attribute.js index 24098a40..55a54a29 100644 --- a/dist/commonjs/validation-errors-custom-attribute.js +++ b/dist/commonjs/validation-errors-custom-attribute.js @@ -5,10 +5,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -var aurelia_binding_1 = require('aurelia-binding'); -var aurelia_dependency_injection_1 = require('aurelia-dependency-injection'); -var aurelia_templating_1 = require('aurelia-templating'); -var validation_controller_1 = require('./validation-controller'); +var aurelia_binding_1 = require("aurelia-binding"); +var aurelia_dependency_injection_1 = require("aurelia-dependency-injection"); +var aurelia_templating_1 = require("aurelia-templating"); +var validation_controller_1 = require("./validation-controller"); var ValidationErrorsCustomAttribute = (function () { function ValidationErrorsCustomAttribute(boundaryElement, controllerAccessor) { this.boundaryElement = boundaryElement; @@ -30,22 +30,25 @@ var ValidationErrorsCustomAttribute = (function () { return elements.filter(function (e) { return _this.boundaryElement.contains(e); }); }; ValidationErrorsCustomAttribute.prototype.render = function (instruction) { - var _loop_1 = function(error) { - var index = this_1.errors.findIndex(function (x) { return x.error === error; }); + var _loop_1 = function (result) { + var index = this_1.errors.findIndex(function (x) { return x.error === result; }); if (index !== -1) { this_1.errors.splice(index, 1); } }; var this_1 = this; for (var _i = 0, _a = instruction.unrender; _i < _a.length; _i++) { - var error = _a[_i].error; - _loop_1(error); + var result = _a[_i].result; + _loop_1(result); } for (var _b = 0, _c = instruction.render; _b < _c.length; _b++) { - var _d = _c[_b], error = _d.error, elements = _d.elements; + var _d = _c[_b], result = _d.result, elements = _d.elements; + if (result.valid) { + continue; + } var targets = this.interestingElements(elements); if (targets.length) { - this.errors.push({ error: error, targets: targets }); + this.errors.push({ error: result, targets: targets }); } } this.sort(); @@ -58,10 +61,10 @@ var ValidationErrorsCustomAttribute = (function () { ValidationErrorsCustomAttribute.prototype.unbind = function () { this.controllerAccessor().removeRenderer(this); }; - ValidationErrorsCustomAttribute.inject = [Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; - ValidationErrorsCustomAttribute = __decorate([ - aurelia_templating_1.customAttribute('validation-errors', aurelia_binding_1.bindingMode.twoWay) - ], ValidationErrorsCustomAttribute); return ValidationErrorsCustomAttribute; }()); +ValidationErrorsCustomAttribute.inject = [Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; +ValidationErrorsCustomAttribute = __decorate([ + aurelia_templating_1.customAttribute('validation-errors', aurelia_binding_1.bindingMode.twoWay) +], ValidationErrorsCustomAttribute); exports.ValidationErrorsCustomAttribute = ValidationErrorsCustomAttribute; diff --git a/dist/commonjs/validation-renderer-custom-attribute.js b/dist/commonjs/validation-renderer-custom-attribute.js index 6e01da2d..b9b45e61 100644 --- a/dist/commonjs/validation-renderer-custom-attribute.js +++ b/dist/commonjs/validation-renderer-custom-attribute.js @@ -1,5 +1,5 @@ "use strict"; -var validation_controller_1 = require('./validation-controller'); +var validation_controller_1 = require("./validation-controller"); var ValidationRendererCustomAttribute = (function () { function ValidationRendererCustomAttribute() { } diff --git a/dist/commonjs/validation-renderer.d.ts b/dist/commonjs/validation-renderer.d.ts index 0422409b..eb430d9d 100644 --- a/dist/commonjs/validation-renderer.d.ts +++ b/dist/commonjs/validation-renderer.d.ts @@ -1,19 +1,19 @@ -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; /** - * An error to render (or unrender) and the associated elements (if any) + * A result to render (or unrender) and the associated elements (if any) */ -export interface RenderErrorInstruction { +export interface ResultInstruction { /** - * The validation error. + * The validation result. */ - error: ValidationError; + result: ValidateResult; /** * The associated elements (if any). */ elements: Element[]; } /** - * Defines which errors to render and which errors to unrender. + * Defines which validation results to render and which validation results to unrender. */ export interface RenderInstruction { /** @@ -21,22 +21,22 @@ export interface RenderInstruction { */ kind: 'validate' | 'reset'; /** - * The errors to render. + * The results to render. */ - render: RenderErrorInstruction[]; + render: ResultInstruction[]; /** - * The errors to unrender. + * The results to unrender. */ - unrender: RenderErrorInstruction[]; + unrender: ResultInstruction[]; } /** - * Renders validation errors. + * Renders validation results. */ export interface ValidationRenderer { /** - * Render the errors. - * @param instruction The render instruction. Defines which errors to render and which - * errors to unrender. + * Render the validation results. + * @param instruction The render instruction. Defines which results to render and which + * results to unrender. */ render(instruction: RenderInstruction): void; } diff --git a/dist/commonjs/validator.d.ts b/dist/commonjs/validator.d.ts index edaa3f40..82c045e8 100644 --- a/dist/commonjs/validator.d.ts +++ b/dist/commonjs/validator.d.ts @@ -1,7 +1,6 @@ -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; /** - * Validates. - * Responsible for validating objects and properties. + * Validates objects and properties. */ export declare abstract class Validator { /** @@ -11,14 +10,14 @@ export declare abstract class Validator { * @param rules Optional. If unspecified, the implementation should lookup the rules for the * specified object. This may not be possible for all implementations of this interface. */ - abstract validateProperty(object: any, propertyName: string, rules?: any): Promise; + abstract validateProperty(object: any, propertyName: string, rules?: any): Promise; /** * Validates all rules for specified object and it's properties. * @param object The object to validate. * @param rules Optional. If unspecified, the implementation should lookup the rules for the * specified object. This may not be possible for all implementations of this interface. */ - abstract validateObject(object: any, rules?: any): Promise; + abstract validateObject(object: any, rules?: any): Promise; /** * Determines whether a rule exists in a set of rules. * @param rules The rules to search. diff --git a/dist/commonjs/validator.js b/dist/commonjs/validator.js index 9acbe005..2aa10d90 100644 --- a/dist/commonjs/validator.js +++ b/dist/commonjs/validator.js @@ -1,7 +1,6 @@ "use strict"; /** - * Validates. - * Responsible for validating objects and properties. + * Validates objects and properties. */ var Validator = (function () { function Validator() { diff --git a/dist/es2015/aurelia-validation.d.ts b/dist/es2015/aurelia-validation.d.ts index b73b53e1..9897cc10 100644 --- a/dist/es2015/aurelia-validation.d.ts +++ b/dist/es2015/aurelia-validation.d.ts @@ -1,8 +1,11 @@ +export * from './controller-validate-result'; +export * from './property-info'; export * from './validate-binding-behavior'; +export * from './validate-instruction'; +export * from './validate-result'; export * from './validate-trigger'; export * from './validation-controller'; export * from './validation-controller-factory'; -export * from './validation-error'; export * from './validation-errors-custom-attribute'; export * from './validation-renderer-custom-attribute'; export * from './validation-renderer'; diff --git a/dist/es2015/aurelia-validation.js b/dist/es2015/aurelia-validation.js index 662e4413..0e7313fd 100644 --- a/dist/es2015/aurelia-validation.js +++ b/dist/es2015/aurelia-validation.js @@ -1,14 +1,13 @@ // Exports +export * from './property-info'; export * from './validate-binding-behavior'; +export * from './validate-result'; export * from './validate-trigger'; export * from './validation-controller'; export * from './validation-controller-factory'; -export * from './validation-error'; export * from './validation-errors-custom-attribute'; export * from './validation-renderer-custom-attribute'; -export * from './validation-renderer'; export * from './validator'; -export * from './implementation/rule'; export * from './implementation/rules'; export * from './implementation/standard-validator'; export * from './implementation/validation-messages'; @@ -21,34 +20,36 @@ import { ValidationRules } from './implementation/validation-rules'; /** * Aurelia Validation Configuration API */ -export class AureliaValidationConfiguration { - constructor() { +var AureliaValidationConfiguration = (function () { + function AureliaValidationConfiguration() { this.validatorType = StandardValidator; } /** * Use a custom Validator implementation. */ - customValidator(type) { + AureliaValidationConfiguration.prototype.customValidator = function (type) { this.validatorType = type; - } + }; /** * Applies the configuration. */ - apply(container) { - const validator = container.get(this.validatorType); + AureliaValidationConfiguration.prototype.apply = function (container) { + var validator = container.get(this.validatorType); container.registerInstance(Validator, validator); - } -} + }; + return AureliaValidationConfiguration; +}()); +export { AureliaValidationConfiguration }; /** * Configures the plugin. */ export function configure(frameworkConfig, callback) { // the fluent rule definition API needs the parser to translate messages // to interpolation expressions. - const parser = frameworkConfig.container.get(ValidationParser); + var parser = frameworkConfig.container.get(ValidationParser); ValidationRules.initialize(parser); // configure... - const config = new AureliaValidationConfiguration(); + var config = new AureliaValidationConfiguration(); if (callback instanceof Function) { callback(config); } diff --git a/dist/es2015/controller-validate-result.d.ts b/dist/es2015/controller-validate-result.d.ts new file mode 100644 index 00000000..5f814ed0 --- /dev/null +++ b/dist/es2015/controller-validate-result.d.ts @@ -0,0 +1,19 @@ +import { ValidateResult } from './validate-result'; +import { ValidateInstruction } from './validate-instruction'; +/** + * The result of a call to the validation controller's validate method. + */ +export interface ControllerValidateResult { + /** + * Whether validation passed. + */ + valid: boolean; + /** + * The validation result of every rule that was evaluated. + */ + results: ValidateResult[]; + /** + * The instruction passed to the controller's validate method. + */ + instruction?: ValidateInstruction; +} diff --git a/dist/native-modules/implementation/rule.js b/dist/es2015/controller-validate-result.js similarity index 100% rename from dist/native-modules/implementation/rule.js rename to dist/es2015/controller-validate-result.js diff --git a/dist/es2015/implementation/rules.js b/dist/es2015/implementation/rules.js index db8977e5..3ac2caaa 100644 --- a/dist/es2015/implementation/rules.js +++ b/dist/es2015/implementation/rules.js @@ -1,32 +1,36 @@ /** * Sets, unsets and retrieves rules on an object or constructor function. */ -export class Rules { +var Rules = (function () { + function Rules() { + } /** * Applies the rules to a target. */ - static set(target, rules) { + Rules.set = function (target, rules) { if (target instanceof Function) { target = target.prototype; } Object.defineProperty(target, Rules.key, { enumerable: false, configurable: false, writable: true, value: rules }); - } + }; /** * Removes rules from a target. */ - static unset(target) { + Rules.unset = function (target) { if (target instanceof Function) { target = target.prototype; } target[Rules.key] = null; - } + }; /** * Retrieves the target's rules. */ - static get(target) { + Rules.get = function (target) { return target[Rules.key] || null; - } -} + }; + return Rules; +}()); +export { Rules }; /** * The name of the property that stores the rules. */ diff --git a/dist/es2015/implementation/standard-validator.d.ts b/dist/es2015/implementation/standard-validator.d.ts index dfe55f31..4d8054ef 100644 --- a/dist/es2015/implementation/standard-validator.d.ts +++ b/dist/es2015/implementation/standard-validator.d.ts @@ -1,6 +1,6 @@ import { ViewResources } from 'aurelia-templating'; import { Validator } from '../validator'; -import { ValidationError } from '../validation-error'; +import { ValidateResult } from '../validate-result'; import { Rule } from './rule'; import { ValidationMessageProvider } from './validation-messages'; /** @@ -8,7 +8,7 @@ import { ValidationMessageProvider } from './validation-messages'; * Responsible for validating objects and properties. */ export declare class StandardValidator extends Validator { - static inject: (typeof ValidationMessageProvider | typeof ViewResources)[]; + static inject: (typeof ViewResources | typeof ValidationMessageProvider)[]; private messageProvider; private lookupFunctions; private getDisplayName; @@ -20,14 +20,14 @@ export declare class StandardValidator extends Validator { * @param rules Optional. If unspecified, the rules will be looked up using the metadata * for the object created by ValidationRules....on(class/object) */ - validateProperty(object: any, propertyName: string, rules?: any): Promise; + validateProperty(object: any, propertyName: string, rules?: any): Promise; /** * Validates all rules for specified object and it's properties. * @param object The object to validate. * @param rules Optional. If unspecified, the rules will be looked up using the metadata * for the object created by ValidationRules....on(class/object) */ - validateObject(object: any, rules?: any): Promise; + validateObject(object: any, rules?: any): Promise; /** * Determines whether a rule exists in a set of rules. * @param rules The rules to search. @@ -35,6 +35,6 @@ export declare class StandardValidator extends Validator { */ ruleExists(rules: Rule[][], rule: Rule): boolean; private getMessage(rule, object, value); - private validateRuleSequence(object, propertyName, ruleSequence, sequence); + private validateRuleSequence(object, propertyName, ruleSequence, sequence, results); private validate(object, propertyName, rules); } diff --git a/dist/es2015/implementation/standard-validator.js b/dist/es2015/implementation/standard-validator.js index 99068cec..e27592d6 100644 --- a/dist/es2015/implementation/standard-validator.js +++ b/dist/es2015/implementation/standard-validator.js @@ -1,18 +1,25 @@ +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; import { ViewResources } from 'aurelia-templating'; import { Validator } from '../validator'; -import { ValidationError } from '../validation-error'; +import { ValidateResult } from '../validate-result'; import { Rules } from './rules'; import { ValidationMessageProvider } from './validation-messages'; /** * Validates. * Responsible for validating objects and properties. */ -export class StandardValidator extends Validator { - constructor(messageProvider, resources) { - super(); - this.messageProvider = messageProvider; - this.lookupFunctions = resources.lookupFunctions; - this.getDisplayName = messageProvider.getDisplayName.bind(messageProvider); +var StandardValidator = (function (_super) { + __extends(StandardValidator, _super); + function StandardValidator(messageProvider, resources) { + var _this = _super.call(this) || this; + _this.messageProvider = messageProvider; + _this.lookupFunctions = resources.lookupFunctions; + _this.getDisplayName = messageProvider.getDisplayName.bind(messageProvider); + return _this; } /** * Validates the specified property. @@ -21,39 +28,39 @@ export class StandardValidator extends Validator { * @param rules Optional. If unspecified, the rules will be looked up using the metadata * for the object created by ValidationRules....on(class/object) */ - validateProperty(object, propertyName, rules) { + StandardValidator.prototype.validateProperty = function (object, propertyName, rules) { return this.validate(object, propertyName, rules || null); - } + }; /** * Validates all rules for specified object and it's properties. * @param object The object to validate. * @param rules Optional. If unspecified, the rules will be looked up using the metadata * for the object created by ValidationRules....on(class/object) */ - validateObject(object, rules) { + StandardValidator.prototype.validateObject = function (object, rules) { return this.validate(object, null, rules || null); - } + }; /** * Determines whether a rule exists in a set of rules. * @param rules The rules to search. * @parem rule The rule to find. */ - ruleExists(rules, rule) { - let i = rules.length; + StandardValidator.prototype.ruleExists = function (rules, rule) { + var i = rules.length; while (i--) { if (rules[i].indexOf(rule) !== -1) { return true; } } return false; - } - getMessage(rule, object, value) { - const expression = rule.message || this.messageProvider.getMessage(rule.messageKey); - let { name: propertyName, displayName } = rule.property; - if (displayName === null && propertyName !== null) { - displayName = this.messageProvider.getDisplayName(propertyName); + }; + StandardValidator.prototype.getMessage = function (rule, object, value) { + var expression = rule.message || this.messageProvider.getMessage(rule.messageKey); + var _a = rule.property, propertyName = _a.name, displayName = _a.displayName; + if (propertyName !== null) { + displayName = this.messageProvider.getDisplayName(propertyName, displayName); } - const overrideContext = { + var overrideContext = { $displayName: displayName, $propertyName: propertyName, $value: value, @@ -61,48 +68,52 @@ export class StandardValidator extends Validator { $config: rule.config, $getDisplayName: this.getDisplayName }; - return expression.evaluate({ bindingContext: object, overrideContext }, this.lookupFunctions); - } - validateRuleSequence(object, propertyName, ruleSequence, sequence) { + return expression.evaluate({ bindingContext: object, overrideContext: overrideContext }, this.lookupFunctions); + }; + StandardValidator.prototype.validateRuleSequence = function (object, propertyName, ruleSequence, sequence, results) { + var _this = this; // are we validating all properties or a single property? - const validateAllProperties = propertyName === null || propertyName === undefined; - const rules = ruleSequence[sequence]; - const errors = []; + var validateAllProperties = propertyName === null || propertyName === undefined; + var rules = ruleSequence[sequence]; + var allValid = true; // validate each rule. - const promises = []; - for (let i = 0; i < rules.length; i++) { - const rule = rules[i]; + var promises = []; + var _loop_1 = function (i) { + var rule = rules[i]; // is the rule related to the property we're validating. if (!validateAllProperties && rule.property.name !== propertyName) { - continue; + return "continue"; } // is this a conditional rule? is the condition met? if (rule.when && !rule.when(object)) { - continue; + return "continue"; } // validate. - const value = rule.property.name === null ? object : object[rule.property.name]; - let promiseOrBoolean = rule.condition(value, object); + var value = rule.property.name === null ? object : object[rule.property.name]; + var promiseOrBoolean = rule.condition(value, object); if (!(promiseOrBoolean instanceof Promise)) { promiseOrBoolean = Promise.resolve(promiseOrBoolean); } - promises.push(promiseOrBoolean.then(isValid => { - if (!isValid) { - const message = this.getMessage(rule, object, value); - errors.push(new ValidationError(rule, message, object, rule.property.name)); - } + promises.push(promiseOrBoolean.then(function (valid) { + var message = valid ? null : _this.getMessage(rule, object, value); + results.push(new ValidateResult(rule, object, rule.property.name, valid, message)); + allValid = allValid && valid; + return valid; })); + }; + for (var i = 0; i < rules.length; i++) { + _loop_1(i); } return Promise.all(promises) - .then(() => { + .then(function () { sequence++; - if (errors.length === 0 && sequence < ruleSequence.length) { - return this.validateRuleSequence(object, propertyName, ruleSequence, sequence); + if (allValid && sequence < ruleSequence.length) { + return _this.validateRuleSequence(object, propertyName, ruleSequence, sequence, results); } - return errors; + return results; }); - } - validate(object, propertyName, rules) { + }; + StandardValidator.prototype.validate = function (object, propertyName, rules) { // rules specified? if (!rules) { // no. attempt to locate the rules. @@ -112,7 +123,9 @@ export class StandardValidator extends Validator { if (!rules) { return Promise.resolve([]); } - return this.validateRuleSequence(object, propertyName, rules, 0); - } -} + return this.validateRuleSequence(object, propertyName, rules, 0, []); + }; + return StandardValidator; +}(Validator)); +export { StandardValidator }; StandardValidator.inject = [ValidationMessageProvider, ViewResources]; diff --git a/dist/es2015/implementation/validation-messages.d.ts b/dist/es2015/implementation/validation-messages.d.ts index d9a09450..7a0978d7 100644 --- a/dist/es2015/implementation/validation-messages.d.ts +++ b/dist/es2015/implementation/validation-messages.d.ts @@ -20,10 +20,10 @@ export declare class ValidationMessageProvider { */ getMessage(key: string): Expression; /** - * When a display name is not provided, this method is used to formulate - * a display name using the property name. + * Formulates a property display name using the property name and the configured + * displayName (if provided). * Override this with your own custom logic. * @param propertyName The property name. */ - getDisplayName(propertyName: string): string; + getDisplayName(propertyName: string, displayName: string | null | undefined): string; } diff --git a/dist/es2015/implementation/validation-messages.js b/dist/es2015/implementation/validation-messages.js index eeafa4d7..c1c31601 100644 --- a/dist/es2015/implementation/validation-messages.js +++ b/dist/es2015/implementation/validation-messages.js @@ -2,33 +2,33 @@ import { ValidationParser } from './validation-parser'; /** * Dictionary of validation messages. [messageKey]: messageExpression */ -export const validationMessages = { +export var validationMessages = { /** * The default validation message. Used with rules that have no standard message. */ - default: `\${$displayName} is invalid.`, - required: `\${$displayName} is required.`, - matches: `\${$displayName} is not correctly formatted.`, - email: `\${$displayName} is not a valid email.`, - minLength: `\${$displayName} must be at least \${$config.length} character\${$config.length === 1 ? '' : 's'}.`, - maxLength: `\${$displayName} cannot be longer than \${$config.length} character\${$config.length === 1 ? '' : 's'}.`, - minItems: `\${$displayName} must contain at least \${$config.count} item\${$config.count === 1 ? '' : 's'}.`, - maxItems: `\${$displayName} cannot contain more than \${$config.count} item\${$config.count === 1 ? '' : 's'}.`, - equals: `\${$displayName} must be \${$config.expectedValue}.`, + default: "${$displayName} is invalid.", + required: "${$displayName} is required.", + matches: "${$displayName} is not correctly formatted.", + email: "${$displayName} is not a valid email.", + minLength: "${$displayName} must be at least ${$config.length} character${$config.length === 1 ? '' : 's'}.", + maxLength: "${$displayName} cannot be longer than ${$config.length} character${$config.length === 1 ? '' : 's'}.", + minItems: "${$displayName} must contain at least ${$config.count} item${$config.count === 1 ? '' : 's'}.", + maxItems: "${$displayName} cannot contain more than ${$config.count} item${$config.count === 1 ? '' : 's'}.", + equals: "${$displayName} must be ${$config.expectedValue}.", }; /** * Retrieves validation messages and property display names. */ -export class ValidationMessageProvider { - constructor(parser) { +var ValidationMessageProvider = (function () { + function ValidationMessageProvider(parser) { this.parser = parser; } /** * Returns a message binding expression that corresponds to the key. * @param key The message key. */ - getMessage(key) { - let message; + ValidationMessageProvider.prototype.getMessage = function (key) { + var message; if (key in validationMessages) { message = validationMessages[key]; } @@ -36,18 +36,23 @@ export class ValidationMessageProvider { message = validationMessages['default']; } return this.parser.parseMessage(message); - } + }; /** - * When a display name is not provided, this method is used to formulate - * a display name using the property name. + * Formulates a property display name using the property name and the configured + * displayName (if provided). * Override this with your own custom logic. * @param propertyName The property name. */ - getDisplayName(propertyName) { + ValidationMessageProvider.prototype.getDisplayName = function (propertyName, displayName) { + if (displayName !== null && displayName !== undefined) { + return displayName; + } // split on upper-case letters. - const words = propertyName.split(/(?=[A-Z])/).join(' '); + var words = propertyName.split(/(?=[A-Z])/).join(' '); // capitalize first letter. return words.charAt(0).toUpperCase() + words.slice(1); - } -} + }; + return ValidationMessageProvider; +}()); +export { ValidationMessageProvider }; ValidationMessageProvider.inject = [ValidationParser]; diff --git a/dist/es2015/implementation/validation-parser.js b/dist/es2015/implementation/validation-parser.js index 48666130..ca1024aa 100644 --- a/dist/es2015/implementation/validation-parser.js +++ b/dist/es2015/implementation/validation-parser.js @@ -1,9 +1,14 @@ +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; import { Parser, AccessMember, AccessScope, LiteralString, Binary, Conditional, LiteralPrimitive, CallMember, Unparser } from 'aurelia-binding'; import { BindingLanguage } from 'aurelia-templating'; import { isString } from './util'; import * as LogManager from 'aurelia-logging'; -export class ValidationParser { - constructor(parser, bindinqLanguage) { +var ValidationParser = (function () { + function ValidationParser(parser, bindinqLanguage) { this.parser = parser; this.bindinqLanguage = bindinqLanguage; this.emptyStringExpression = new LiteralString(''); @@ -11,27 +16,27 @@ export class ValidationParser { this.undefinedExpression = new LiteralPrimitive(undefined); this.cache = {}; } - parseMessage(message) { + ValidationParser.prototype.parseMessage = function (message) { if (this.cache[message] !== undefined) { return this.cache[message]; } - const parts = this.bindinqLanguage.parseInterpolation(null, message); + var parts = this.bindinqLanguage.parseInterpolation(null, message); if (parts === null) { return new LiteralString(message); } - let expression = new LiteralString(parts[0]); - for (let i = 1; i < parts.length; i += 2) { + var expression = new LiteralString(parts[0]); + for (var i = 1; i < parts.length; i += 2) { expression = new Binary('+', expression, new Binary('+', this.coalesce(parts[i]), new LiteralString(parts[i + 1]))); } MessageExpressionValidator.validate(expression, message); this.cache[message] = expression; return expression; - } - parseProperty(property) { + }; + ValidationParser.prototype.parseProperty = function (property) { if (isString(property)) { return { name: property, displayName: null }; } - const accessor = this.getAccessorExpression(property.toString()); + var accessor = this.getAccessorExpression(property.toString()); if (accessor instanceof AccessScope || accessor instanceof AccessMember && accessor.object instanceof AccessScope) { return { @@ -39,39 +44,45 @@ export class ValidationParser { displayName: null }; } - throw new Error(`Invalid subject: "${accessor}"`); - } - coalesce(part) { + throw new Error("Invalid subject: \"" + accessor + "\""); + }; + ValidationParser.prototype.coalesce = function (part) { // part === null || part === undefined ? '' : part return new Conditional(new Binary('||', new Binary('===', part, this.nullExpression), new Binary('===', part, this.undefinedExpression)), this.emptyStringExpression, new CallMember(part, 'toString', [])); - } - getAccessorExpression(fn) { - const classic = /^function\s*\([$_\w\d]+\)\s*\{\s*(?:"use strict";)?\s*return\s+[$_\w\d]+\.([$_\w\d]+)\s*;?\s*\}$/; - const arrow = /^\(?[$_\w\d]+\)?\s*=>\s*[$_\w\d]+\.([$_\w\d]+)$/; - const match = classic.exec(fn) || arrow.exec(fn); + }; + ValidationParser.prototype.getAccessorExpression = function (fn) { + var classic = /^function\s*\([$_\w\d]+\)\s*\{\s*(?:"use strict";)?\s*return\s+[$_\w\d]+\.([$_\w\d]+)\s*;?\s*\}$/; + var arrow = /^\(?[$_\w\d]+\)?\s*=>\s*[$_\w\d]+\.([$_\w\d]+)$/; + var match = classic.exec(fn) || arrow.exec(fn); if (match === null) { - throw new Error(`Unable to parse accessor function:\n${fn}`); + throw new Error("Unable to parse accessor function:\n" + fn); } return this.parser.parse(match[1]); - } -} + }; + return ValidationParser; +}()); +export { ValidationParser }; ValidationParser.inject = [Parser, BindingLanguage]; -export class MessageExpressionValidator extends Unparser { - constructor(originalMessage) { - super([]); - this.originalMessage = originalMessage; +var MessageExpressionValidator = (function (_super) { + __extends(MessageExpressionValidator, _super); + function MessageExpressionValidator(originalMessage) { + var _this = _super.call(this, []) || this; + _this.originalMessage = originalMessage; + return _this; } - static validate(expression, originalMessage) { - const visitor = new MessageExpressionValidator(originalMessage); + MessageExpressionValidator.validate = function (expression, originalMessage) { + var visitor = new MessageExpressionValidator(originalMessage); expression.accept(visitor); - } - visitAccessScope(access) { + }; + MessageExpressionValidator.prototype.visitAccessScope = function (access) { if (access.ancestor !== 0) { throw new Error('$parent is not permitted in validation message expressions.'); } if (['displayName', 'propertyName', 'value', 'object', 'config', 'getDisplayName'].indexOf(access.name) !== -1) { LogManager.getLogger('aurelia-validation') - .warn(`Did you mean to use "$${access.name}" instead of "${access.name}" in this validation message template: "${this.originalMessage}"?`); + .warn("Did you mean to use \"$" + access.name + "\" instead of \"" + access.name + "\" in this validation message template: \"" + this.originalMessage + "\"?"); } - } -} + }; + return MessageExpressionValidator; +}(Unparser)); +export { MessageExpressionValidator }; diff --git a/dist/es2015/implementation/validation-rules.d.ts b/dist/es2015/implementation/validation-rules.d.ts index 59ba7410..13251d4d 100644 --- a/dist/es2015/implementation/validation-rules.d.ts +++ b/dist/es2015/implementation/validation-rules.d.ts @@ -122,6 +122,12 @@ export declare class FluentRules { argsToConfig?: (...args: any[]) => any; }; }; + /** + * Current rule sequence number. Used to postpone evaluation of rules until rules + * with lower sequence number have successfully validated. The "then" fluent API method + * manages this property, there's usually no need to set it directly. + */ + sequence: number; constructor(fluentEnsure: FluentEnsure, parser: ValidationParser, property: RuleProperty); /** * Sets the display name of the ensured property. @@ -191,7 +197,6 @@ export declare class FluentEnsure { * Rules that have been defined using the fluent API. */ rules: Rule[][]; - _sequence: number; constructor(parser: ValidationParser); /** * Target a property with validation rules. diff --git a/dist/es2015/implementation/validation-rules.js b/dist/es2015/implementation/validation-rules.js index 88f87df4..3882f661 100644 --- a/dist/es2015/implementation/validation-rules.js +++ b/dist/es2015/implementation/validation-rules.js @@ -4,19 +4,20 @@ import { validationMessages } from './validation-messages'; /** * Part of the fluent rule API. Enables customizing property rules. */ -export class FluentRuleCustomizer { - constructor(property, condition, config = {}, fluentEnsure, fluentRules, parser) { +var FluentRuleCustomizer = (function () { + function FluentRuleCustomizer(property, condition, config, fluentEnsure, fluentRules, parser) { + if (config === void 0) { config = {}; } this.fluentEnsure = fluentEnsure; this.fluentRules = fluentRules; this.parser = parser; this.rule = { - property, - condition, - config, + property: property, + condition: condition, + config: config, when: null, messageKey: 'default', message: null, - sequence: fluentEnsure._sequence + sequence: fluentRules.sequence }; this.fluentEnsure._addRule(this.rule); } @@ -25,70 +26,74 @@ export class FluentRuleCustomizer { * been validated successfully. Use to postpone validation of costly * rules until less expensive rules pass validation. */ - then() { - this.fluentEnsure._sequence++; + FluentRuleCustomizer.prototype.then = function () { + this.fluentRules.sequence++; return this; - } + }; /** * Specifies the key to use when looking up the rule's validation message. */ - withMessageKey(key) { + FluentRuleCustomizer.prototype.withMessageKey = function (key) { this.rule.messageKey = key; this.rule.message = null; return this; - } + }; /** * Specifies rule's validation message. */ - withMessage(message) { + FluentRuleCustomizer.prototype.withMessage = function (message) { this.rule.messageKey = 'custom'; this.rule.message = this.parser.parseMessage(message); return this; - } + }; /** * Specifies a condition that must be met before attempting to validate the rule. * @param condition A function that accepts the object as a parameter and returns true * or false whether the rule should be evaluated. */ - when(condition) { + FluentRuleCustomizer.prototype.when = function (condition) { this.rule.when = condition; return this; - } + }; /** * Tags the rule instance, enabling the rule to be found easily * using ValidationRules.taggedRules(rules, tag) */ - tag(tag) { + FluentRuleCustomizer.prototype.tag = function (tag) { this.rule.tag = tag; return this; - } + }; ///// FluentEnsure APIs ///// /** * Target a property with validation rules. * @param property The property to target. Can be the property name or a property accessor function. */ - ensure(subject) { + FluentRuleCustomizer.prototype.ensure = function (subject) { return this.fluentEnsure.ensure(subject); - } + }; /** * Targets an object with validation rules. */ - ensureObject() { + FluentRuleCustomizer.prototype.ensureObject = function () { return this.fluentEnsure.ensureObject(); - } - /** - * Rules that have been defined using the fluent API. - */ - get rules() { - return this.fluentEnsure.rules; - } + }; + Object.defineProperty(FluentRuleCustomizer.prototype, "rules", { + /** + * Rules that have been defined using the fluent API. + */ + get: function () { + return this.fluentEnsure.rules; + }, + enumerable: true, + configurable: true + }); /** * Applies the rules to a class or object, making them discoverable by the StandardValidator. * @param target A class or object. */ - on(target) { + FluentRuleCustomizer.prototype.on = function (target) { return this.fluentEnsure.on(target); - } + }; ///////// FluentRules APIs ///////// /** * Applies an ad-hoc rule function to the ensured property or object. @@ -96,263 +101,289 @@ export class FluentRuleCustomizer { * Will be called with two arguments, the property value and the object. * Should return a boolean or a Promise that resolves to a boolean. */ - satisfies(condition, config) { + FluentRuleCustomizer.prototype.satisfies = function (condition, config) { return this.fluentRules.satisfies(condition, config); - } + }; /** * Applies a rule by name. * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name, ...args) { - return this.fluentRules.satisfiesRule(name, ...args); - } + FluentRuleCustomizer.prototype.satisfiesRule = function (name) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return (_a = this.fluentRules).satisfiesRule.apply(_a, [name].concat(args)); + var _a; + }; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. */ - required() { + FluentRuleCustomizer.prototype.required = function () { return this.fluentRules.required(); - } + }; /** * Applies the "matches" rule to the property. * Value must match the specified regular expression. * null, undefined and empty-string values are considered valid. */ - matches(regex) { + FluentRuleCustomizer.prototype.matches = function (regex) { return this.fluentRules.matches(regex); - } + }; /** * Applies the "email" rule to the property. * null, undefined and empty-string values are considered valid. */ - email() { + FluentRuleCustomizer.prototype.email = function () { return this.fluentRules.email(); - } + }; /** * Applies the "minLength" STRING validation rule to the property. * null, undefined and empty-string values are considered valid. */ - minLength(length) { + FluentRuleCustomizer.prototype.minLength = function (length) { return this.fluentRules.minLength(length); - } + }; /** * Applies the "maxLength" STRING validation rule to the property. * null, undefined and empty-string values are considered valid. */ - maxLength(length) { + FluentRuleCustomizer.prototype.maxLength = function (length) { return this.fluentRules.maxLength(length); - } + }; /** * Applies the "minItems" ARRAY validation rule to the property. * null and undefined values are considered valid. */ - minItems(count) { + FluentRuleCustomizer.prototype.minItems = function (count) { return this.fluentRules.minItems(count); - } + }; /** * Applies the "maxItems" ARRAY validation rule to the property. * null and undefined values are considered valid. */ - maxItems(count) { + FluentRuleCustomizer.prototype.maxItems = function (count) { return this.fluentRules.maxItems(count); - } + }; /** * Applies the "equals" validation rule to the property. * null, undefined and empty-string values are considered valid. */ - equals(expectedValue) { + FluentRuleCustomizer.prototype.equals = function (expectedValue) { return this.fluentRules.equals(expectedValue); - } -} + }; + return FluentRuleCustomizer; +}()); +export { FluentRuleCustomizer }; /** * Part of the fluent rule API. Enables applying rules to properties and objects. */ -export class FluentRules { - constructor(fluentEnsure, parser, property) { +var FluentRules = (function () { + function FluentRules(fluentEnsure, parser, property) { this.fluentEnsure = fluentEnsure; this.parser = parser; this.property = property; + /** + * Current rule sequence number. Used to postpone evaluation of rules until rules + * with lower sequence number have successfully validated. The "then" fluent API method + * manages this property, there's usually no need to set it directly. + */ + this.sequence = 0; } /** * Sets the display name of the ensured property. */ - displayName(name) { + FluentRules.prototype.displayName = function (name) { this.property.displayName = name; return this; - } + }; /** * Applies an ad-hoc rule function to the ensured property or object. * @param condition The function to validate the rule. * Will be called with two arguments, the property value and the object. * Should return a boolean or a Promise that resolves to a boolean. */ - satisfies(condition, config) { + FluentRules.prototype.satisfies = function (condition, config) { return new FluentRuleCustomizer(this.property, condition, config, this.fluentEnsure, this, this.parser); - } + }; /** * Applies a rule by name. * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name, ...args) { - let rule = FluentRules.customRules[name]; + FluentRules.prototype.satisfiesRule = function (name) { + var _this = this; + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + var rule = FluentRules.customRules[name]; if (!rule) { // standard rule? rule = this[name]; if (rule instanceof Function) { - return rule.call(this, ...args); + return rule.call.apply(rule, [this].concat(args)); } - throw new Error(`Rule with name "${name}" does not exist.`); + throw new Error("Rule with name \"" + name + "\" does not exist."); } - const config = rule.argsToConfig ? rule.argsToConfig(...args) : undefined; - return this.satisfies((value, obj) => rule.condition.call(this, value, obj, ...args), config) + var config = rule.argsToConfig ? rule.argsToConfig.apply(rule, args) : undefined; + return this.satisfies(function (value, obj) { + return (_a = rule.condition).call.apply(_a, [_this, value, obj].concat(args)); + var _a; + }, config) .withMessageKey(name); - } + }; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. */ - required() { - return this.satisfies(value => value !== null - && value !== undefined - && !(isString(value) && !/\S/.test(value))).withMessageKey('required'); - } + FluentRules.prototype.required = function () { + return this.satisfies(function (value) { + return value !== null + && value !== undefined + && !(isString(value) && !/\S/.test(value)); + }).withMessageKey('required'); + }; /** * Applies the "matches" rule to the property. * Value must match the specified regular expression. * null, undefined and empty-string values are considered valid. */ - matches(regex) { - return this.satisfies(value => value === null || value === undefined || value.length === 0 || regex.test(value)) + FluentRules.prototype.matches = function (regex) { + return this.satisfies(function (value) { return value === null || value === undefined || value.length === 0 || regex.test(value); }) .withMessageKey('matches'); - } + }; /** * Applies the "email" rule to the property. * null, undefined and empty-string values are considered valid. */ - email() { + FluentRules.prototype.email = function () { // regex from https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address /* tslint:disable:max-line-length */ return this.matches(/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/) .withMessageKey('email'); - } + }; /** * Applies the "minLength" STRING validation rule to the property. * null, undefined and empty-string values are considered valid. */ - minLength(length) { - return this.satisfies((value) => value === null || value === undefined || value.length === 0 || value.length >= length, { length }) + FluentRules.prototype.minLength = function (length) { + return this.satisfies(function (value) { return value === null || value === undefined || value.length === 0 || value.length >= length; }, { length: length }) .withMessageKey('minLength'); - } + }; /** * Applies the "maxLength" STRING validation rule to the property. * null, undefined and empty-string values are considered valid. */ - maxLength(length) { - return this.satisfies((value) => value === null || value === undefined || value.length === 0 || value.length <= length, { length }) + FluentRules.prototype.maxLength = function (length) { + return this.satisfies(function (value) { return value === null || value === undefined || value.length === 0 || value.length <= length; }, { length: length }) .withMessageKey('maxLength'); - } + }; /** * Applies the "minItems" ARRAY validation rule to the property. * null and undefined values are considered valid. */ - minItems(count) { - return this.satisfies((value) => value === null || value === undefined || value.length >= count, { count }) + FluentRules.prototype.minItems = function (count) { + return this.satisfies(function (value) { return value === null || value === undefined || value.length >= count; }, { count: count }) .withMessageKey('minItems'); - } + }; /** * Applies the "maxItems" ARRAY validation rule to the property. * null and undefined values are considered valid. */ - maxItems(count) { - return this.satisfies((value) => value === null || value === undefined || value.length <= count, { count }) + FluentRules.prototype.maxItems = function (count) { + return this.satisfies(function (value) { return value === null || value === undefined || value.length <= count; }, { count: count }) .withMessageKey('maxItems'); - } + }; /** * Applies the "equals" validation rule to the property. * null and undefined values are considered valid. */ - equals(expectedValue) { - return this.satisfies(value => value === null || value === undefined || value === '' || value === expectedValue, { expectedValue }) + FluentRules.prototype.equals = function (expectedValue) { + return this.satisfies(function (value) { return value === null || value === undefined || value === '' || value === expectedValue; }, { expectedValue: expectedValue }) .withMessageKey('equals'); - } -} + }; + return FluentRules; +}()); +export { FluentRules }; FluentRules.customRules = {}; /** * Part of the fluent rule API. Enables targeting properties and objects with rules. */ -export class FluentEnsure { - /* tslint:enable */ - constructor(parser) { +var FluentEnsure = (function () { + function FluentEnsure(parser) { this.parser = parser; /** * Rules that have been defined using the fluent API. */ this.rules = []; - /* tslint:disable */ - this._sequence = 0; } /** * Target a property with validation rules. * @param property The property to target. Can be the property name or a property accessor * function. */ - ensure(property) { + FluentEnsure.prototype.ensure = function (property) { this.assertInitialized(); return new FluentRules(this, this.parser, this.parser.parseProperty(property)); - } + }; /** * Targets an object with validation rules. */ - ensureObject() { + FluentEnsure.prototype.ensureObject = function () { this.assertInitialized(); return new FluentRules(this, this.parser, { name: null, displayName: null }); - } + }; /** * Applies the rules to a class or object, making them discoverable by the StandardValidator. * @param target A class or object. */ - on(target) { + FluentEnsure.prototype.on = function (target) { Rules.set(target, this.rules); return this; - } + }; /** * Adds a rule definition to the sequenced ruleset. */ - _addRule(rule) { + FluentEnsure.prototype._addRule = function (rule) { while (this.rules.length < rule.sequence + 1) { this.rules.push([]); } this.rules[rule.sequence].push(rule); - } - assertInitialized() { + }; + FluentEnsure.prototype.assertInitialized = function () { if (this.parser) { return; } - throw new Error(`Did you forget to add ".plugin('aurelia-validation)" to your main.js?`); - } -} + throw new Error("Did you forget to add \".plugin('aurelia-validation)\" to your main.js?"); + }; + return FluentEnsure; +}()); +export { FluentEnsure }; /** * Fluent rule definition API. */ -export class ValidationRules { - static initialize(parser) { - ValidationRules.parser = parser; +var ValidationRules = (function () { + function ValidationRules() { } + ValidationRules.initialize = function (parser) { + ValidationRules.parser = parser; + }; /** * Target a property with validation rules. * @param property The property to target. Can be the property name or a property accessor function. */ - static ensure(property) { + ValidationRules.ensure = function (property) { return new FluentEnsure(ValidationRules.parser).ensure(property); - } + }; /** * Targets an object with validation rules. */ - static ensureObject() { + ValidationRules.ensureObject = function () { return new FluentEnsure(ValidationRules.parser).ensureObject(); - } + }; /** * Defines a custom rule. * @param name The name of the custom rule. Also serves as the message key. @@ -361,23 +392,25 @@ export class ValidationRules { * @param argsToConfig A function that maps the rule's arguments to a "config" * object that can be used when evaluating the message expression. */ - static customRule(name, condition, message, argsToConfig) { + ValidationRules.customRule = function (name, condition, message, argsToConfig) { validationMessages[name] = message; - FluentRules.customRules[name] = { condition, argsToConfig }; - } + FluentRules.customRules[name] = { condition: condition, argsToConfig: argsToConfig }; + }; /** * Returns rules with the matching tag. * @param rules The rules to search. * @param tag The tag to search for. */ - static taggedRules(rules, tag) { - return rules.map(x => x.filter(r => r.tag === tag)); - } + ValidationRules.taggedRules = function (rules, tag) { + return rules.map(function (x) { return x.filter(function (r) { return r.tag === tag; }); }); + }; /** * Removes the rules from a class or object. * @param target A class or object. */ - static off(target) { + ValidationRules.off = function (target) { Rules.unset(target); - } -} + }; + return ValidationRules; +}()); +export { ValidationRules }; diff --git a/dist/es2015/property-info.js b/dist/es2015/property-info.js index 60963a5f..75edf715 100644 --- a/dist/es2015/property-info.js +++ b/dist/es2015/property-info.js @@ -1,11 +1,11 @@ import { AccessMember, AccessScope, AccessKeyed, BindingBehavior, ValueConverter } from 'aurelia-binding'; function getObject(expression, objectExpression, source) { - let value = objectExpression.evaluate(source, null); + var value = objectExpression.evaluate(source, null); if (value === null || value === undefined || value instanceof Object) { return value; } /* tslint:disable */ - throw new Error(`The '${objectExpression}' part of '${expression}' evaluates to ${value} instead of an object, null or undefined.`); + throw new Error("The '" + objectExpression + "' part of '" + expression + "' evaluates to " + value + " instead of an object, null or undefined."); /* tslint:enable */ } /** @@ -14,12 +14,12 @@ function getObject(expression, objectExpression, source) { * @param source The scope */ export function getPropertyInfo(expression, source) { - const originalExpression = expression; + var originalExpression = expression; while (expression instanceof BindingBehavior || expression instanceof ValueConverter) { expression = expression.expression; } - let object; - let propertyName; + var object; + var propertyName; if (expression instanceof AccessScope) { object = source.bindingContext; propertyName = expression.name; @@ -33,10 +33,10 @@ export function getPropertyInfo(expression, source) { propertyName = expression.key.evaluate(source); } else { - throw new Error(`Expression '${originalExpression}' is not compatible with the validate binding-behavior.`); + throw new Error("Expression '" + originalExpression + "' is not compatible with the validate binding-behavior."); } if (object === null || object === undefined) { return null; } - return { object, propertyName }; + return { object: object, propertyName: propertyName }; } diff --git a/dist/es2015/validate-binding-behavior-base.js b/dist/es2015/validate-binding-behavior-base.js index 991f7c52..72af199f 100644 --- a/dist/es2015/validate-binding-behavior-base.js +++ b/dist/es2015/validate-binding-behavior-base.js @@ -5,8 +5,8 @@ import { validateTrigger } from './validate-trigger'; /** * Binding behavior. Indicates the bound property should be validated. */ -export class ValidateBindingBehaviorBase { - constructor(taskQueue) { +var ValidateBindingBehaviorBase = (function () { + function ValidateBindingBehaviorBase(taskQueue) { this.taskQueue = taskQueue; } /** @@ -15,30 +15,31 @@ export class ValidateBindingBehaviorBase { * or custom attribute which is a javascript "class" instance, so we need to use * the controller's container to retrieve the actual DOM element. */ - getTarget(binding, view) { - const target = binding.target; + ValidateBindingBehaviorBase.prototype.getTarget = function (binding, view) { + var target = binding.target; // DOM element if (target instanceof Element) { return target; } // custom element or custom attribute - for (let i = 0, ii = view.controllers.length; i < ii; i++) { - let controller = view.controllers[i]; + for (var i = 0, ii = view.controllers.length; i < ii; i++) { + var controller = view.controllers[i]; if (controller.viewModel === target) { - const element = controller.container.get(DOM.Element); + var element = controller.container.get(DOM.Element); if (element) { return element; } - throw new Error(`Unable to locate target element for "${binding.sourceExpression}".`); + throw new Error("Unable to locate target element for \"" + binding.sourceExpression + "\"."); } } - throw new Error(`Unable to locate target element for "${binding.sourceExpression}".`); - } - bind(binding, source, rulesOrController, rules) { + throw new Error("Unable to locate target element for \"" + binding.sourceExpression + "\"."); + }; + ValidateBindingBehaviorBase.prototype.bind = function (binding, source, rulesOrController, rules) { + var _this = this; // identify the target element. - const target = this.getTarget(binding, source); + var target = this.getTarget(binding, source); // locate the controller. - let controller; + var controller; if (rulesOrController instanceof ValidationController) { controller = rulesOrController; } @@ -47,11 +48,11 @@ export class ValidateBindingBehaviorBase { rules = rulesOrController; } if (controller === null) { - throw new Error(`A ValidationController has not been registered.`); + throw new Error("A ValidationController has not been registered."); } controller.registerBinding(binding, target, rules); binding.validationController = controller; - const trigger = this.getValidateTrigger(controller); + var trigger = this.getValidateTrigger(controller); /* tslint:disable:no-bitwise */ if (trigger & validateTrigger.change) { /* tslint:enable:no-bitwise */ @@ -66,8 +67,8 @@ export class ValidateBindingBehaviorBase { /* tslint:disable:no-bitwise */ if (trigger & validateTrigger.blur) { /* tslint:enable:no-bitwise */ - binding.validateBlurHandler = () => { - this.taskQueue.queueMicroTask(() => controller.validateBinding(binding)); + binding.validateBlurHandler = function () { + _this.taskQueue.queueMicroTask(function () { return controller.validateBinding(binding); }); }; binding.validateTarget = target; target.addEventListener('blur', binding.validateBlurHandler); @@ -81,8 +82,8 @@ export class ValidateBindingBehaviorBase { this.validationController.resetBinding(this); }; } - } - unbind(binding) { + }; + ValidateBindingBehaviorBase.prototype.unbind = function (binding) { // reset the binding to it's original state. if (binding.standardUpdateSource) { binding.updateSource = binding.standardUpdateSource; @@ -99,5 +100,7 @@ export class ValidateBindingBehaviorBase { } binding.validationController.unregisterBinding(binding); binding.validationController = null; - } -} + }; + return ValidateBindingBehaviorBase; +}()); +export { ValidateBindingBehaviorBase }; diff --git a/dist/es2015/validate-binding-behavior.js b/dist/es2015/validate-binding-behavior.js index 318d227a..0ecbd5a9 100644 --- a/dist/es2015/validate-binding-behavior.js +++ b/dist/es2015/validate-binding-behavior.js @@ -1,3 +1,8 @@ +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; import { TaskQueue } from 'aurelia-task-queue'; import { validateTrigger } from './validate-trigger'; import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; @@ -6,52 +11,82 @@ import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; * when the validate trigger specified by the associated controller's * validateTrigger property occurs. */ -export class ValidateBindingBehavior extends ValidateBindingBehaviorBase { - getValidateTrigger(controller) { - return controller.validateTrigger; +var ValidateBindingBehavior = (function (_super) { + __extends(ValidateBindingBehavior, _super); + function ValidateBindingBehavior() { + return _super.apply(this, arguments) || this; } -} + ValidateBindingBehavior.prototype.getValidateTrigger = function (controller) { + return controller.validateTrigger; + }; + return ValidateBindingBehavior; +}(ValidateBindingBehaviorBase)); +export { ValidateBindingBehavior }; ValidateBindingBehavior.inject = [TaskQueue]; /** * Binding behavior. Indicates the bound property will be validated * manually, by calling controller.validate(). No automatic validation * triggered by data-entry or blur will occur. */ -export class ValidateManuallyBindingBehavior extends ValidateBindingBehaviorBase { - getValidateTrigger() { - return validateTrigger.manual; +var ValidateManuallyBindingBehavior = (function (_super) { + __extends(ValidateManuallyBindingBehavior, _super); + function ValidateManuallyBindingBehavior() { + return _super.apply(this, arguments) || this; } -} + ValidateManuallyBindingBehavior.prototype.getValidateTrigger = function () { + return validateTrigger.manual; + }; + return ValidateManuallyBindingBehavior; +}(ValidateBindingBehaviorBase)); +export { ValidateManuallyBindingBehavior }; ValidateManuallyBindingBehavior.inject = [TaskQueue]; /** * Binding behavior. Indicates the bound property should be validated * when the associated element blurs. */ -export class ValidateOnBlurBindingBehavior extends ValidateBindingBehaviorBase { - getValidateTrigger() { - return validateTrigger.blur; +var ValidateOnBlurBindingBehavior = (function (_super) { + __extends(ValidateOnBlurBindingBehavior, _super); + function ValidateOnBlurBindingBehavior() { + return _super.apply(this, arguments) || this; } -} + ValidateOnBlurBindingBehavior.prototype.getValidateTrigger = function () { + return validateTrigger.blur; + }; + return ValidateOnBlurBindingBehavior; +}(ValidateBindingBehaviorBase)); +export { ValidateOnBlurBindingBehavior }; ValidateOnBlurBindingBehavior.inject = [TaskQueue]; /** * Binding behavior. Indicates the bound property should be validated * when the associated element is changed by the user, causing a change * to the model. */ -export class ValidateOnChangeBindingBehavior extends ValidateBindingBehaviorBase { - getValidateTrigger() { - return validateTrigger.change; +var ValidateOnChangeBindingBehavior = (function (_super) { + __extends(ValidateOnChangeBindingBehavior, _super); + function ValidateOnChangeBindingBehavior() { + return _super.apply(this, arguments) || this; } -} + ValidateOnChangeBindingBehavior.prototype.getValidateTrigger = function () { + return validateTrigger.change; + }; + return ValidateOnChangeBindingBehavior; +}(ValidateBindingBehaviorBase)); +export { ValidateOnChangeBindingBehavior }; ValidateOnChangeBindingBehavior.inject = [TaskQueue]; /** * Binding behavior. Indicates the bound property should be validated * when the associated element blurs or is changed by the user, causing * a change to the model. */ -export class ValidateOnChangeOrBlurBindingBehavior extends ValidateBindingBehaviorBase { - getValidateTrigger() { - return validateTrigger.changeOrBlur; +var ValidateOnChangeOrBlurBindingBehavior = (function (_super) { + __extends(ValidateOnChangeOrBlurBindingBehavior, _super); + function ValidateOnChangeOrBlurBindingBehavior() { + return _super.apply(this, arguments) || this; } -} + ValidateOnChangeOrBlurBindingBehavior.prototype.getValidateTrigger = function () { + return validateTrigger.changeOrBlur; + }; + return ValidateOnChangeOrBlurBindingBehavior; +}(ValidateBindingBehaviorBase)); +export { ValidateOnChangeOrBlurBindingBehavior }; ValidateOnChangeOrBlurBindingBehavior.inject = [TaskQueue]; diff --git a/dist/es2015/validate-instruction.d.ts b/dist/es2015/validate-instruction.d.ts new file mode 100644 index 00000000..2f792a70 --- /dev/null +++ b/dist/es2015/validate-instruction.d.ts @@ -0,0 +1,17 @@ +/** + * Instructions for the validation controller's validate method. + */ +export interface ValidateInstruction { + /** + * The object to validate. + */ + object: any; + /** + * The property to validate. Optional. + */ + propertyName?: any; + /** + * The rules to validate. Optional. + */ + rules?: any; +} diff --git a/dist/native-modules/validation-renderer.js b/dist/es2015/validate-instruction.js similarity index 100% rename from dist/native-modules/validation-renderer.js rename to dist/es2015/validate-instruction.js diff --git a/dist/es2015/validate-result.d.ts b/dist/es2015/validate-result.d.ts new file mode 100644 index 00000000..461c2318 --- /dev/null +++ b/dist/es2015/validate-result.d.ts @@ -0,0 +1,23 @@ +/** + * The result of validating an individual validation rule. + */ +export declare class ValidateResult { + rule: any; + object: any; + propertyName: string | null; + valid: boolean; + message: string | null; + private static nextId; + /** + * A number that uniquely identifies the result instance. + */ + id: number; + /** + * @param rule The rule associated with the result. Validator implementation specific. + * @param object The object that was validated. + * @param propertyName The name of the property that was validated. + * @param error The error, if the result is a validation error. + */ + constructor(rule: any, object: any, propertyName: string | null, valid: boolean, message?: string | null); + toString(): string | null; +} diff --git a/dist/es2015/validate-result.js b/dist/es2015/validate-result.js new file mode 100644 index 00000000..7c21786e --- /dev/null +++ b/dist/es2015/validate-result.js @@ -0,0 +1,26 @@ +/** + * The result of validating an individual validation rule. + */ +var ValidateResult = (function () { + /** + * @param rule The rule associated with the result. Validator implementation specific. + * @param object The object that was validated. + * @param propertyName The name of the property that was validated. + * @param error The error, if the result is a validation error. + */ + function ValidateResult(rule, object, propertyName, valid, message) { + if (message === void 0) { message = null; } + this.rule = rule; + this.object = object; + this.propertyName = propertyName; + this.valid = valid; + this.message = message; + this.id = ValidateResult.nextId++; + } + ValidateResult.prototype.toString = function () { + return this.valid ? 'Valid.' : this.message; + }; + return ValidateResult; +}()); +export { ValidateResult }; +ValidateResult.nextId = 0; diff --git a/dist/es2015/validate-trigger.js b/dist/es2015/validate-trigger.js index 9329aaf3..1ccec739 100644 --- a/dist/es2015/validate-trigger.js +++ b/dist/es2015/validate-trigger.js @@ -1,7 +1,9 @@ /** * Validation triggers. */ -export const validateTrigger = { +/** + * Validation triggers. + */ export var validateTrigger = { /** * Manual validation. Use the controller's `validate()` and `reset()` methods * to validate all bindings. diff --git a/dist/es2015/validation-controller-factory.js b/dist/es2015/validation-controller-factory.js index 4f431d2b..5cb1c90b 100644 --- a/dist/es2015/validation-controller-factory.js +++ b/dist/es2015/validation-controller-factory.js @@ -3,30 +3,32 @@ import { Validator } from './validator'; /** * Creates ValidationController instances. */ -export class ValidationControllerFactory { - constructor(container) { +var ValidationControllerFactory = (function () { + function ValidationControllerFactory(container) { this.container = container; } - static get(container) { + ValidationControllerFactory.get = function (container) { return new ValidationControllerFactory(container); - } + }; /** * Creates a new controller instance. */ - create(validator) { + ValidationControllerFactory.prototype.create = function (validator) { if (!validator) { validator = this.container.get(Validator); } return new ValidationController(validator); - } + }; /** * Creates a new controller and registers it in the current element's container so that it's * available to the validate binding behavior and renderers. */ - createForCurrentScope(validator) { - const controller = this.create(validator); + ValidationControllerFactory.prototype.createForCurrentScope = function (validator) { + var controller = this.create(validator); this.container.registerInstance(ValidationController, controller); return controller; - } -} + }; + return ValidationControllerFactory; +}()); +export { ValidationControllerFactory }; ValidationControllerFactory['protocol:aurelia:resolver'] = true; diff --git a/dist/es2015/validation-controller.d.ts b/dist/es2015/validation-controller.d.ts index a65621f3..d88935e5 100644 --- a/dist/es2015/validation-controller.d.ts +++ b/dist/es2015/validation-controller.d.ts @@ -1,25 +1,13 @@ import { Binding } from 'aurelia-binding'; import { Validator } from './validator'; import { ValidationRenderer } from './validation-renderer'; -import { ValidationError } from './validation-error'; -export interface ValidateInstruction { - /** - * The object to validate. - */ - object: any; - /** - * The property to validate. Optional. - */ - propertyName?: any; - /** - * The rules to validate. Optional. - */ - rules?: any; -} +import { ValidateResult } from './validate-result'; +import { ValidateInstruction } from './validate-instruction'; +import { ControllerValidateResult } from './controller-validate-result'; /** * Orchestrates validation. * Manages a set of bindings, renderers and objects. - * Exposes the current list of validation errors for binding purposes. + * Exposes the current list of validation results for binding purposes. */ export declare class ValidationController { private validator; @@ -27,9 +15,13 @@ export declare class ValidationController { private bindings; private renderers; /** - * Errors that have been rendered by the controller. + * Validation results that have been rendered by the controller. + */ + private results; + /** + * Validation errors that have been rendered by the controller. */ - errors: ValidationError[]; + errors: ValidateResult[]; /** * Whether the controller is currently validating. */ @@ -54,13 +46,13 @@ export declare class ValidationController { */ removeObject(object: any): void; /** - * Adds and renders a ValidationError. + * Adds and renders an error. */ - addError(message: string, object: any, propertyName?: string): ValidationError; + addError(message: string, object: any, propertyName?: string | null): ValidateResult; /** - * Removes and unrenders a ValidationError. + * Removes and unrenders an error. */ - removeError(error: ValidationError): void; + removeError(result: ValidateResult): void; /** * Adds a renderer. * @param renderer The renderer. @@ -85,31 +77,32 @@ export declare class ValidationController { unregisterBinding(binding: Binding): void; /** * Interprets the instruction and returns a predicate that will identify - * relevant errors in the list of rendered errors. + * relevant results in the list of rendered validation results. */ private getInstructionPredicate(instruction?); /** - * Validates and renders errors. + * Validates and renders results. * @param instruction Optional. Instructions on what to validate. If undefined, all * objects and bindings will be validated. */ - validate(instruction?: ValidateInstruction): Promise; + validate(instruction?: ValidateInstruction): Promise; /** - * Resets any rendered errors (unrenders). - * @param instruction Optional. Instructions on what to reset. If unspecified all rendered errors will be unrendered. + * Resets any rendered validation results (unrenders). + * @param instruction Optional. Instructions on what to reset. If unspecified all rendered results + * will be unrendered. */ reset(instruction?: ValidateInstruction): void; /** * Gets the elements associated with an object and propertyName (if any). */ private getAssociatedElements({object, propertyName}); - private processErrorDelta(kind, oldErrors, newErrors); + private processResultDelta(kind, oldResults, newResults); /** * Validates the property associated with a binding. */ validateBinding(binding: Binding): void; /** - * Resets the errors for a property associated with a binding. + * Resets the results for a property associated with a binding. */ resetBinding(binding: Binding): void; } diff --git a/dist/es2015/validation-controller.js b/dist/es2015/validation-controller.js index f419f49f..b04b98ae 100644 --- a/dist/es2015/validation-controller.js +++ b/dist/es2015/validation-controller.js @@ -1,28 +1,32 @@ import { Validator } from './validator'; import { validateTrigger } from './validate-trigger'; import { getPropertyInfo } from './property-info'; -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; /** * Orchestrates validation. * Manages a set of bindings, renderers and objects. - * Exposes the current list of validation errors for binding purposes. + * Exposes the current list of validation results for binding purposes. */ -export class ValidationController { - constructor(validator) { +var ValidationController = (function () { + function ValidationController(validator) { this.validator = validator; // Registered bindings (via the validate binding behavior) this.bindings = new Map(); // Renderers that have been added to the controller instance. this.renderers = []; /** - * Errors that have been rendered by the controller. + * Validation results that have been rendered by the controller. + */ + this.results = []; + /** + * Validation errors that have been rendered by the controller. */ this.errors = []; /** * Whether the controller is currently validating. */ this.validating = false; - // Elements related to errors that have been rendered. + // Elements related to validation results that have been rendered. this.elements = new Map(); // Objects that have been added to the controller instance (entity-style validation). this.objects = new Map(); @@ -38,238 +42,272 @@ export class ValidationController { * @param object The object. * @param rules Optional. The rules. If rules aren't supplied the Validator implementation will lookup the rules. */ - addObject(object, rules) { + ValidationController.prototype.addObject = function (object, rules) { this.objects.set(object, rules); - } + }; /** * Removes an object from the set of objects that should be validated when validate is called. * @param object The object. */ - removeObject(object) { + ValidationController.prototype.removeObject = function (object) { this.objects.delete(object); - this.processErrorDelta('reset', this.errors.filter(error => error.object === object), []); - } + this.processResultDelta('reset', this.results.filter(function (result) { return result.object === object; }), []); + }; /** - * Adds and renders a ValidationError. + * Adds and renders an error. */ - addError(message, object, propertyName) { - const error = new ValidationError({}, message, object, propertyName); - this.processErrorDelta('validate', [], [error]); - return error; - } + ValidationController.prototype.addError = function (message, object, propertyName) { + if (propertyName === void 0) { propertyName = null; } + var result = new ValidateResult({}, object, propertyName, false, message); + this.processResultDelta('validate', [], [result]); + return result; + }; /** - * Removes and unrenders a ValidationError. + * Removes and unrenders an error. */ - removeError(error) { - if (this.errors.indexOf(error) !== -1) { - this.processErrorDelta('reset', [error], []); + ValidationController.prototype.removeError = function (result) { + if (this.results.indexOf(result) !== -1) { + this.processResultDelta('reset', [result], []); } - } + }; /** * Adds a renderer. * @param renderer The renderer. */ - addRenderer(renderer) { + ValidationController.prototype.addRenderer = function (renderer) { + var _this = this; this.renderers.push(renderer); renderer.render({ kind: 'validate', - render: this.errors.map(error => ({ error, elements: this.elements.get(error) })), + render: this.results.map(function (result) { return ({ result: result, elements: _this.elements.get(result) }); }), unrender: [] }); - } + }; /** * Removes a renderer. * @param renderer The renderer. */ - removeRenderer(renderer) { + ValidationController.prototype.removeRenderer = function (renderer) { + var _this = this; this.renderers.splice(this.renderers.indexOf(renderer), 1); renderer.render({ kind: 'reset', render: [], - unrender: this.errors.map(error => ({ error, elements: this.elements.get(error) })) + unrender: this.results.map(function (result) { return ({ result: result, elements: _this.elements.get(result) }); }) }); - } + }; /** * Registers a binding with the controller. * @param binding The binding instance. * @param target The DOM element. * @param rules (optional) rules associated with the binding. Validator implementation specific. */ - registerBinding(binding, target, rules) { - this.bindings.set(binding, { target, rules, propertyInfo: null }); - } + ValidationController.prototype.registerBinding = function (binding, target, rules) { + this.bindings.set(binding, { target: target, rules: rules, propertyInfo: null }); + }; /** * Unregisters a binding with the controller. * @param binding The binding instance. */ - unregisterBinding(binding) { + ValidationController.prototype.unregisterBinding = function (binding) { this.resetBinding(binding); this.bindings.delete(binding); - } + }; /** * Interprets the instruction and returns a predicate that will identify - * relevant errors in the list of rendered errors. + * relevant results in the list of rendered validation results. */ - getInstructionPredicate(instruction) { + ValidationController.prototype.getInstructionPredicate = function (instruction) { + var _this = this; if (instruction) { - const { object, propertyName, rules } = instruction; - let predicate; + var object_1 = instruction.object, propertyName_1 = instruction.propertyName, rules_1 = instruction.rules; + var predicate_1; if (instruction.propertyName) { - predicate = x => x.object === object && x.propertyName === propertyName; + predicate_1 = function (x) { return x.object === object_1 && x.propertyName === propertyName_1; }; } else { - predicate = x => x.object === object; + predicate_1 = function (x) { return x.object === object_1; }; } - if (rules) { - return x => predicate(x) && this.validator.ruleExists(rules, x.rule); + if (rules_1) { + return function (x) { return predicate_1(x) && _this.validator.ruleExists(rules_1, x.rule); }; } - return predicate; + return predicate_1; } else { - return () => true; + return function () { return true; }; } - } + }; /** - * Validates and renders errors. + * Validates and renders results. * @param instruction Optional. Instructions on what to validate. If undefined, all * objects and bindings will be validated. */ - validate(instruction) { + ValidationController.prototype.validate = function (instruction) { + var _this = this; // Get a function that will process the validation instruction. - let execute; + var execute; if (instruction) { - let { object, propertyName, rules } = instruction; + var object_2 = instruction.object, propertyName_2 = instruction.propertyName, rules_2 = instruction.rules; // if rules were not specified, check the object map. - rules = rules || this.objects.get(object); + rules_2 = rules_2 || this.objects.get(object_2); // property specified? if (instruction.propertyName === undefined) { // validate the specified object. - execute = () => this.validator.validateObject(object, rules); + execute = function () { return _this.validator.validateObject(object_2, rules_2); }; } else { // validate the specified property. - execute = () => this.validator.validateProperty(object, propertyName, rules); + execute = function () { return _this.validator.validateProperty(object_2, propertyName_2, rules_2); }; } } else { // validate all objects and bindings. - execute = () => { - const promises = []; - for (let [object, rules] of Array.from(this.objects)) { - promises.push(this.validator.validateObject(object, rules)); + execute = function () { + var promises = []; + for (var _i = 0, _a = Array.from(_this.objects); _i < _a.length; _i++) { + var _b = _a[_i], object = _b[0], rules = _b[1]; + promises.push(_this.validator.validateObject(object, rules)); } - for (let [binding, { rules }] of Array.from(this.bindings)) { - const propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); - if (!propertyInfo || this.objects.has(propertyInfo.object)) { + for (var _c = 0, _d = Array.from(_this.bindings); _c < _d.length; _c++) { + var _e = _d[_c], binding = _e[0], rules = _e[1].rules; + var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); + if (!propertyInfo || _this.objects.has(propertyInfo.object)) { continue; } - promises.push(this.validator.validateProperty(propertyInfo.object, propertyInfo.propertyName, rules)); + promises.push(_this.validator.validateProperty(propertyInfo.object, propertyInfo.propertyName, rules)); } - return Promise.all(promises).then(errorSets => errorSets.reduce((a, b) => a.concat(b), [])); + return Promise.all(promises).then(function (resultSets) { return resultSets.reduce(function (a, b) { return a.concat(b); }, []); }); }; } - // Wait for any existing validation to finish, execute the instruction, render the errors. + // Wait for any existing validation to finish, execute the instruction, render the results. this.validating = true; - let result = this.finishValidating + var returnPromise = this.finishValidating .then(execute) - .then(newErrors => { - const predicate = this.getInstructionPredicate(instruction); - const oldErrors = this.errors.filter(predicate); - this.processErrorDelta('validate', oldErrors, newErrors); - if (result === this.finishValidating) { - this.validating = false; + .then(function (newResults) { + var predicate = _this.getInstructionPredicate(instruction); + var oldResults = _this.results.filter(predicate); + _this.processResultDelta('validate', oldResults, newResults); + if (returnPromise === _this.finishValidating) { + _this.validating = false; } - return newErrors; + var result = { + instruction: instruction, + valid: newResults.find(function (x) { return !x.valid; }) === undefined, + results: newResults + }; + return result; }) - .catch(error => { + .catch(function (exception) { // recover, to enable subsequent calls to validate() - this.validating = false; - this.finishValidating = Promise.resolve(); - return Promise.reject(error); + _this.validating = false; + _this.finishValidating = Promise.resolve(); + return Promise.reject(exception); }); - this.finishValidating = result; - return result; - } + this.finishValidating = returnPromise; + return returnPromise; + }; /** - * Resets any rendered errors (unrenders). - * @param instruction Optional. Instructions on what to reset. If unspecified all rendered errors will be unrendered. + * Resets any rendered validation results (unrenders). + * @param instruction Optional. Instructions on what to reset. If unspecified all rendered results + * will be unrendered. */ - reset(instruction) { - const predicate = this.getInstructionPredicate(instruction); - const oldErrors = this.errors.filter(predicate); - this.processErrorDelta('reset', oldErrors, []); - } + ValidationController.prototype.reset = function (instruction) { + var predicate = this.getInstructionPredicate(instruction); + var oldResults = this.results.filter(predicate); + this.processResultDelta('reset', oldResults, []); + }; /** * Gets the elements associated with an object and propertyName (if any). */ - getAssociatedElements({ object, propertyName }) { - const elements = []; - for (let [binding, { target }] of Array.from(this.bindings)) { - const propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); + ValidationController.prototype.getAssociatedElements = function (_a) { + var object = _a.object, propertyName = _a.propertyName; + var elements = []; + for (var _i = 0, _b = Array.from(this.bindings); _i < _b.length; _i++) { + var _c = _b[_i], binding = _c[0], target = _c[1].target; + var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); if (propertyInfo && propertyInfo.object === object && propertyInfo.propertyName === propertyName) { elements.push(target); } } return elements; - } - processErrorDelta(kind, oldErrors, newErrors) { + }; + ValidationController.prototype.processResultDelta = function (kind, oldResults, newResults) { // prepare the instruction. - const instruction = { - kind, + var instruction = { + kind: kind, render: [], unrender: [] }; - // create a shallow copy of newErrors so we can mutate it without causing side-effects. - newErrors = newErrors.slice(0); - // create unrender instructions from the old errors. - for (let oldError of oldErrors) { - // get the elements associated with the old error. - const elements = this.elements.get(oldError); - // remove the old error from the element map. - this.elements.delete(oldError); + // create a shallow copy of newResults so we can mutate it without causing side-effects. + newResults = newResults.slice(0); + var _loop_1 = function (oldResult) { + // get the elements associated with the old result. + var elements = this_1.elements.get(oldResult); + // remove the old result from the element map. + this_1.elements.delete(oldResult); // create the unrender instruction. - instruction.unrender.push({ error: oldError, elements }); - // determine if there's a corresponding new error for the old error we are unrendering. - const newErrorIndex = newErrors.findIndex(x => x.rule === oldError.rule && x.object === oldError.object && x.propertyName === oldError.propertyName); - if (newErrorIndex === -1) { - // no corresponding new error... simple remove. - this.errors.splice(this.errors.indexOf(oldError), 1); + instruction.unrender.push({ result: oldResult, elements: elements }); + // determine if there's a corresponding new result for the old result we are unrendering. + var newResultIndex = newResults.findIndex(function (x) { return x.rule === oldResult.rule && x.object === oldResult.object && x.propertyName === oldResult.propertyName; }); + if (newResultIndex === -1) { + // no corresponding new result... simple remove. + this_1.results.splice(this_1.results.indexOf(oldResult), 1); + if (!oldResult.valid) { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1); + } } else { - // there is a corresponding new error... - const newError = newErrors.splice(newErrorIndex, 1)[0]; - // get the elements that are associated with the new error. - const elements = this.getAssociatedElements(newError); - this.elements.set(newError, elements); - // create a render instruction for the new error. - instruction.render.push({ error: newError, elements }); - // do an in-place replacement of the old error with the new error. - // this ensures any repeats bound to this.errors will not thrash. - this.errors.splice(this.errors.indexOf(oldError), 1, newError); + // there is a corresponding new result... + var newResult = newResults.splice(newResultIndex, 1)[0]; + // get the elements that are associated with the new result. + var elements_1 = this_1.getAssociatedElements(newResult); + this_1.elements.set(newResult, elements_1); + // create a render instruction for the new result. + instruction.render.push({ result: newResult, elements: elements_1 }); + // do an in-place replacement of the old result with the new result. + // this ensures any repeats bound to this.results will not thrash. + this_1.results.splice(this_1.results.indexOf(oldResult), 1, newResult); + if (newResult.valid) { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1); + } + else { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1, newResult); + } } + }; + var this_1 = this; + // create unrender instructions from the old results. + for (var _i = 0, oldResults_1 = oldResults; _i < oldResults_1.length; _i++) { + var oldResult = oldResults_1[_i]; + _loop_1(oldResult); } - // create render instructions from the remaining new errors. - for (let error of newErrors) { - const elements = this.getAssociatedElements(error); - instruction.render.push({ error, elements }); - this.elements.set(error, elements); - this.errors.push(error); + // create render instructions from the remaining new results. + for (var _a = 0, newResults_1 = newResults; _a < newResults_1.length; _a++) { + var result = newResults_1[_a]; + var elements = this.getAssociatedElements(result); + instruction.render.push({ result: result, elements: elements }); + this.elements.set(result, elements); + this.results.push(result); + if (!result.valid) { + this.errors.push(result); + } } // render. - for (let renderer of this.renderers) { + for (var _b = 0, _c = this.renderers; _b < _c.length; _b++) { + var renderer = _c[_b]; renderer.render(instruction); } - } + }; /** * Validates the property associated with a binding. */ - validateBinding(binding) { + ValidationController.prototype.validateBinding = function (binding) { if (!binding.isBound) { return; } - let propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); - let rules = undefined; - const registeredBinding = this.bindings.get(binding); + var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); + var rules = undefined; + var registeredBinding = this.bindings.get(binding); if (registeredBinding) { rules = registeredBinding.rules; registeredBinding.propertyInfo = propertyInfo; @@ -277,15 +315,15 @@ export class ValidationController { if (!propertyInfo) { return; } - const { object, propertyName } = propertyInfo; - this.validate({ object, propertyName, rules }); - } + var object = propertyInfo.object, propertyName = propertyInfo.propertyName; + this.validate({ object: object, propertyName: propertyName, rules: rules }); + }; /** - * Resets the errors for a property associated with a binding. + * Resets the results for a property associated with a binding. */ - resetBinding(binding) { - const registeredBinding = this.bindings.get(binding); - let propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); + ValidationController.prototype.resetBinding = function (binding) { + var registeredBinding = this.bindings.get(binding); + var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); if (!propertyInfo && registeredBinding) { propertyInfo = registeredBinding.propertyInfo; } @@ -295,8 +333,10 @@ export class ValidationController { if (!propertyInfo) { return; } - const { object, propertyName } = propertyInfo; - this.reset({ object, propertyName }); - } -} + var object = propertyInfo.object, propertyName = propertyInfo.propertyName; + this.reset({ object: object, propertyName: propertyName }); + }; + return ValidationController; +}()); +export { ValidationController }; ValidationController.inject = [Validator]; diff --git a/dist/es2015/validation-error.d.ts b/dist/es2015/validation-error.d.ts deleted file mode 100644 index 34064d03..00000000 --- a/dist/es2015/validation-error.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A validation error. - */ -export declare class ValidationError { - rule: any; - message: string; - object: any; - propertyName: string | null; - private static nextId; - /** - * A number that uniquely identifies the error instance. - */ - id: number; - /** - * @param rule The rule associated with the error. Validator implementation specific. - * @param message The error message. - * @param object The invalid object - * @param propertyName The name of the invalid property. Optional. - */ - constructor(rule: any, message: string, object: any, propertyName?: string | null); - toString(): string; -} diff --git a/dist/es2015/validation-error.js b/dist/es2015/validation-error.js deleted file mode 100644 index 49eb9dfa..00000000 --- a/dist/es2015/validation-error.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A validation error. - */ -export class ValidationError { - /** - * @param rule The rule associated with the error. Validator implementation specific. - * @param message The error message. - * @param object The invalid object - * @param propertyName The name of the invalid property. Optional. - */ - constructor(rule, message, object, propertyName = null) { - this.rule = rule; - this.message = message; - this.object = object; - this.propertyName = propertyName; - this.id = ValidationError.nextId++; - } - toString() { - return this.message; - } -} -ValidationError.nextId = 0; diff --git a/dist/es2015/validation-errors-custom-attribute.d.ts b/dist/es2015/validation-errors-custom-attribute.d.ts index 9342dd0d..73340e73 100644 --- a/dist/es2015/validation-errors-custom-attribute.d.ts +++ b/dist/es2015/validation-errors-custom-attribute.d.ts @@ -1,9 +1,9 @@ import { Lazy } from 'aurelia-dependency-injection'; import { ValidationController } from './validation-controller'; -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; import { ValidationRenderer, RenderInstruction } from './validation-renderer'; export interface RenderedError { - error: ValidationError; + error: ValidateResult; targets: Element[]; } export declare class ValidationErrorsCustomAttribute implements ValidationRenderer { diff --git a/dist/es2015/validation-errors-custom-attribute.js b/dist/es2015/validation-errors-custom-attribute.js index 0debeb0d..afd76aad 100644 --- a/dist/es2015/validation-errors-custom-attribute.js +++ b/dist/es2015/validation-errors-custom-attribute.js @@ -8,14 +8,14 @@ import { bindingMode } from 'aurelia-binding'; import { Lazy } from 'aurelia-dependency-injection'; import { customAttribute } from 'aurelia-templating'; import { ValidationController } from './validation-controller'; -export let ValidationErrorsCustomAttribute = class ValidationErrorsCustomAttribute { - constructor(boundaryElement, controllerAccessor) { +var ValidationErrorsCustomAttribute = (function () { + function ValidationErrorsCustomAttribute(boundaryElement, controllerAccessor) { this.boundaryElement = boundaryElement; this.controllerAccessor = controllerAccessor; this.errors = []; } - sort() { - this.errors.sort((a, b) => { + ValidationErrorsCustomAttribute.prototype.sort = function () { + this.errors.sort(function (a, b) { if (a.targets[0] === b.targets[0]) { return 0; } @@ -23,35 +23,47 @@ export let ValidationErrorsCustomAttribute = class ValidationErrorsCustomAttribu return a.targets[0].compareDocumentPosition(b.targets[0]) & 2 ? 1 : -1; /* tslint:enable:no-bitwise */ }); - } - interestingElements(elements) { - return elements.filter(e => this.boundaryElement.contains(e)); - } - render(instruction) { - for (let { error } of instruction.unrender) { - const index = this.errors.findIndex(x => x.error === error); + }; + ValidationErrorsCustomAttribute.prototype.interestingElements = function (elements) { + var _this = this; + return elements.filter(function (e) { return _this.boundaryElement.contains(e); }); + }; + ValidationErrorsCustomAttribute.prototype.render = function (instruction) { + var _loop_1 = function (result) { + var index = this_1.errors.findIndex(function (x) { return x.error === result; }); if (index !== -1) { - this.errors.splice(index, 1); + this_1.errors.splice(index, 1); } + }; + var this_1 = this; + for (var _i = 0, _a = instruction.unrender; _i < _a.length; _i++) { + var result = _a[_i].result; + _loop_1(result); } - for (let { error, elements } of instruction.render) { - const targets = this.interestingElements(elements); + for (var _b = 0, _c = instruction.render; _b < _c.length; _b++) { + var _d = _c[_b], result = _d.result, elements = _d.elements; + if (result.valid) { + continue; + } + var targets = this.interestingElements(elements); if (targets.length) { - this.errors.push({ error, targets }); + this.errors.push({ error: result, targets: targets }); } } this.sort(); this.value = this.errors; - } - bind() { + }; + ValidationErrorsCustomAttribute.prototype.bind = function () { this.controllerAccessor().addRenderer(this); this.value = this.errors; - } - unbind() { + }; + ValidationErrorsCustomAttribute.prototype.unbind = function () { this.controllerAccessor().removeRenderer(this); - } -}; + }; + return ValidationErrorsCustomAttribute; +}()); ValidationErrorsCustomAttribute.inject = [Element, Lazy.of(ValidationController)]; ValidationErrorsCustomAttribute = __decorate([ customAttribute('validation-errors', bindingMode.twoWay) ], ValidationErrorsCustomAttribute); +export { ValidationErrorsCustomAttribute }; diff --git a/dist/es2015/validation-renderer-custom-attribute.js b/dist/es2015/validation-renderer-custom-attribute.js index 83b6c5d4..b5eee48e 100644 --- a/dist/es2015/validation-renderer-custom-attribute.js +++ b/dist/es2015/validation-renderer-custom-attribute.js @@ -1,16 +1,20 @@ import { ValidationController } from './validation-controller'; -export class ValidationRendererCustomAttribute { - created(view) { - this.container = view.container; +var ValidationRendererCustomAttribute = (function () { + function ValidationRendererCustomAttribute() { } - bind() { + ValidationRendererCustomAttribute.prototype.created = function (view) { + this.container = view.container; + }; + ValidationRendererCustomAttribute.prototype.bind = function () { this.controller = this.container.get(ValidationController); this.renderer = this.container.get(this.value); this.controller.addRenderer(this.renderer); - } - unbind() { + }; + ValidationRendererCustomAttribute.prototype.unbind = function () { this.controller.removeRenderer(this.renderer); this.controller = null; this.renderer = null; - } -} + }; + return ValidationRendererCustomAttribute; +}()); +export { ValidationRendererCustomAttribute }; diff --git a/dist/es2015/validation-renderer.d.ts b/dist/es2015/validation-renderer.d.ts index 0422409b..eb430d9d 100644 --- a/dist/es2015/validation-renderer.d.ts +++ b/dist/es2015/validation-renderer.d.ts @@ -1,19 +1,19 @@ -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; /** - * An error to render (or unrender) and the associated elements (if any) + * A result to render (or unrender) and the associated elements (if any) */ -export interface RenderErrorInstruction { +export interface ResultInstruction { /** - * The validation error. + * The validation result. */ - error: ValidationError; + result: ValidateResult; /** * The associated elements (if any). */ elements: Element[]; } /** - * Defines which errors to render and which errors to unrender. + * Defines which validation results to render and which validation results to unrender. */ export interface RenderInstruction { /** @@ -21,22 +21,22 @@ export interface RenderInstruction { */ kind: 'validate' | 'reset'; /** - * The errors to render. + * The results to render. */ - render: RenderErrorInstruction[]; + render: ResultInstruction[]; /** - * The errors to unrender. + * The results to unrender. */ - unrender: RenderErrorInstruction[]; + unrender: ResultInstruction[]; } /** - * Renders validation errors. + * Renders validation results. */ export interface ValidationRenderer { /** - * Render the errors. - * @param instruction The render instruction. Defines which errors to render and which - * errors to unrender. + * Render the validation results. + * @param instruction The render instruction. Defines which results to render and which + * results to unrender. */ render(instruction: RenderInstruction): void; } diff --git a/dist/es2015/validator.d.ts b/dist/es2015/validator.d.ts index edaa3f40..82c045e8 100644 --- a/dist/es2015/validator.d.ts +++ b/dist/es2015/validator.d.ts @@ -1,7 +1,6 @@ -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; /** - * Validates. - * Responsible for validating objects and properties. + * Validates objects and properties. */ export declare abstract class Validator { /** @@ -11,14 +10,14 @@ export declare abstract class Validator { * @param rules Optional. If unspecified, the implementation should lookup the rules for the * specified object. This may not be possible for all implementations of this interface. */ - abstract validateProperty(object: any, propertyName: string, rules?: any): Promise; + abstract validateProperty(object: any, propertyName: string, rules?: any): Promise; /** * Validates all rules for specified object and it's properties. * @param object The object to validate. * @param rules Optional. If unspecified, the implementation should lookup the rules for the * specified object. This may not be possible for all implementations of this interface. */ - abstract validateObject(object: any, rules?: any): Promise; + abstract validateObject(object: any, rules?: any): Promise; /** * Determines whether a rule exists in a set of rules. * @param rules The rules to search. diff --git a/dist/es2015/validator.js b/dist/es2015/validator.js index 797d4c50..826b2c24 100644 --- a/dist/es2015/validator.js +++ b/dist/es2015/validator.js @@ -1,6 +1,9 @@ /** - * Validates. - * Responsible for validating objects and properties. + * Validates objects and properties. */ -export class Validator { -} +var Validator = (function () { + function Validator() { + } + return Validator; +}()); +export { Validator }; diff --git a/dist/native-modules/aurelia-validation.d.ts b/dist/native-modules/aurelia-validation.d.ts deleted file mode 100644 index b73b53e1..00000000 --- a/dist/native-modules/aurelia-validation.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -export * from './validate-binding-behavior'; -export * from './validate-trigger'; -export * from './validation-controller'; -export * from './validation-controller-factory'; -export * from './validation-error'; -export * from './validation-errors-custom-attribute'; -export * from './validation-renderer-custom-attribute'; -export * from './validation-renderer'; -export * from './validator'; -export * from './implementation/rule'; -export * from './implementation/rules'; -export * from './implementation/standard-validator'; -export * from './implementation/validation-messages'; -export * from './implementation/validation-parser'; -export * from './implementation/validation-rules'; -import { Container } from 'aurelia-dependency-injection'; -import { Validator } from './validator'; -/** - * Aurelia Validation Configuration API - */ -export declare class AureliaValidationConfiguration { - private validatorType; - /** - * Use a custom Validator implementation. - */ - customValidator(type: { - new (...args: any[]): Validator; - }): void; - /** - * Applies the configuration. - */ - apply(container: Container): void; -} -/** - * Configures the plugin. - */ -export declare function configure(frameworkConfig: { - container: Container; - globalResources: (...resources: string[]) => any; -}, callback?: (config: AureliaValidationConfiguration) => void): void; diff --git a/dist/native-modules/aurelia-validation.js b/dist/native-modules/aurelia-validation.js deleted file mode 100644 index d7b627ac..00000000 --- a/dist/native-modules/aurelia-validation.js +++ /dev/null @@ -1,59 +0,0 @@ -// Exports -export * from './validate-binding-behavior'; -export * from './validate-trigger'; -export * from './validation-controller'; -export * from './validation-controller-factory'; -export * from './validation-error'; -export * from './validation-errors-custom-attribute'; -export * from './validation-renderer-custom-attribute'; -export * from './validation-renderer'; -export * from './validator'; -export * from './implementation/rule'; -export * from './implementation/rules'; -export * from './implementation/standard-validator'; -export * from './implementation/validation-messages'; -export * from './implementation/validation-parser'; -export * from './implementation/validation-rules'; -import { Validator } from './validator'; -import { StandardValidator } from './implementation/standard-validator'; -import { ValidationParser } from './implementation/validation-parser'; -import { ValidationRules } from './implementation/validation-rules'; -/** - * Aurelia Validation Configuration API - */ -export var AureliaValidationConfiguration = (function () { - function AureliaValidationConfiguration() { - this.validatorType = StandardValidator; - } - /** - * Use a custom Validator implementation. - */ - AureliaValidationConfiguration.prototype.customValidator = function (type) { - this.validatorType = type; - }; - /** - * Applies the configuration. - */ - AureliaValidationConfiguration.prototype.apply = function (container) { - var validator = container.get(this.validatorType); - container.registerInstance(Validator, validator); - }; - return AureliaValidationConfiguration; -}()); -/** - * Configures the plugin. - */ -export function configure(frameworkConfig, callback) { - // the fluent rule definition API needs the parser to translate messages - // to interpolation expressions. - var parser = frameworkConfig.container.get(ValidationParser); - ValidationRules.initialize(parser); - // configure... - var config = new AureliaValidationConfiguration(); - if (callback instanceof Function) { - callback(config); - } - config.apply(frameworkConfig.container); - // globalize the behaviors. - frameworkConfig.globalResources('./validate-binding-behavior', './validation-errors-custom-attribute', './validation-renderer-custom-attribute'); -} diff --git a/dist/native-modules/implementation/rule.d.ts b/dist/native-modules/implementation/rule.d.ts deleted file mode 100644 index 8bba9d76..00000000 --- a/dist/native-modules/implementation/rule.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Expression } from 'aurelia-binding'; -/** - * Information related to a property that is the subject of validation. - */ -export interface RuleProperty { - /** - * The property name. null indicates the rule targets the object itself. - */ - name: string | null; - /** - * The displayName of the property (or object). - */ - displayName: string | null; -} -/** - * A rule definition. Associations a rule with a property or object. - */ -export interface Rule { - property: RuleProperty; - condition: (value: TValue, object?: TObject) => boolean | Promise; - config: Object; - when: { - (object: TObject): boolean; - } | null; - messageKey: string; - message: Expression | null; - sequence: number; - tag?: string; -} diff --git a/dist/native-modules/implementation/rules.d.ts b/dist/native-modules/implementation/rules.d.ts deleted file mode 100644 index 30947f6f..00000000 --- a/dist/native-modules/implementation/rules.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Rule } from './rule'; -/** - * Sets, unsets and retrieves rules on an object or constructor function. - */ -export declare class Rules { - /** - * The name of the property that stores the rules. - */ - private static key; - /** - * Applies the rules to a target. - */ - static set(target: any, rules: Rule[][]): void; - /** - * Removes rules from a target. - */ - static unset(target: any): void; - /** - * Retrieves the target's rules. - */ - static get(target: any): Rule[][] | null; -} diff --git a/dist/native-modules/implementation/rules.js b/dist/native-modules/implementation/rules.js deleted file mode 100644 index 5a79a5fc..00000000 --- a/dist/native-modules/implementation/rules.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Sets, unsets and retrieves rules on an object or constructor function. - */ -export var Rules = (function () { - function Rules() { - } - /** - * Applies the rules to a target. - */ - Rules.set = function (target, rules) { - if (target instanceof Function) { - target = target.prototype; - } - Object.defineProperty(target, Rules.key, { enumerable: false, configurable: false, writable: true, value: rules }); - }; - /** - * Removes rules from a target. - */ - Rules.unset = function (target) { - if (target instanceof Function) { - target = target.prototype; - } - target[Rules.key] = null; - }; - /** - * Retrieves the target's rules. - */ - Rules.get = function (target) { - return target[Rules.key] || null; - }; - /** - * The name of the property that stores the rules. - */ - Rules.key = '__rules__'; - return Rules; -}()); diff --git a/dist/native-modules/implementation/standard-validator.d.ts b/dist/native-modules/implementation/standard-validator.d.ts deleted file mode 100644 index dfe55f31..00000000 --- a/dist/native-modules/implementation/standard-validator.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { ViewResources } from 'aurelia-templating'; -import { Validator } from '../validator'; -import { ValidationError } from '../validation-error'; -import { Rule } from './rule'; -import { ValidationMessageProvider } from './validation-messages'; -/** - * Validates. - * Responsible for validating objects and properties. - */ -export declare class StandardValidator extends Validator { - static inject: (typeof ValidationMessageProvider | typeof ViewResources)[]; - private messageProvider; - private lookupFunctions; - private getDisplayName; - constructor(messageProvider: ValidationMessageProvider, resources: ViewResources); - /** - * Validates the specified property. - * @param object The object to validate. - * @param propertyName The name of the property to validate. - * @param rules Optional. If unspecified, the rules will be looked up using the metadata - * for the object created by ValidationRules....on(class/object) - */ - validateProperty(object: any, propertyName: string, rules?: any): Promise; - /** - * Validates all rules for specified object and it's properties. - * @param object The object to validate. - * @param rules Optional. If unspecified, the rules will be looked up using the metadata - * for the object created by ValidationRules....on(class/object) - */ - validateObject(object: any, rules?: any): Promise; - /** - * Determines whether a rule exists in a set of rules. - * @param rules The rules to search. - * @parem rule The rule to find. - */ - ruleExists(rules: Rule[][], rule: Rule): boolean; - private getMessage(rule, object, value); - private validateRuleSequence(object, propertyName, ruleSequence, sequence); - private validate(object, propertyName, rules); -} diff --git a/dist/native-modules/implementation/standard-validator.js b/dist/native-modules/implementation/standard-validator.js deleted file mode 100644 index 92af0f9f..00000000 --- a/dist/native-modules/implementation/standard-validator.js +++ /dev/null @@ -1,129 +0,0 @@ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -import { ViewResources } from 'aurelia-templating'; -import { Validator } from '../validator'; -import { ValidationError } from '../validation-error'; -import { Rules } from './rules'; -import { ValidationMessageProvider } from './validation-messages'; -/** - * Validates. - * Responsible for validating objects and properties. - */ -export var StandardValidator = (function (_super) { - __extends(StandardValidator, _super); - function StandardValidator(messageProvider, resources) { - _super.call(this); - this.messageProvider = messageProvider; - this.lookupFunctions = resources.lookupFunctions; - this.getDisplayName = messageProvider.getDisplayName.bind(messageProvider); - } - /** - * Validates the specified property. - * @param object The object to validate. - * @param propertyName The name of the property to validate. - * @param rules Optional. If unspecified, the rules will be looked up using the metadata - * for the object created by ValidationRules....on(class/object) - */ - StandardValidator.prototype.validateProperty = function (object, propertyName, rules) { - return this.validate(object, propertyName, rules || null); - }; - /** - * Validates all rules for specified object and it's properties. - * @param object The object to validate. - * @param rules Optional. If unspecified, the rules will be looked up using the metadata - * for the object created by ValidationRules....on(class/object) - */ - StandardValidator.prototype.validateObject = function (object, rules) { - return this.validate(object, null, rules || null); - }; - /** - * Determines whether a rule exists in a set of rules. - * @param rules The rules to search. - * @parem rule The rule to find. - */ - StandardValidator.prototype.ruleExists = function (rules, rule) { - var i = rules.length; - while (i--) { - if (rules[i].indexOf(rule) !== -1) { - return true; - } - } - return false; - }; - StandardValidator.prototype.getMessage = function (rule, object, value) { - var expression = rule.message || this.messageProvider.getMessage(rule.messageKey); - var _a = rule.property, propertyName = _a.name, displayName = _a.displayName; - if (displayName === null && propertyName !== null) { - displayName = this.messageProvider.getDisplayName(propertyName); - } - var overrideContext = { - $displayName: displayName, - $propertyName: propertyName, - $value: value, - $object: object, - $config: rule.config, - $getDisplayName: this.getDisplayName - }; - return expression.evaluate({ bindingContext: object, overrideContext: overrideContext }, this.lookupFunctions); - }; - StandardValidator.prototype.validateRuleSequence = function (object, propertyName, ruleSequence, sequence) { - var _this = this; - // are we validating all properties or a single property? - var validateAllProperties = propertyName === null || propertyName === undefined; - var rules = ruleSequence[sequence]; - var errors = []; - // validate each rule. - var promises = []; - var _loop_1 = function(i) { - var rule = rules[i]; - // is the rule related to the property we're validating. - if (!validateAllProperties && rule.property.name !== propertyName) { - return "continue"; - } - // is this a conditional rule? is the condition met? - if (rule.when && !rule.when(object)) { - return "continue"; - } - // validate. - var value = rule.property.name === null ? object : object[rule.property.name]; - var promiseOrBoolean = rule.condition(value, object); - if (!(promiseOrBoolean instanceof Promise)) { - promiseOrBoolean = Promise.resolve(promiseOrBoolean); - } - promises.push(promiseOrBoolean.then(function (isValid) { - if (!isValid) { - var message = _this.getMessage(rule, object, value); - errors.push(new ValidationError(rule, message, object, rule.property.name)); - } - })); - }; - for (var i = 0; i < rules.length; i++) { - _loop_1(i); - } - return Promise.all(promises) - .then(function () { - sequence++; - if (errors.length === 0 && sequence < ruleSequence.length) { - return _this.validateRuleSequence(object, propertyName, ruleSequence, sequence); - } - return errors; - }); - }; - StandardValidator.prototype.validate = function (object, propertyName, rules) { - // rules specified? - if (!rules) { - // no. attempt to locate the rules. - rules = Rules.get(object); - } - // any rules? - if (!rules) { - return Promise.resolve([]); - } - return this.validateRuleSequence(object, propertyName, rules, 0); - }; - StandardValidator.inject = [ValidationMessageProvider, ViewResources]; - return StandardValidator; -}(Validator)); diff --git a/dist/native-modules/implementation/util.d.ts b/dist/native-modules/implementation/util.d.ts deleted file mode 100644 index 1193b71f..00000000 --- a/dist/native-modules/implementation/util.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function isString(value: any): boolean; diff --git a/dist/native-modules/implementation/util.js b/dist/native-modules/implementation/util.js deleted file mode 100644 index 29e055d5..00000000 --- a/dist/native-modules/implementation/util.js +++ /dev/null @@ -1,3 +0,0 @@ -export function isString(value) { - return Object.prototype.toString.call(value) === '[object String]'; -} diff --git a/dist/native-modules/implementation/validation-messages.d.ts b/dist/native-modules/implementation/validation-messages.d.ts deleted file mode 100644 index d9a09450..00000000 --- a/dist/native-modules/implementation/validation-messages.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Expression } from 'aurelia-binding'; -import { ValidationParser } from './validation-parser'; -export interface ValidationMessages { - [key: string]: string; -} -/** - * Dictionary of validation messages. [messageKey]: messageExpression - */ -export declare const validationMessages: ValidationMessages; -/** - * Retrieves validation messages and property display names. - */ -export declare class ValidationMessageProvider { - private parser; - static inject: typeof ValidationParser[]; - constructor(parser: ValidationParser); - /** - * Returns a message binding expression that corresponds to the key. - * @param key The message key. - */ - getMessage(key: string): Expression; - /** - * When a display name is not provided, this method is used to formulate - * a display name using the property name. - * Override this with your own custom logic. - * @param propertyName The property name. - */ - getDisplayName(propertyName: string): string; -} diff --git a/dist/native-modules/implementation/validation-messages.js b/dist/native-modules/implementation/validation-messages.js deleted file mode 100644 index 9c5df57c..00000000 --- a/dist/native-modules/implementation/validation-messages.js +++ /dev/null @@ -1,54 +0,0 @@ -import { ValidationParser } from './validation-parser'; -/** - * Dictionary of validation messages. [messageKey]: messageExpression - */ -export var validationMessages = { - /** - * The default validation message. Used with rules that have no standard message. - */ - default: "${$displayName} is invalid.", - required: "${$displayName} is required.", - matches: "${$displayName} is not correctly formatted.", - email: "${$displayName} is not a valid email.", - minLength: "${$displayName} must be at least ${$config.length} character${$config.length === 1 ? '' : 's'}.", - maxLength: "${$displayName} cannot be longer than ${$config.length} character${$config.length === 1 ? '' : 's'}.", - minItems: "${$displayName} must contain at least ${$config.count} item${$config.count === 1 ? '' : 's'}.", - maxItems: "${$displayName} cannot contain more than ${$config.count} item${$config.count === 1 ? '' : 's'}.", - equals: "${$displayName} must be ${$config.expectedValue}.", -}; -/** - * Retrieves validation messages and property display names. - */ -export var ValidationMessageProvider = (function () { - function ValidationMessageProvider(parser) { - this.parser = parser; - } - /** - * Returns a message binding expression that corresponds to the key. - * @param key The message key. - */ - ValidationMessageProvider.prototype.getMessage = function (key) { - var message; - if (key in validationMessages) { - message = validationMessages[key]; - } - else { - message = validationMessages['default']; - } - return this.parser.parseMessage(message); - }; - /** - * When a display name is not provided, this method is used to formulate - * a display name using the property name. - * Override this with your own custom logic. - * @param propertyName The property name. - */ - ValidationMessageProvider.prototype.getDisplayName = function (propertyName) { - // split on upper-case letters. - var words = propertyName.split(/(?=[A-Z])/).join(' '); - // capitalize first letter. - return words.charAt(0).toUpperCase() + words.slice(1); - }; - ValidationMessageProvider.inject = [ValidationParser]; - return ValidationMessageProvider; -}()); diff --git a/dist/native-modules/implementation/validation-parser.d.ts b/dist/native-modules/implementation/validation-parser.d.ts deleted file mode 100644 index 75b2c7af..00000000 --- a/dist/native-modules/implementation/validation-parser.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Parser, Expression, AccessScope, Unparser } from 'aurelia-binding'; -import { BindingLanguage } from 'aurelia-templating'; -import { RuleProperty } from './rule'; -export interface PropertyAccessor { - (object: TObject): TValue; -} -export declare class ValidationParser { - private parser; - private bindinqLanguage; - static inject: (typeof Parser | typeof BindingLanguage)[]; - private emptyStringExpression; - private nullExpression; - private undefinedExpression; - private cache; - constructor(parser: Parser, bindinqLanguage: BindingLanguage); - parseMessage(message: string): Expression; - parseProperty(property: string | PropertyAccessor): RuleProperty; - private coalesce(part); - private getAccessorExpression(fn); -} -export declare class MessageExpressionValidator extends Unparser { - private originalMessage; - static validate(expression: Expression, originalMessage: string): void; - constructor(originalMessage: string); - visitAccessScope(access: AccessScope): void; -} diff --git a/dist/native-modules/implementation/validation-parser.js b/dist/native-modules/implementation/validation-parser.js deleted file mode 100644 index 0d11f450..00000000 --- a/dist/native-modules/implementation/validation-parser.js +++ /dev/null @@ -1,85 +0,0 @@ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -import { Parser, AccessMember, AccessScope, LiteralString, Binary, Conditional, LiteralPrimitive, CallMember, Unparser } from 'aurelia-binding'; -import { BindingLanguage } from 'aurelia-templating'; -import { isString } from './util'; -import * as LogManager from 'aurelia-logging'; -export var ValidationParser = (function () { - function ValidationParser(parser, bindinqLanguage) { - this.parser = parser; - this.bindinqLanguage = bindinqLanguage; - this.emptyStringExpression = new LiteralString(''); - this.nullExpression = new LiteralPrimitive(null); - this.undefinedExpression = new LiteralPrimitive(undefined); - this.cache = {}; - } - ValidationParser.prototype.parseMessage = function (message) { - if (this.cache[message] !== undefined) { - return this.cache[message]; - } - var parts = this.bindinqLanguage.parseInterpolation(null, message); - if (parts === null) { - return new LiteralString(message); - } - var expression = new LiteralString(parts[0]); - for (var i = 1; i < parts.length; i += 2) { - expression = new Binary('+', expression, new Binary('+', this.coalesce(parts[i]), new LiteralString(parts[i + 1]))); - } - MessageExpressionValidator.validate(expression, message); - this.cache[message] = expression; - return expression; - }; - ValidationParser.prototype.parseProperty = function (property) { - if (isString(property)) { - return { name: property, displayName: null }; - } - var accessor = this.getAccessorExpression(property.toString()); - if (accessor instanceof AccessScope - || accessor instanceof AccessMember && accessor.object instanceof AccessScope) { - return { - name: accessor.name, - displayName: null - }; - } - throw new Error("Invalid subject: \"" + accessor + "\""); - }; - ValidationParser.prototype.coalesce = function (part) { - // part === null || part === undefined ? '' : part - return new Conditional(new Binary('||', new Binary('===', part, this.nullExpression), new Binary('===', part, this.undefinedExpression)), this.emptyStringExpression, new CallMember(part, 'toString', [])); - }; - ValidationParser.prototype.getAccessorExpression = function (fn) { - var classic = /^function\s*\([$_\w\d]+\)\s*\{\s*(?:"use strict";)?\s*return\s+[$_\w\d]+\.([$_\w\d]+)\s*;?\s*\}$/; - var arrow = /^\(?[$_\w\d]+\)?\s*=>\s*[$_\w\d]+\.([$_\w\d]+)$/; - var match = classic.exec(fn) || arrow.exec(fn); - if (match === null) { - throw new Error("Unable to parse accessor function:\n" + fn); - } - return this.parser.parse(match[1]); - }; - ValidationParser.inject = [Parser, BindingLanguage]; - return ValidationParser; -}()); -export var MessageExpressionValidator = (function (_super) { - __extends(MessageExpressionValidator, _super); - function MessageExpressionValidator(originalMessage) { - _super.call(this, []); - this.originalMessage = originalMessage; - } - MessageExpressionValidator.validate = function (expression, originalMessage) { - var visitor = new MessageExpressionValidator(originalMessage); - expression.accept(visitor); - }; - MessageExpressionValidator.prototype.visitAccessScope = function (access) { - if (access.ancestor !== 0) { - throw new Error('$parent is not permitted in validation message expressions.'); - } - if (['displayName', 'propertyName', 'value', 'object', 'config', 'getDisplayName'].indexOf(access.name) !== -1) { - LogManager.getLogger('aurelia-validation') - .warn("Did you mean to use \"$" + access.name + "\" instead of \"" + access.name + "\" in this validation message template: \"" + this.originalMessage + "\"?"); - } - }; - return MessageExpressionValidator; -}(Unparser)); diff --git a/dist/native-modules/implementation/validation-rules.d.ts b/dist/native-modules/implementation/validation-rules.d.ts deleted file mode 100644 index 59ba7410..00000000 --- a/dist/native-modules/implementation/validation-rules.d.ts +++ /dev/null @@ -1,252 +0,0 @@ -import { Rule, RuleProperty } from './rule'; -import { ValidationParser, PropertyAccessor } from './validation-parser'; -/** - * Part of the fluent rule API. Enables customizing property rules. - */ -export declare class FluentRuleCustomizer { - private fluentEnsure; - private fluentRules; - private parser; - private rule; - constructor(property: RuleProperty, condition: (value: TValue, object?: TObject) => boolean | Promise, config: Object, fluentEnsure: FluentEnsure, fluentRules: FluentRules, parser: ValidationParser); - /** - * Validate subsequent rules after previously declared rules have - * been validated successfully. Use to postpone validation of costly - * rules until less expensive rules pass validation. - */ - then(): this; - /** - * Specifies the key to use when looking up the rule's validation message. - */ - withMessageKey(key: string): this; - /** - * Specifies rule's validation message. - */ - withMessage(message: string): this; - /** - * Specifies a condition that must be met before attempting to validate the rule. - * @param condition A function that accepts the object as a parameter and returns true - * or false whether the rule should be evaluated. - */ - when(condition: (object: TObject) => boolean): this; - /** - * Tags the rule instance, enabling the rule to be found easily - * using ValidationRules.taggedRules(rules, tag) - */ - tag(tag: string): this; - /** - * Target a property with validation rules. - * @param property The property to target. Can be the property name or a property accessor function. - */ - ensure(subject: string | { - (model: TObject): TValue2; - }): FluentRules; - /** - * Targets an object with validation rules. - */ - ensureObject(): FluentRules; - /** - * Rules that have been defined using the fluent API. - */ - readonly rules: Rule[][]; - /** - * Applies the rules to a class or object, making them discoverable by the StandardValidator. - * @param target A class or object. - */ - on(target: any): FluentEnsure; - /** - * Applies an ad-hoc rule function to the ensured property or object. - * @param condition The function to validate the rule. - * Will be called with two arguments, the property value and the object. - * Should return a boolean or a Promise that resolves to a boolean. - */ - satisfies(condition: (value: TValue, object?: TObject) => boolean | Promise, config?: Object): FluentRuleCustomizer; - /** - * Applies a rule by name. - * @param name The name of the custom or standard rule. - * @param args The rule's arguments. - */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; - /** - * Applies the "required" rule to the property. - * The value cannot be null, undefined or whitespace. - */ - required(): FluentRuleCustomizer; - /** - * Applies the "matches" rule to the property. - * Value must match the specified regular expression. - * null, undefined and empty-string values are considered valid. - */ - matches(regex: RegExp): FluentRuleCustomizer; - /** - * Applies the "email" rule to the property. - * null, undefined and empty-string values are considered valid. - */ - email(): FluentRuleCustomizer; - /** - * Applies the "minLength" STRING validation rule to the property. - * null, undefined and empty-string values are considered valid. - */ - minLength(length: number): FluentRuleCustomizer; - /** - * Applies the "maxLength" STRING validation rule to the property. - * null, undefined and empty-string values are considered valid. - */ - maxLength(length: number): FluentRuleCustomizer; - /** - * Applies the "minItems" ARRAY validation rule to the property. - * null and undefined values are considered valid. - */ - minItems(count: number): FluentRuleCustomizer; - /** - * Applies the "maxItems" ARRAY validation rule to the property. - * null and undefined values are considered valid. - */ - maxItems(count: number): FluentRuleCustomizer; - /** - * Applies the "equals" validation rule to the property. - * null, undefined and empty-string values are considered valid. - */ - equals(expectedValue: TValue): FluentRuleCustomizer; -} -/** - * Part of the fluent rule API. Enables applying rules to properties and objects. - */ -export declare class FluentRules { - private fluentEnsure; - private parser; - private property; - static customRules: { - [name: string]: { - condition: (value: any, object?: any, ...fluentArgs: any[]) => boolean | Promise; - argsToConfig?: (...args: any[]) => any; - }; - }; - constructor(fluentEnsure: FluentEnsure, parser: ValidationParser, property: RuleProperty); - /** - * Sets the display name of the ensured property. - */ - displayName(name: string): this; - /** - * Applies an ad-hoc rule function to the ensured property or object. - * @param condition The function to validate the rule. - * Will be called with two arguments, the property value and the object. - * Should return a boolean or a Promise that resolves to a boolean. - */ - satisfies(condition: (value: TValue, object?: TObject) => boolean | Promise, config?: Object): FluentRuleCustomizer; - /** - * Applies a rule by name. - * @param name The name of the custom or standard rule. - * @param args The rule's arguments. - */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; - /** - * Applies the "required" rule to the property. - * The value cannot be null, undefined or whitespace. - */ - required(): FluentRuleCustomizer; - /** - * Applies the "matches" rule to the property. - * Value must match the specified regular expression. - * null, undefined and empty-string values are considered valid. - */ - matches(regex: RegExp): FluentRuleCustomizer; - /** - * Applies the "email" rule to the property. - * null, undefined and empty-string values are considered valid. - */ - email(): FluentRuleCustomizer; - /** - * Applies the "minLength" STRING validation rule to the property. - * null, undefined and empty-string values are considered valid. - */ - minLength(length: number): FluentRuleCustomizer; - /** - * Applies the "maxLength" STRING validation rule to the property. - * null, undefined and empty-string values are considered valid. - */ - maxLength(length: number): FluentRuleCustomizer; - /** - * Applies the "minItems" ARRAY validation rule to the property. - * null and undefined values are considered valid. - */ - minItems(count: number): FluentRuleCustomizer; - /** - * Applies the "maxItems" ARRAY validation rule to the property. - * null and undefined values are considered valid. - */ - maxItems(count: number): FluentRuleCustomizer; - /** - * Applies the "equals" validation rule to the property. - * null and undefined values are considered valid. - */ - equals(expectedValue: TValue): FluentRuleCustomizer; -} -/** - * Part of the fluent rule API. Enables targeting properties and objects with rules. - */ -export declare class FluentEnsure { - private parser; - /** - * Rules that have been defined using the fluent API. - */ - rules: Rule[][]; - _sequence: number; - constructor(parser: ValidationParser); - /** - * Target a property with validation rules. - * @param property The property to target. Can be the property name or a property accessor - * function. - */ - ensure(property: string | PropertyAccessor): FluentRules; - /** - * Targets an object with validation rules. - */ - ensureObject(): FluentRules; - /** - * Applies the rules to a class or object, making them discoverable by the StandardValidator. - * @param target A class or object. - */ - on(target: any): this; - /** - * Adds a rule definition to the sequenced ruleset. - */ - _addRule(rule: Rule): void; - private assertInitialized(); -} -/** - * Fluent rule definition API. - */ -export declare class ValidationRules { - private static parser; - static initialize(parser: ValidationParser): void; - /** - * Target a property with validation rules. - * @param property The property to target. Can be the property name or a property accessor function. - */ - static ensure(property: string | PropertyAccessor): FluentRules; - /** - * Targets an object with validation rules. - */ - static ensureObject(): FluentRules; - /** - * Defines a custom rule. - * @param name The name of the custom rule. Also serves as the message key. - * @param condition The rule function. - * @param message The message expression - * @param argsToConfig A function that maps the rule's arguments to a "config" - * object that can be used when evaluating the message expression. - */ - static customRule(name: string, condition: (value: any, object?: any, ...args: any[]) => boolean | Promise, message: string, argsToConfig?: (...args: any[]) => any): void; - /** - * Returns rules with the matching tag. - * @param rules The rules to search. - * @param tag The tag to search for. - */ - static taggedRules(rules: Rule[][], tag: string): Rule[][]; - /** - * Removes the rules from a class or object. - * @param target A class or object. - */ - static off(target: any): void; -} diff --git a/dist/native-modules/implementation/validation-rules.js b/dist/native-modules/implementation/validation-rules.js deleted file mode 100644 index 02920554..00000000 --- a/dist/native-modules/implementation/validation-rules.js +++ /dev/null @@ -1,406 +0,0 @@ -import { isString } from './util'; -import { Rules } from './rules'; -import { validationMessages } from './validation-messages'; -/** - * Part of the fluent rule API. Enables customizing property rules. - */ -export var FluentRuleCustomizer = (function () { - function FluentRuleCustomizer(property, condition, config, fluentEnsure, fluentRules, parser) { - if (config === void 0) { config = {}; } - this.fluentEnsure = fluentEnsure; - this.fluentRules = fluentRules; - this.parser = parser; - this.rule = { - property: property, - condition: condition, - config: config, - when: null, - messageKey: 'default', - message: null, - sequence: fluentEnsure._sequence - }; - this.fluentEnsure._addRule(this.rule); - } - /** - * Validate subsequent rules after previously declared rules have - * been validated successfully. Use to postpone validation of costly - * rules until less expensive rules pass validation. - */ - FluentRuleCustomizer.prototype.then = function () { - this.fluentEnsure._sequence++; - return this; - }; - /** - * Specifies the key to use when looking up the rule's validation message. - */ - FluentRuleCustomizer.prototype.withMessageKey = function (key) { - this.rule.messageKey = key; - this.rule.message = null; - return this; - }; - /** - * Specifies rule's validation message. - */ - FluentRuleCustomizer.prototype.withMessage = function (message) { - this.rule.messageKey = 'custom'; - this.rule.message = this.parser.parseMessage(message); - return this; - }; - /** - * Specifies a condition that must be met before attempting to validate the rule. - * @param condition A function that accepts the object as a parameter and returns true - * or false whether the rule should be evaluated. - */ - FluentRuleCustomizer.prototype.when = function (condition) { - this.rule.when = condition; - return this; - }; - /** - * Tags the rule instance, enabling the rule to be found easily - * using ValidationRules.taggedRules(rules, tag) - */ - FluentRuleCustomizer.prototype.tag = function (tag) { - this.rule.tag = tag; - return this; - }; - ///// FluentEnsure APIs ///// - /** - * Target a property with validation rules. - * @param property The property to target. Can be the property name or a property accessor function. - */ - FluentRuleCustomizer.prototype.ensure = function (subject) { - return this.fluentEnsure.ensure(subject); - }; - /** - * Targets an object with validation rules. - */ - FluentRuleCustomizer.prototype.ensureObject = function () { - return this.fluentEnsure.ensureObject(); - }; - Object.defineProperty(FluentRuleCustomizer.prototype, "rules", { - /** - * Rules that have been defined using the fluent API. - */ - get: function () { - return this.fluentEnsure.rules; - }, - enumerable: true, - configurable: true - }); - /** - * Applies the rules to a class or object, making them discoverable by the StandardValidator. - * @param target A class or object. - */ - FluentRuleCustomizer.prototype.on = function (target) { - return this.fluentEnsure.on(target); - }; - ///////// FluentRules APIs ///////// - /** - * Applies an ad-hoc rule function to the ensured property or object. - * @param condition The function to validate the rule. - * Will be called with two arguments, the property value and the object. - * Should return a boolean or a Promise that resolves to a boolean. - */ - FluentRuleCustomizer.prototype.satisfies = function (condition, config) { - return this.fluentRules.satisfies(condition, config); - }; - /** - * Applies a rule by name. - * @param name The name of the custom or standard rule. - * @param args The rule's arguments. - */ - FluentRuleCustomizer.prototype.satisfiesRule = function (name) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - return (_a = this.fluentRules).satisfiesRule.apply(_a, [name].concat(args)); - var _a; - }; - /** - * Applies the "required" rule to the property. - * The value cannot be null, undefined or whitespace. - */ - FluentRuleCustomizer.prototype.required = function () { - return this.fluentRules.required(); - }; - /** - * Applies the "matches" rule to the property. - * Value must match the specified regular expression. - * null, undefined and empty-string values are considered valid. - */ - FluentRuleCustomizer.prototype.matches = function (regex) { - return this.fluentRules.matches(regex); - }; - /** - * Applies the "email" rule to the property. - * null, undefined and empty-string values are considered valid. - */ - FluentRuleCustomizer.prototype.email = function () { - return this.fluentRules.email(); - }; - /** - * Applies the "minLength" STRING validation rule to the property. - * null, undefined and empty-string values are considered valid. - */ - FluentRuleCustomizer.prototype.minLength = function (length) { - return this.fluentRules.minLength(length); - }; - /** - * Applies the "maxLength" STRING validation rule to the property. - * null, undefined and empty-string values are considered valid. - */ - FluentRuleCustomizer.prototype.maxLength = function (length) { - return this.fluentRules.maxLength(length); - }; - /** - * Applies the "minItems" ARRAY validation rule to the property. - * null and undefined values are considered valid. - */ - FluentRuleCustomizer.prototype.minItems = function (count) { - return this.fluentRules.minItems(count); - }; - /** - * Applies the "maxItems" ARRAY validation rule to the property. - * null and undefined values are considered valid. - */ - FluentRuleCustomizer.prototype.maxItems = function (count) { - return this.fluentRules.maxItems(count); - }; - /** - * Applies the "equals" validation rule to the property. - * null, undefined and empty-string values are considered valid. - */ - FluentRuleCustomizer.prototype.equals = function (expectedValue) { - return this.fluentRules.equals(expectedValue); - }; - return FluentRuleCustomizer; -}()); -/** - * Part of the fluent rule API. Enables applying rules to properties and objects. - */ -export var FluentRules = (function () { - function FluentRules(fluentEnsure, parser, property) { - this.fluentEnsure = fluentEnsure; - this.parser = parser; - this.property = property; - } - /** - * Sets the display name of the ensured property. - */ - FluentRules.prototype.displayName = function (name) { - this.property.displayName = name; - return this; - }; - /** - * Applies an ad-hoc rule function to the ensured property or object. - * @param condition The function to validate the rule. - * Will be called with two arguments, the property value and the object. - * Should return a boolean or a Promise that resolves to a boolean. - */ - FluentRules.prototype.satisfies = function (condition, config) { - return new FluentRuleCustomizer(this.property, condition, config, this.fluentEnsure, this, this.parser); - }; - /** - * Applies a rule by name. - * @param name The name of the custom or standard rule. - * @param args The rule's arguments. - */ - FluentRules.prototype.satisfiesRule = function (name) { - var _this = this; - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var rule = FluentRules.customRules[name]; - if (!rule) { - // standard rule? - rule = this[name]; - if (rule instanceof Function) { - return rule.call.apply(rule, [this].concat(args)); - } - throw new Error("Rule with name \"" + name + "\" does not exist."); - } - var config = rule.argsToConfig ? rule.argsToConfig.apply(rule, args) : undefined; - return this.satisfies(function (value, obj) { return (_a = rule.condition).call.apply(_a, [_this, value, obj].concat(args)); var _a; }, config) - .withMessageKey(name); - }; - /** - * Applies the "required" rule to the property. - * The value cannot be null, undefined or whitespace. - */ - FluentRules.prototype.required = function () { - return this.satisfies(function (value) { - return value !== null - && value !== undefined - && !(isString(value) && !/\S/.test(value)); - }).withMessageKey('required'); - }; - /** - * Applies the "matches" rule to the property. - * Value must match the specified regular expression. - * null, undefined and empty-string values are considered valid. - */ - FluentRules.prototype.matches = function (regex) { - return this.satisfies(function (value) { return value === null || value === undefined || value.length === 0 || regex.test(value); }) - .withMessageKey('matches'); - }; - /** - * Applies the "email" rule to the property. - * null, undefined and empty-string values are considered valid. - */ - FluentRules.prototype.email = function () { - // regex from https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address - /* tslint:disable:max-line-length */ - return this.matches(/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/) - .withMessageKey('email'); - }; - /** - * Applies the "minLength" STRING validation rule to the property. - * null, undefined and empty-string values are considered valid. - */ - FluentRules.prototype.minLength = function (length) { - return this.satisfies(function (value) { return value === null || value === undefined || value.length === 0 || value.length >= length; }, { length: length }) - .withMessageKey('minLength'); - }; - /** - * Applies the "maxLength" STRING validation rule to the property. - * null, undefined and empty-string values are considered valid. - */ - FluentRules.prototype.maxLength = function (length) { - return this.satisfies(function (value) { return value === null || value === undefined || value.length === 0 || value.length <= length; }, { length: length }) - .withMessageKey('maxLength'); - }; - /** - * Applies the "minItems" ARRAY validation rule to the property. - * null and undefined values are considered valid. - */ - FluentRules.prototype.minItems = function (count) { - return this.satisfies(function (value) { return value === null || value === undefined || value.length >= count; }, { count: count }) - .withMessageKey('minItems'); - }; - /** - * Applies the "maxItems" ARRAY validation rule to the property. - * null and undefined values are considered valid. - */ - FluentRules.prototype.maxItems = function (count) { - return this.satisfies(function (value) { return value === null || value === undefined || value.length <= count; }, { count: count }) - .withMessageKey('maxItems'); - }; - /** - * Applies the "equals" validation rule to the property. - * null and undefined values are considered valid. - */ - FluentRules.prototype.equals = function (expectedValue) { - return this.satisfies(function (value) { return value === null || value === undefined || value === '' || value === expectedValue; }, { expectedValue: expectedValue }) - .withMessageKey('equals'); - }; - FluentRules.customRules = {}; - return FluentRules; -}()); -/** - * Part of the fluent rule API. Enables targeting properties and objects with rules. - */ -export var FluentEnsure = (function () { - /* tslint:enable */ - function FluentEnsure(parser) { - this.parser = parser; - /** - * Rules that have been defined using the fluent API. - */ - this.rules = []; - /* tslint:disable */ - this._sequence = 0; - } - /** - * Target a property with validation rules. - * @param property The property to target. Can be the property name or a property accessor - * function. - */ - FluentEnsure.prototype.ensure = function (property) { - this.assertInitialized(); - return new FluentRules(this, this.parser, this.parser.parseProperty(property)); - }; - /** - * Targets an object with validation rules. - */ - FluentEnsure.prototype.ensureObject = function () { - this.assertInitialized(); - return new FluentRules(this, this.parser, { name: null, displayName: null }); - }; - /** - * Applies the rules to a class or object, making them discoverable by the StandardValidator. - * @param target A class or object. - */ - FluentEnsure.prototype.on = function (target) { - Rules.set(target, this.rules); - return this; - }; - /** - * Adds a rule definition to the sequenced ruleset. - */ - FluentEnsure.prototype._addRule = function (rule) { - while (this.rules.length < rule.sequence + 1) { - this.rules.push([]); - } - this.rules[rule.sequence].push(rule); - }; - FluentEnsure.prototype.assertInitialized = function () { - if (this.parser) { - return; - } - throw new Error("Did you forget to add \".plugin('aurelia-validation)\" to your main.js?"); - }; - return FluentEnsure; -}()); -/** - * Fluent rule definition API. - */ -export var ValidationRules = (function () { - function ValidationRules() { - } - ValidationRules.initialize = function (parser) { - ValidationRules.parser = parser; - }; - /** - * Target a property with validation rules. - * @param property The property to target. Can be the property name or a property accessor function. - */ - ValidationRules.ensure = function (property) { - return new FluentEnsure(ValidationRules.parser).ensure(property); - }; - /** - * Targets an object with validation rules. - */ - ValidationRules.ensureObject = function () { - return new FluentEnsure(ValidationRules.parser).ensureObject(); - }; - /** - * Defines a custom rule. - * @param name The name of the custom rule. Also serves as the message key. - * @param condition The rule function. - * @param message The message expression - * @param argsToConfig A function that maps the rule's arguments to a "config" - * object that can be used when evaluating the message expression. - */ - ValidationRules.customRule = function (name, condition, message, argsToConfig) { - validationMessages[name] = message; - FluentRules.customRules[name] = { condition: condition, argsToConfig: argsToConfig }; - }; - /** - * Returns rules with the matching tag. - * @param rules The rules to search. - * @param tag The tag to search for. - */ - ValidationRules.taggedRules = function (rules, tag) { - return rules.map(function (x) { return x.filter(function (r) { return r.tag === tag; }); }); - }; - /** - * Removes the rules from a class or object. - * @param target A class or object. - */ - ValidationRules.off = function (target) { - Rules.unset(target); - }; - return ValidationRules; -}()); diff --git a/dist/native-modules/property-info.d.ts b/dist/native-modules/property-info.d.ts deleted file mode 100644 index 59b760bf..00000000 --- a/dist/native-modules/property-info.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Expression } from 'aurelia-binding'; -/** - * Retrieves the object and property name for the specified expression. - * @param expression The expression - * @param source The scope - */ -export declare function getPropertyInfo(expression: Expression, source: any): { - object: Object; - propertyName: string; -} | null; diff --git a/dist/native-modules/property-info.js b/dist/native-modules/property-info.js deleted file mode 100644 index 75edf715..00000000 --- a/dist/native-modules/property-info.js +++ /dev/null @@ -1,42 +0,0 @@ -import { AccessMember, AccessScope, AccessKeyed, BindingBehavior, ValueConverter } from 'aurelia-binding'; -function getObject(expression, objectExpression, source) { - var value = objectExpression.evaluate(source, null); - if (value === null || value === undefined || value instanceof Object) { - return value; - } - /* tslint:disable */ - throw new Error("The '" + objectExpression + "' part of '" + expression + "' evaluates to " + value + " instead of an object, null or undefined."); - /* tslint:enable */ -} -/** - * Retrieves the object and property name for the specified expression. - * @param expression The expression - * @param source The scope - */ -export function getPropertyInfo(expression, source) { - var originalExpression = expression; - while (expression instanceof BindingBehavior || expression instanceof ValueConverter) { - expression = expression.expression; - } - var object; - var propertyName; - if (expression instanceof AccessScope) { - object = source.bindingContext; - propertyName = expression.name; - } - else if (expression instanceof AccessMember) { - object = getObject(originalExpression, expression.object, source); - propertyName = expression.name; - } - else if (expression instanceof AccessKeyed) { - object = getObject(originalExpression, expression.object, source); - propertyName = expression.key.evaluate(source); - } - else { - throw new Error("Expression '" + originalExpression + "' is not compatible with the validate binding-behavior."); - } - if (object === null || object === undefined) { - return null; - } - return { object: object, propertyName: propertyName }; -} diff --git a/dist/native-modules/validate-binding-behavior-base.d.ts b/dist/native-modules/validate-binding-behavior-base.d.ts deleted file mode 100644 index 09c18430..00000000 --- a/dist/native-modules/validate-binding-behavior-base.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { TaskQueue } from 'aurelia-task-queue'; -import { ValidationController } from './validation-controller'; -/** - * Binding behavior. Indicates the bound property should be validated. - */ -export declare abstract class ValidateBindingBehaviorBase { - private taskQueue; - constructor(taskQueue: TaskQueue); - protected abstract getValidateTrigger(controller: ValidationController): number; - /** - * Gets the DOM element associated with the data-binding. Most of the time it's - * the binding.target but sometimes binding.target is an aurelia custom element, - * or custom attribute which is a javascript "class" instance, so we need to use - * the controller's container to retrieve the actual DOM element. - */ - getTarget(binding: any, view: any): any; - bind(binding: any, source: any, rulesOrController?: ValidationController | any, rules?: any): void; - unbind(binding: any): void; -} diff --git a/dist/native-modules/validate-binding-behavior-base.js b/dist/native-modules/validate-binding-behavior-base.js deleted file mode 100644 index 88d6aa73..00000000 --- a/dist/native-modules/validate-binding-behavior-base.js +++ /dev/null @@ -1,105 +0,0 @@ -import { Optional } from 'aurelia-dependency-injection'; -import { DOM } from 'aurelia-pal'; -import { ValidationController } from './validation-controller'; -import { validateTrigger } from './validate-trigger'; -/** - * Binding behavior. Indicates the bound property should be validated. - */ -export var ValidateBindingBehaviorBase = (function () { - function ValidateBindingBehaviorBase(taskQueue) { - this.taskQueue = taskQueue; - } - /** - * Gets the DOM element associated with the data-binding. Most of the time it's - * the binding.target but sometimes binding.target is an aurelia custom element, - * or custom attribute which is a javascript "class" instance, so we need to use - * the controller's container to retrieve the actual DOM element. - */ - ValidateBindingBehaviorBase.prototype.getTarget = function (binding, view) { - var target = binding.target; - // DOM element - if (target instanceof Element) { - return target; - } - // custom element or custom attribute - for (var i = 0, ii = view.controllers.length; i < ii; i++) { - var controller = view.controllers[i]; - if (controller.viewModel === target) { - var element = controller.container.get(DOM.Element); - if (element) { - return element; - } - throw new Error("Unable to locate target element for \"" + binding.sourceExpression + "\"."); - } - } - throw new Error("Unable to locate target element for \"" + binding.sourceExpression + "\"."); - }; - ValidateBindingBehaviorBase.prototype.bind = function (binding, source, rulesOrController, rules) { - var _this = this; - // identify the target element. - var target = this.getTarget(binding, source); - // locate the controller. - var controller; - if (rulesOrController instanceof ValidationController) { - controller = rulesOrController; - } - else { - controller = source.container.get(Optional.of(ValidationController)); - rules = rulesOrController; - } - if (controller === null) { - throw new Error("A ValidationController has not been registered."); - } - controller.registerBinding(binding, target, rules); - binding.validationController = controller; - var trigger = this.getValidateTrigger(controller); - /* tslint:disable:no-bitwise */ - if (trigger & validateTrigger.change) { - /* tslint:enable:no-bitwise */ - binding.standardUpdateSource = binding.updateSource; - /* tslint:disable:only-arrow-functions */ - binding.updateSource = function (value) { - /* tslint:enable:only-arrow-functions */ - this.standardUpdateSource(value); - this.validationController.validateBinding(this); - }; - } - /* tslint:disable:no-bitwise */ - if (trigger & validateTrigger.blur) { - /* tslint:enable:no-bitwise */ - binding.validateBlurHandler = function () { - _this.taskQueue.queueMicroTask(function () { return controller.validateBinding(binding); }); - }; - binding.validateTarget = target; - target.addEventListener('blur', binding.validateBlurHandler); - } - if (trigger !== validateTrigger.manual) { - binding.standardUpdateTarget = binding.updateTarget; - /* tslint:disable:only-arrow-functions */ - binding.updateTarget = function (value) { - /* tslint:enable:only-arrow-functions */ - this.standardUpdateTarget(value); - this.validationController.resetBinding(this); - }; - } - }; - ValidateBindingBehaviorBase.prototype.unbind = function (binding) { - // reset the binding to it's original state. - if (binding.standardUpdateSource) { - binding.updateSource = binding.standardUpdateSource; - binding.standardUpdateSource = null; - } - if (binding.standardUpdateTarget) { - binding.updateTarget = binding.standardUpdateTarget; - binding.standardUpdateTarget = null; - } - if (binding.validateBlurHandler) { - binding.validateTarget.removeEventListener('blur', binding.validateBlurHandler); - binding.validateBlurHandler = null; - binding.validateTarget = null; - } - binding.validationController.unregisterBinding(binding); - binding.validationController = null; - }; - return ValidateBindingBehaviorBase; -}()); diff --git a/dist/native-modules/validate-binding-behavior.d.ts b/dist/native-modules/validate-binding-behavior.d.ts deleted file mode 100644 index 2d55c7ec..00000000 --- a/dist/native-modules/validate-binding-behavior.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { TaskQueue } from 'aurelia-task-queue'; -import { ValidationController } from './validation-controller'; -import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; -/** - * Binding behavior. Indicates the bound property should be validated - * when the validate trigger specified by the associated controller's - * validateTrigger property occurs. - */ -export declare class ValidateBindingBehavior extends ValidateBindingBehaviorBase { - static inject: typeof TaskQueue[]; - getValidateTrigger(controller: ValidationController): number; -} -/** - * Binding behavior. Indicates the bound property will be validated - * manually, by calling controller.validate(). No automatic validation - * triggered by data-entry or blur will occur. - */ -export declare class ValidateManuallyBindingBehavior extends ValidateBindingBehaviorBase { - static inject: typeof TaskQueue[]; - getValidateTrigger(): number; -} -/** - * Binding behavior. Indicates the bound property should be validated - * when the associated element blurs. - */ -export declare class ValidateOnBlurBindingBehavior extends ValidateBindingBehaviorBase { - static inject: typeof TaskQueue[]; - getValidateTrigger(): number; -} -/** - * Binding behavior. Indicates the bound property should be validated - * when the associated element is changed by the user, causing a change - * to the model. - */ -export declare class ValidateOnChangeBindingBehavior extends ValidateBindingBehaviorBase { - static inject: typeof TaskQueue[]; - getValidateTrigger(): number; -} -/** - * Binding behavior. Indicates the bound property should be validated - * when the associated element blurs or is changed by the user, causing - * a change to the model. - */ -export declare class ValidateOnChangeOrBlurBindingBehavior extends ValidateBindingBehaviorBase { - static inject: typeof TaskQueue[]; - getValidateTrigger(): number; -} diff --git a/dist/native-modules/validate-binding-behavior.js b/dist/native-modules/validate-binding-behavior.js deleted file mode 100644 index 4b6525b8..00000000 --- a/dist/native-modules/validate-binding-behavior.js +++ /dev/null @@ -1,87 +0,0 @@ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -import { TaskQueue } from 'aurelia-task-queue'; -import { validateTrigger } from './validate-trigger'; -import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; -/** - * Binding behavior. Indicates the bound property should be validated - * when the validate trigger specified by the associated controller's - * validateTrigger property occurs. - */ -export var ValidateBindingBehavior = (function (_super) { - __extends(ValidateBindingBehavior, _super); - function ValidateBindingBehavior() { - _super.apply(this, arguments); - } - ValidateBindingBehavior.prototype.getValidateTrigger = function (controller) { - return controller.validateTrigger; - }; - ValidateBindingBehavior.inject = [TaskQueue]; - return ValidateBindingBehavior; -}(ValidateBindingBehaviorBase)); -/** - * Binding behavior. Indicates the bound property will be validated - * manually, by calling controller.validate(). No automatic validation - * triggered by data-entry or blur will occur. - */ -export var ValidateManuallyBindingBehavior = (function (_super) { - __extends(ValidateManuallyBindingBehavior, _super); - function ValidateManuallyBindingBehavior() { - _super.apply(this, arguments); - } - ValidateManuallyBindingBehavior.prototype.getValidateTrigger = function () { - return validateTrigger.manual; - }; - ValidateManuallyBindingBehavior.inject = [TaskQueue]; - return ValidateManuallyBindingBehavior; -}(ValidateBindingBehaviorBase)); -/** - * Binding behavior. Indicates the bound property should be validated - * when the associated element blurs. - */ -export var ValidateOnBlurBindingBehavior = (function (_super) { - __extends(ValidateOnBlurBindingBehavior, _super); - function ValidateOnBlurBindingBehavior() { - _super.apply(this, arguments); - } - ValidateOnBlurBindingBehavior.prototype.getValidateTrigger = function () { - return validateTrigger.blur; - }; - ValidateOnBlurBindingBehavior.inject = [TaskQueue]; - return ValidateOnBlurBindingBehavior; -}(ValidateBindingBehaviorBase)); -/** - * Binding behavior. Indicates the bound property should be validated - * when the associated element is changed by the user, causing a change - * to the model. - */ -export var ValidateOnChangeBindingBehavior = (function (_super) { - __extends(ValidateOnChangeBindingBehavior, _super); - function ValidateOnChangeBindingBehavior() { - _super.apply(this, arguments); - } - ValidateOnChangeBindingBehavior.prototype.getValidateTrigger = function () { - return validateTrigger.change; - }; - ValidateOnChangeBindingBehavior.inject = [TaskQueue]; - return ValidateOnChangeBindingBehavior; -}(ValidateBindingBehaviorBase)); -/** - * Binding behavior. Indicates the bound property should be validated - * when the associated element blurs or is changed by the user, causing - * a change to the model. - */ -export var ValidateOnChangeOrBlurBindingBehavior = (function (_super) { - __extends(ValidateOnChangeOrBlurBindingBehavior, _super); - function ValidateOnChangeOrBlurBindingBehavior() { - _super.apply(this, arguments); - } - ValidateOnChangeOrBlurBindingBehavior.prototype.getValidateTrigger = function () { - return validateTrigger.changeOrBlur; - }; - ValidateOnChangeOrBlurBindingBehavior.inject = [TaskQueue]; - return ValidateOnChangeOrBlurBindingBehavior; -}(ValidateBindingBehaviorBase)); diff --git a/dist/native-modules/validate-trigger.d.ts b/dist/native-modules/validate-trigger.d.ts deleted file mode 100644 index 82c60096..00000000 --- a/dist/native-modules/validate-trigger.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Validation triggers. - */ -export declare const validateTrigger: { - manual: number; - blur: number; - change: number; - changeOrBlur: number; -}; diff --git a/dist/native-modules/validate-trigger.js b/dist/native-modules/validate-trigger.js deleted file mode 100644 index 7bae6c41..00000000 --- a/dist/native-modules/validate-trigger.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Validation triggers. - */ -export var validateTrigger = { - /** - * Manual validation. Use the controller's `validate()` and `reset()` methods - * to validate all bindings. - */ - manual: 0, - /** - * Validate the binding when the binding's target element fires a DOM "blur" event. - */ - blur: 1, - /** - * Validate the binding when it updates the model due to a change in the view. - */ - change: 2, - /** - * Validate the binding when the binding's target element fires a DOM "blur" event and - * when it updates the model due to a change in the view. - */ - changeOrBlur: 3 -}; diff --git a/dist/native-modules/validation-controller-factory.d.ts b/dist/native-modules/validation-controller-factory.d.ts deleted file mode 100644 index 2c51999e..00000000 --- a/dist/native-modules/validation-controller-factory.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Container } from 'aurelia-dependency-injection'; -import { ValidationController } from './validation-controller'; -import { Validator } from './validator'; -/** - * Creates ValidationController instances. - */ -export declare class ValidationControllerFactory { - private container; - static get(container: Container): ValidationControllerFactory; - constructor(container: Container); - /** - * Creates a new controller instance. - */ - create(validator?: Validator): ValidationController; - /** - * Creates a new controller and registers it in the current element's container so that it's - * available to the validate binding behavior and renderers. - */ - createForCurrentScope(validator?: Validator): ValidationController; -} diff --git a/dist/native-modules/validation-controller-factory.js b/dist/native-modules/validation-controller-factory.js deleted file mode 100644 index 2f18cd72..00000000 --- a/dist/native-modules/validation-controller-factory.js +++ /dev/null @@ -1,33 +0,0 @@ -import { ValidationController } from './validation-controller'; -import { Validator } from './validator'; -/** - * Creates ValidationController instances. - */ -export var ValidationControllerFactory = (function () { - function ValidationControllerFactory(container) { - this.container = container; - } - ValidationControllerFactory.get = function (container) { - return new ValidationControllerFactory(container); - }; - /** - * Creates a new controller instance. - */ - ValidationControllerFactory.prototype.create = function (validator) { - if (!validator) { - validator = this.container.get(Validator); - } - return new ValidationController(validator); - }; - /** - * Creates a new controller and registers it in the current element's container so that it's - * available to the validate binding behavior and renderers. - */ - ValidationControllerFactory.prototype.createForCurrentScope = function (validator) { - var controller = this.create(validator); - this.container.registerInstance(ValidationController, controller); - return controller; - }; - return ValidationControllerFactory; -}()); -ValidationControllerFactory['protocol:aurelia:resolver'] = true; diff --git a/dist/native-modules/validation-controller.d.ts b/dist/native-modules/validation-controller.d.ts deleted file mode 100644 index a65621f3..00000000 --- a/dist/native-modules/validation-controller.d.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { Binding } from 'aurelia-binding'; -import { Validator } from './validator'; -import { ValidationRenderer } from './validation-renderer'; -import { ValidationError } from './validation-error'; -export interface ValidateInstruction { - /** - * The object to validate. - */ - object: any; - /** - * The property to validate. Optional. - */ - propertyName?: any; - /** - * The rules to validate. Optional. - */ - rules?: any; -} -/** - * Orchestrates validation. - * Manages a set of bindings, renderers and objects. - * Exposes the current list of validation errors for binding purposes. - */ -export declare class ValidationController { - private validator; - static inject: typeof Validator[]; - private bindings; - private renderers; - /** - * Errors that have been rendered by the controller. - */ - errors: ValidationError[]; - /** - * Whether the controller is currently validating. - */ - validating: boolean; - private elements; - private objects; - /** - * The trigger that will invoke automatic validation of a property used in a binding. - */ - validateTrigger: number; - private finishValidating; - constructor(validator: Validator); - /** - * Adds an object to the set of objects that should be validated when validate is called. - * @param object The object. - * @param rules Optional. The rules. If rules aren't supplied the Validator implementation will lookup the rules. - */ - addObject(object: any, rules?: any): void; - /** - * Removes an object from the set of objects that should be validated when validate is called. - * @param object The object. - */ - removeObject(object: any): void; - /** - * Adds and renders a ValidationError. - */ - addError(message: string, object: any, propertyName?: string): ValidationError; - /** - * Removes and unrenders a ValidationError. - */ - removeError(error: ValidationError): void; - /** - * Adds a renderer. - * @param renderer The renderer. - */ - addRenderer(renderer: ValidationRenderer): void; - /** - * Removes a renderer. - * @param renderer The renderer. - */ - removeRenderer(renderer: ValidationRenderer): void; - /** - * Registers a binding with the controller. - * @param binding The binding instance. - * @param target The DOM element. - * @param rules (optional) rules associated with the binding. Validator implementation specific. - */ - registerBinding(binding: Binding, target: Element, rules?: any): void; - /** - * Unregisters a binding with the controller. - * @param binding The binding instance. - */ - unregisterBinding(binding: Binding): void; - /** - * Interprets the instruction and returns a predicate that will identify - * relevant errors in the list of rendered errors. - */ - private getInstructionPredicate(instruction?); - /** - * Validates and renders errors. - * @param instruction Optional. Instructions on what to validate. If undefined, all - * objects and bindings will be validated. - */ - validate(instruction?: ValidateInstruction): Promise; - /** - * Resets any rendered errors (unrenders). - * @param instruction Optional. Instructions on what to reset. If unspecified all rendered errors will be unrendered. - */ - reset(instruction?: ValidateInstruction): void; - /** - * Gets the elements associated with an object and propertyName (if any). - */ - private getAssociatedElements({object, propertyName}); - private processErrorDelta(kind, oldErrors, newErrors); - /** - * Validates the property associated with a binding. - */ - validateBinding(binding: Binding): void; - /** - * Resets the errors for a property associated with a binding. - */ - resetBinding(binding: Binding): void; -} diff --git a/dist/native-modules/validation-controller.js b/dist/native-modules/validation-controller.js deleted file mode 100644 index 07052771..00000000 --- a/dist/native-modules/validation-controller.js +++ /dev/null @@ -1,318 +0,0 @@ -import { Validator } from './validator'; -import { validateTrigger } from './validate-trigger'; -import { getPropertyInfo } from './property-info'; -import { ValidationError } from './validation-error'; -/** - * Orchestrates validation. - * Manages a set of bindings, renderers and objects. - * Exposes the current list of validation errors for binding purposes. - */ -export var ValidationController = (function () { - function ValidationController(validator) { - this.validator = validator; - // Registered bindings (via the validate binding behavior) - this.bindings = new Map(); - // Renderers that have been added to the controller instance. - this.renderers = []; - /** - * Errors that have been rendered by the controller. - */ - this.errors = []; - /** - * Whether the controller is currently validating. - */ - this.validating = false; - // Elements related to errors that have been rendered. - this.elements = new Map(); - // Objects that have been added to the controller instance (entity-style validation). - this.objects = new Map(); - /** - * The trigger that will invoke automatic validation of a property used in a binding. - */ - this.validateTrigger = validateTrigger.blur; - // Promise that resolves when validation has completed. - this.finishValidating = Promise.resolve(); - } - /** - * Adds an object to the set of objects that should be validated when validate is called. - * @param object The object. - * @param rules Optional. The rules. If rules aren't supplied the Validator implementation will lookup the rules. - */ - ValidationController.prototype.addObject = function (object, rules) { - this.objects.set(object, rules); - }; - /** - * Removes an object from the set of objects that should be validated when validate is called. - * @param object The object. - */ - ValidationController.prototype.removeObject = function (object) { - this.objects.delete(object); - this.processErrorDelta('reset', this.errors.filter(function (error) { return error.object === object; }), []); - }; - /** - * Adds and renders a ValidationError. - */ - ValidationController.prototype.addError = function (message, object, propertyName) { - var error = new ValidationError({}, message, object, propertyName); - this.processErrorDelta('validate', [], [error]); - return error; - }; - /** - * Removes and unrenders a ValidationError. - */ - ValidationController.prototype.removeError = function (error) { - if (this.errors.indexOf(error) !== -1) { - this.processErrorDelta('reset', [error], []); - } - }; - /** - * Adds a renderer. - * @param renderer The renderer. - */ - ValidationController.prototype.addRenderer = function (renderer) { - var _this = this; - this.renderers.push(renderer); - renderer.render({ - kind: 'validate', - render: this.errors.map(function (error) { return ({ error: error, elements: _this.elements.get(error) }); }), - unrender: [] - }); - }; - /** - * Removes a renderer. - * @param renderer The renderer. - */ - ValidationController.prototype.removeRenderer = function (renderer) { - var _this = this; - this.renderers.splice(this.renderers.indexOf(renderer), 1); - renderer.render({ - kind: 'reset', - render: [], - unrender: this.errors.map(function (error) { return ({ error: error, elements: _this.elements.get(error) }); }) - }); - }; - /** - * Registers a binding with the controller. - * @param binding The binding instance. - * @param target The DOM element. - * @param rules (optional) rules associated with the binding. Validator implementation specific. - */ - ValidationController.prototype.registerBinding = function (binding, target, rules) { - this.bindings.set(binding, { target: target, rules: rules, propertyInfo: null }); - }; - /** - * Unregisters a binding with the controller. - * @param binding The binding instance. - */ - ValidationController.prototype.unregisterBinding = function (binding) { - this.resetBinding(binding); - this.bindings.delete(binding); - }; - /** - * Interprets the instruction and returns a predicate that will identify - * relevant errors in the list of rendered errors. - */ - ValidationController.prototype.getInstructionPredicate = function (instruction) { - var _this = this; - if (instruction) { - var object_1 = instruction.object, propertyName_1 = instruction.propertyName, rules_1 = instruction.rules; - var predicate_1; - if (instruction.propertyName) { - predicate_1 = function (x) { return x.object === object_1 && x.propertyName === propertyName_1; }; - } - else { - predicate_1 = function (x) { return x.object === object_1; }; - } - if (rules_1) { - return function (x) { return predicate_1(x) && _this.validator.ruleExists(rules_1, x.rule); }; - } - return predicate_1; - } - else { - return function () { return true; }; - } - }; - /** - * Validates and renders errors. - * @param instruction Optional. Instructions on what to validate. If undefined, all - * objects and bindings will be validated. - */ - ValidationController.prototype.validate = function (instruction) { - var _this = this; - // Get a function that will process the validation instruction. - var execute; - if (instruction) { - var object_2 = instruction.object, propertyName_2 = instruction.propertyName, rules_2 = instruction.rules; - // if rules were not specified, check the object map. - rules_2 = rules_2 || this.objects.get(object_2); - // property specified? - if (instruction.propertyName === undefined) { - // validate the specified object. - execute = function () { return _this.validator.validateObject(object_2, rules_2); }; - } - else { - // validate the specified property. - execute = function () { return _this.validator.validateProperty(object_2, propertyName_2, rules_2); }; - } - } - else { - // validate all objects and bindings. - execute = function () { - var promises = []; - for (var _i = 0, _a = Array.from(_this.objects); _i < _a.length; _i++) { - var _b = _a[_i], object = _b[0], rules = _b[1]; - promises.push(_this.validator.validateObject(object, rules)); - } - for (var _c = 0, _d = Array.from(_this.bindings); _c < _d.length; _c++) { - var _e = _d[_c], binding = _e[0], rules = _e[1].rules; - var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); - if (!propertyInfo || _this.objects.has(propertyInfo.object)) { - continue; - } - promises.push(_this.validator.validateProperty(propertyInfo.object, propertyInfo.propertyName, rules)); - } - return Promise.all(promises).then(function (errorSets) { return errorSets.reduce(function (a, b) { return a.concat(b); }, []); }); - }; - } - // Wait for any existing validation to finish, execute the instruction, render the errors. - this.validating = true; - var result = this.finishValidating - .then(execute) - .then(function (newErrors) { - var predicate = _this.getInstructionPredicate(instruction); - var oldErrors = _this.errors.filter(predicate); - _this.processErrorDelta('validate', oldErrors, newErrors); - if (result === _this.finishValidating) { - _this.validating = false; - } - return newErrors; - }) - .catch(function (error) { - // recover, to enable subsequent calls to validate() - _this.validating = false; - _this.finishValidating = Promise.resolve(); - return Promise.reject(error); - }); - this.finishValidating = result; - return result; - }; - /** - * Resets any rendered errors (unrenders). - * @param instruction Optional. Instructions on what to reset. If unspecified all rendered errors will be unrendered. - */ - ValidationController.prototype.reset = function (instruction) { - var predicate = this.getInstructionPredicate(instruction); - var oldErrors = this.errors.filter(predicate); - this.processErrorDelta('reset', oldErrors, []); - }; - /** - * Gets the elements associated with an object and propertyName (if any). - */ - ValidationController.prototype.getAssociatedElements = function (_a) { - var object = _a.object, propertyName = _a.propertyName; - var elements = []; - for (var _i = 0, _b = Array.from(this.bindings); _i < _b.length; _i++) { - var _c = _b[_i], binding = _c[0], target = _c[1].target; - var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); - if (propertyInfo && propertyInfo.object === object && propertyInfo.propertyName === propertyName) { - elements.push(target); - } - } - return elements; - }; - ValidationController.prototype.processErrorDelta = function (kind, oldErrors, newErrors) { - // prepare the instruction. - var instruction = { - kind: kind, - render: [], - unrender: [] - }; - // create a shallow copy of newErrors so we can mutate it without causing side-effects. - newErrors = newErrors.slice(0); - // create unrender instructions from the old errors. - var _loop_1 = function(oldError) { - // get the elements associated with the old error. - var elements = this_1.elements.get(oldError); - // remove the old error from the element map. - this_1.elements.delete(oldError); - // create the unrender instruction. - instruction.unrender.push({ error: oldError, elements: elements }); - // determine if there's a corresponding new error for the old error we are unrendering. - var newErrorIndex = newErrors.findIndex(function (x) { return x.rule === oldError.rule && x.object === oldError.object && x.propertyName === oldError.propertyName; }); - if (newErrorIndex === -1) { - // no corresponding new error... simple remove. - this_1.errors.splice(this_1.errors.indexOf(oldError), 1); - } - else { - // there is a corresponding new error... - var newError = newErrors.splice(newErrorIndex, 1)[0]; - // get the elements that are associated with the new error. - var elements_1 = this_1.getAssociatedElements(newError); - this_1.elements.set(newError, elements_1); - // create a render instruction for the new error. - instruction.render.push({ error: newError, elements: elements_1 }); - // do an in-place replacement of the old error with the new error. - // this ensures any repeats bound to this.errors will not thrash. - this_1.errors.splice(this_1.errors.indexOf(oldError), 1, newError); - } - }; - var this_1 = this; - for (var _i = 0, oldErrors_1 = oldErrors; _i < oldErrors_1.length; _i++) { - var oldError = oldErrors_1[_i]; - _loop_1(oldError); - } - // create render instructions from the remaining new errors. - for (var _a = 0, newErrors_1 = newErrors; _a < newErrors_1.length; _a++) { - var error = newErrors_1[_a]; - var elements = this.getAssociatedElements(error); - instruction.render.push({ error: error, elements: elements }); - this.elements.set(error, elements); - this.errors.push(error); - } - // render. - for (var _b = 0, _c = this.renderers; _b < _c.length; _b++) { - var renderer = _c[_b]; - renderer.render(instruction); - } - }; - /** - * Validates the property associated with a binding. - */ - ValidationController.prototype.validateBinding = function (binding) { - if (!binding.isBound) { - return; - } - var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); - var rules = undefined; - var registeredBinding = this.bindings.get(binding); - if (registeredBinding) { - rules = registeredBinding.rules; - registeredBinding.propertyInfo = propertyInfo; - } - if (!propertyInfo) { - return; - } - var object = propertyInfo.object, propertyName = propertyInfo.propertyName; - this.validate({ object: object, propertyName: propertyName, rules: rules }); - }; - /** - * Resets the errors for a property associated with a binding. - */ - ValidationController.prototype.resetBinding = function (binding) { - var registeredBinding = this.bindings.get(binding); - var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); - if (!propertyInfo && registeredBinding) { - propertyInfo = registeredBinding.propertyInfo; - } - if (registeredBinding) { - registeredBinding.propertyInfo = null; - } - if (!propertyInfo) { - return; - } - var object = propertyInfo.object, propertyName = propertyInfo.propertyName; - this.reset({ object: object, propertyName: propertyName }); - }; - ValidationController.inject = [Validator]; - return ValidationController; -}()); diff --git a/dist/native-modules/validation-error.d.ts b/dist/native-modules/validation-error.d.ts deleted file mode 100644 index 34064d03..00000000 --- a/dist/native-modules/validation-error.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A validation error. - */ -export declare class ValidationError { - rule: any; - message: string; - object: any; - propertyName: string | null; - private static nextId; - /** - * A number that uniquely identifies the error instance. - */ - id: number; - /** - * @param rule The rule associated with the error. Validator implementation specific. - * @param message The error message. - * @param object The invalid object - * @param propertyName The name of the invalid property. Optional. - */ - constructor(rule: any, message: string, object: any, propertyName?: string | null); - toString(): string; -} diff --git a/dist/native-modules/validation-error.js b/dist/native-modules/validation-error.js deleted file mode 100644 index e4c48dd7..00000000 --- a/dist/native-modules/validation-error.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * A validation error. - */ -export var ValidationError = (function () { - /** - * @param rule The rule associated with the error. Validator implementation specific. - * @param message The error message. - * @param object The invalid object - * @param propertyName The name of the invalid property. Optional. - */ - function ValidationError(rule, message, object, propertyName) { - if (propertyName === void 0) { propertyName = null; } - this.rule = rule; - this.message = message; - this.object = object; - this.propertyName = propertyName; - this.id = ValidationError.nextId++; - } - ValidationError.prototype.toString = function () { - return this.message; - }; - ValidationError.nextId = 0; - return ValidationError; -}()); diff --git a/dist/native-modules/validation-errors-custom-attribute.d.ts b/dist/native-modules/validation-errors-custom-attribute.d.ts deleted file mode 100644 index 9342dd0d..00000000 --- a/dist/native-modules/validation-errors-custom-attribute.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Lazy } from 'aurelia-dependency-injection'; -import { ValidationController } from './validation-controller'; -import { ValidationError } from './validation-error'; -import { ValidationRenderer, RenderInstruction } from './validation-renderer'; -export interface RenderedError { - error: ValidationError; - targets: Element[]; -} -export declare class ValidationErrorsCustomAttribute implements ValidationRenderer { - private boundaryElement; - private controllerAccessor; - static inject: ({ - new (): Element; - prototype: Element; - } | Lazy)[]; - value: RenderedError[]; - errors: RenderedError[]; - constructor(boundaryElement: Element, controllerAccessor: { - (): ValidationController; - }); - sort(): void; - interestingElements(elements: Element[]): Element[]; - render(instruction: RenderInstruction): void; - bind(): void; - unbind(): void; -} diff --git a/dist/native-modules/validation-errors-custom-attribute.js b/dist/native-modules/validation-errors-custom-attribute.js deleted file mode 100644 index 118320ac..00000000 --- a/dist/native-modules/validation-errors-custom-attribute.js +++ /dev/null @@ -1,65 +0,0 @@ -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -import { bindingMode } from 'aurelia-binding'; -import { Lazy } from 'aurelia-dependency-injection'; -import { customAttribute } from 'aurelia-templating'; -import { ValidationController } from './validation-controller'; -export var ValidationErrorsCustomAttribute = (function () { - function ValidationErrorsCustomAttribute(boundaryElement, controllerAccessor) { - this.boundaryElement = boundaryElement; - this.controllerAccessor = controllerAccessor; - this.errors = []; - } - ValidationErrorsCustomAttribute.prototype.sort = function () { - this.errors.sort(function (a, b) { - if (a.targets[0] === b.targets[0]) { - return 0; - } - /* tslint:disable:no-bitwise */ - return a.targets[0].compareDocumentPosition(b.targets[0]) & 2 ? 1 : -1; - /* tslint:enable:no-bitwise */ - }); - }; - ValidationErrorsCustomAttribute.prototype.interestingElements = function (elements) { - var _this = this; - return elements.filter(function (e) { return _this.boundaryElement.contains(e); }); - }; - ValidationErrorsCustomAttribute.prototype.render = function (instruction) { - var _loop_1 = function(error) { - var index = this_1.errors.findIndex(function (x) { return x.error === error; }); - if (index !== -1) { - this_1.errors.splice(index, 1); - } - }; - var this_1 = this; - for (var _i = 0, _a = instruction.unrender; _i < _a.length; _i++) { - var error = _a[_i].error; - _loop_1(error); - } - for (var _b = 0, _c = instruction.render; _b < _c.length; _b++) { - var _d = _c[_b], error = _d.error, elements = _d.elements; - var targets = this.interestingElements(elements); - if (targets.length) { - this.errors.push({ error: error, targets: targets }); - } - } - this.sort(); - this.value = this.errors; - }; - ValidationErrorsCustomAttribute.prototype.bind = function () { - this.controllerAccessor().addRenderer(this); - this.value = this.errors; - }; - ValidationErrorsCustomAttribute.prototype.unbind = function () { - this.controllerAccessor().removeRenderer(this); - }; - ValidationErrorsCustomAttribute.inject = [Element, Lazy.of(ValidationController)]; - ValidationErrorsCustomAttribute = __decorate([ - customAttribute('validation-errors', bindingMode.twoWay) - ], ValidationErrorsCustomAttribute); - return ValidationErrorsCustomAttribute; -}()); diff --git a/dist/native-modules/validation-renderer-custom-attribute.d.ts b/dist/native-modules/validation-renderer-custom-attribute.d.ts deleted file mode 100644 index 9f48614e..00000000 --- a/dist/native-modules/validation-renderer-custom-attribute.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare class ValidationRendererCustomAttribute { - private container; - private controller; - private value; - private renderer; - created(view: any): void; - bind(): void; - unbind(): void; -} diff --git a/dist/native-modules/validation-renderer-custom-attribute.js b/dist/native-modules/validation-renderer-custom-attribute.js deleted file mode 100644 index 255e7087..00000000 --- a/dist/native-modules/validation-renderer-custom-attribute.js +++ /dev/null @@ -1,19 +0,0 @@ -import { ValidationController } from './validation-controller'; -export var ValidationRendererCustomAttribute = (function () { - function ValidationRendererCustomAttribute() { - } - ValidationRendererCustomAttribute.prototype.created = function (view) { - this.container = view.container; - }; - ValidationRendererCustomAttribute.prototype.bind = function () { - this.controller = this.container.get(ValidationController); - this.renderer = this.container.get(this.value); - this.controller.addRenderer(this.renderer); - }; - ValidationRendererCustomAttribute.prototype.unbind = function () { - this.controller.removeRenderer(this.renderer); - this.controller = null; - this.renderer = null; - }; - return ValidationRendererCustomAttribute; -}()); diff --git a/dist/native-modules/validation-renderer.d.ts b/dist/native-modules/validation-renderer.d.ts deleted file mode 100644 index 0422409b..00000000 --- a/dist/native-modules/validation-renderer.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { ValidationError } from './validation-error'; -/** - * An error to render (or unrender) and the associated elements (if any) - */ -export interface RenderErrorInstruction { - /** - * The validation error. - */ - error: ValidationError; - /** - * The associated elements (if any). - */ - elements: Element[]; -} -/** - * Defines which errors to render and which errors to unrender. - */ -export interface RenderInstruction { - /** - * The "kind" of render instruction. Either 'validate' or 'reset'. - */ - kind: 'validate' | 'reset'; - /** - * The errors to render. - */ - render: RenderErrorInstruction[]; - /** - * The errors to unrender. - */ - unrender: RenderErrorInstruction[]; -} -/** - * Renders validation errors. - */ -export interface ValidationRenderer { - /** - * Render the errors. - * @param instruction The render instruction. Defines which errors to render and which - * errors to unrender. - */ - render(instruction: RenderInstruction): void; -} diff --git a/dist/native-modules/validator.d.ts b/dist/native-modules/validator.d.ts deleted file mode 100644 index edaa3f40..00000000 --- a/dist/native-modules/validator.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { ValidationError } from './validation-error'; -/** - * Validates. - * Responsible for validating objects and properties. - */ -export declare abstract class Validator { - /** - * Validates the specified property. - * @param object The object to validate. - * @param propertyName The name of the property to validate. - * @param rules Optional. If unspecified, the implementation should lookup the rules for the - * specified object. This may not be possible for all implementations of this interface. - */ - abstract validateProperty(object: any, propertyName: string, rules?: any): Promise; - /** - * Validates all rules for specified object and it's properties. - * @param object The object to validate. - * @param rules Optional. If unspecified, the implementation should lookup the rules for the - * specified object. This may not be possible for all implementations of this interface. - */ - abstract validateObject(object: any, rules?: any): Promise; - /** - * Determines whether a rule exists in a set of rules. - * @param rules The rules to search. - * @parem rule The rule to find. - */ - abstract ruleExists(rules: any, rule: any): boolean; -} diff --git a/dist/native-modules/validator.js b/dist/native-modules/validator.js deleted file mode 100644 index daaaa76d..00000000 --- a/dist/native-modules/validator.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Validates. - * Responsible for validating objects and properties. - */ -export var Validator = (function () { - function Validator() { - } - return Validator; -}()); diff --git a/dist/system/aurelia-validation.d.ts b/dist/system/aurelia-validation.d.ts index b73b53e1..9897cc10 100644 --- a/dist/system/aurelia-validation.d.ts +++ b/dist/system/aurelia-validation.d.ts @@ -1,8 +1,11 @@ +export * from './controller-validate-result'; +export * from './property-info'; export * from './validate-binding-behavior'; +export * from './validate-instruction'; +export * from './validate-result'; export * from './validate-trigger'; export * from './validation-controller'; export * from './validation-controller-factory'; -export * from './validation-error'; export * from './validation-errors-custom-attribute'; export * from './validation-renderer-custom-attribute'; export * from './validation-renderer'; diff --git a/dist/system/aurelia-validation.js b/dist/system/aurelia-validation.js index 641a117a..9384f366 100644 --- a/dist/system/aurelia-validation.js +++ b/dist/system/aurelia-validation.js @@ -1,9 +1,7 @@ // Exports -System.register(['./validate-binding-behavior', './validate-trigger', './validation-controller', './validation-controller-factory', './validation-error', './validation-errors-custom-attribute', './validation-renderer-custom-attribute', './validator', './implementation/rules', './implementation/standard-validator', './implementation/validation-messages', './implementation/validation-parser', './implementation/validation-rules'], function(exports_1, context_1) { +System.register(["./property-info", "./validate-binding-behavior", "./validate-result", "./validate-trigger", "./validation-controller", "./validation-controller-factory", "./validation-errors-custom-attribute", "./validation-renderer-custom-attribute", "./validator", "./implementation/rules", "./implementation/standard-validator", "./implementation/validation-messages", "./implementation/validation-parser", "./implementation/validation-rules"], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; - var validator_1, standard_validator_1, validation_parser_1, validation_rules_1; - var AureliaValidationConfiguration; /** * Configures the plugin. */ @@ -22,22 +20,30 @@ System.register(['./validate-binding-behavior', './validate-trigger', './validat frameworkConfig.globalResources('./validate-binding-behavior', './validation-errors-custom-attribute', './validation-renderer-custom-attribute'); } exports_1("configure", configure); + var validator_1, standard_validator_1, validation_parser_1, validation_rules_1, AureliaValidationConfiguration; var exportedNames_1 = { - 'AureliaValidationConfiguration': true, - 'configure': true + "AureliaValidationConfiguration": true, + "configure": true }; function exportStar_1(m) { var exports = {}; - for(var n in m) { - if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; + for (var n in m) { + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) + exports[n] = m[n]; } exports_1(exports); } return { - setters:[ + setters: [ + function (property_info_1_1) { + exportStar_1(property_info_1_1); + }, function (validate_binding_behavior_1_1) { exportStar_1(validate_binding_behavior_1_1); }, + function (validate_result_1_1) { + exportStar_1(validate_result_1_1); + }, function (validate_trigger_1_1) { exportStar_1(validate_trigger_1_1); }, @@ -47,9 +53,6 @@ System.register(['./validate-binding-behavior', './validate-trigger', './validat function (validation_controller_factory_1_1) { exportStar_1(validation_controller_factory_1_1); }, - function (validation_error_1_1) { - exportStar_1(validation_error_1_1); - }, function (validation_errors_custom_attribute_1_1) { exportStar_1(validation_errors_custom_attribute_1_1); }, @@ -77,8 +80,9 @@ System.register(['./validate-binding-behavior', './validate-trigger', './validat function (validation_rules_2_1) { exportStar_1(validation_rules_2_1); validation_rules_1 = validation_rules_2_1; - }], - execute: function() { + } + ], + execute: function () {// Exports /** * Aurelia Validation Configuration API */ @@ -103,5 +107,5 @@ System.register(['./validate-binding-behavior', './validate-trigger', './validat }()); exports_1("AureliaValidationConfiguration", AureliaValidationConfiguration); } - } + }; }); diff --git a/dist/system/controller-validate-result.d.ts b/dist/system/controller-validate-result.d.ts new file mode 100644 index 00000000..5f814ed0 --- /dev/null +++ b/dist/system/controller-validate-result.d.ts @@ -0,0 +1,19 @@ +import { ValidateResult } from './validate-result'; +import { ValidateInstruction } from './validate-instruction'; +/** + * The result of a call to the validation controller's validate method. + */ +export interface ControllerValidateResult { + /** + * Whether validation passed. + */ + valid: boolean; + /** + * The validation result of every rule that was evaluated. + */ + results: ValidateResult[]; + /** + * The instruction passed to the controller's validate method. + */ + instruction?: ValidateInstruction; +} diff --git a/dist/system/controller-validate-result.js b/dist/system/controller-validate-result.js new file mode 100644 index 00000000..083dc444 --- /dev/null +++ b/dist/system/controller-validate-result.js @@ -0,0 +1,9 @@ +System.register([], function (exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () { + } + }; +}); diff --git a/dist/system/implementation/rule.js b/dist/system/implementation/rule.js index b73def3d..083dc444 100644 --- a/dist/system/implementation/rule.js +++ b/dist/system/implementation/rule.js @@ -1,9 +1,9 @@ -System.register([], function(exports_1, context_1) { +System.register([], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; return { - setters:[], - execute: function() { + setters: [], + execute: function () { } - } + }; }); diff --git a/dist/system/implementation/rules.js b/dist/system/implementation/rules.js index d985bf39..63269d97 100644 --- a/dist/system/implementation/rules.js +++ b/dist/system/implementation/rules.js @@ -1,10 +1,10 @@ -System.register([], function(exports_1, context_1) { +System.register([], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; var Rules; return { - setters:[], - execute: function() { + setters: [], + execute: function () { /** * Sets, unsets and retrieves rules on an object or constructor function. */ @@ -35,13 +35,13 @@ System.register([], function(exports_1, context_1) { Rules.get = function (target) { return target[Rules.key] || null; }; - /** - * The name of the property that stores the rules. - */ - Rules.key = '__rules__'; return Rules; }()); + /** + * The name of the property that stores the rules. + */ + Rules.key = '__rules__'; exports_1("Rules", Rules); } - } + }; }); diff --git a/dist/system/implementation/standard-validator.d.ts b/dist/system/implementation/standard-validator.d.ts index dfe55f31..4d8054ef 100644 --- a/dist/system/implementation/standard-validator.d.ts +++ b/dist/system/implementation/standard-validator.d.ts @@ -1,6 +1,6 @@ import { ViewResources } from 'aurelia-templating'; import { Validator } from '../validator'; -import { ValidationError } from '../validation-error'; +import { ValidateResult } from '../validate-result'; import { Rule } from './rule'; import { ValidationMessageProvider } from './validation-messages'; /** @@ -8,7 +8,7 @@ import { ValidationMessageProvider } from './validation-messages'; * Responsible for validating objects and properties. */ export declare class StandardValidator extends Validator { - static inject: (typeof ValidationMessageProvider | typeof ViewResources)[]; + static inject: (typeof ViewResources | typeof ValidationMessageProvider)[]; private messageProvider; private lookupFunctions; private getDisplayName; @@ -20,14 +20,14 @@ export declare class StandardValidator extends Validator { * @param rules Optional. If unspecified, the rules will be looked up using the metadata * for the object created by ValidationRules....on(class/object) */ - validateProperty(object: any, propertyName: string, rules?: any): Promise; + validateProperty(object: any, propertyName: string, rules?: any): Promise; /** * Validates all rules for specified object and it's properties. * @param object The object to validate. * @param rules Optional. If unspecified, the rules will be looked up using the metadata * for the object created by ValidationRules....on(class/object) */ - validateObject(object: any, rules?: any): Promise; + validateObject(object: any, rules?: any): Promise; /** * Determines whether a rule exists in a set of rules. * @param rules The rules to search. @@ -35,6 +35,6 @@ export declare class StandardValidator extends Validator { */ ruleExists(rules: Rule[][], rule: Rule): boolean; private getMessage(rule, object, value); - private validateRuleSequence(object, propertyName, ruleSequence, sequence); + private validateRuleSequence(object, propertyName, ruleSequence, sequence, results); private validate(object, propertyName, rules); } diff --git a/dist/system/implementation/standard-validator.js b/dist/system/implementation/standard-validator.js index da9cac99..4a203589 100644 --- a/dist/system/implementation/standard-validator.js +++ b/dist/system/implementation/standard-validator.js @@ -1,31 +1,31 @@ -System.register(['aurelia-templating', '../validator', '../validation-error', './rules', './validation-messages'], function(exports_1, context_1) { +System.register(["aurelia-templating", "../validator", "../validate-result", "./rules", "./validation-messages"], function (exports_1, context_1) { "use strict"; - var __moduleName = context_1 && context_1.id; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; - var aurelia_templating_1, validator_1, validation_error_1, rules_1, validation_messages_1; - var StandardValidator; + var __moduleName = context_1 && context_1.id; + var aurelia_templating_1, validator_1, validate_result_1, rules_1, validation_messages_1, StandardValidator; return { - setters:[ + setters: [ function (aurelia_templating_1_1) { aurelia_templating_1 = aurelia_templating_1_1; }, function (validator_1_1) { validator_1 = validator_1_1; }, - function (validation_error_1_1) { - validation_error_1 = validation_error_1_1; + function (validate_result_1_1) { + validate_result_1 = validate_result_1_1; }, function (rules_1_1) { rules_1 = rules_1_1; }, function (validation_messages_1_1) { validation_messages_1 = validation_messages_1_1; - }], - execute: function() { + } + ], + execute: function () { /** * Validates. * Responsible for validating objects and properties. @@ -33,10 +33,11 @@ System.register(['aurelia-templating', '../validator', '../validation-error', '. StandardValidator = (function (_super) { __extends(StandardValidator, _super); function StandardValidator(messageProvider, resources) { - _super.call(this); - this.messageProvider = messageProvider; - this.lookupFunctions = resources.lookupFunctions; - this.getDisplayName = messageProvider.getDisplayName.bind(messageProvider); + var _this = _super.call(this) || this; + _this.messageProvider = messageProvider; + _this.lookupFunctions = resources.lookupFunctions; + _this.getDisplayName = messageProvider.getDisplayName.bind(messageProvider); + return _this; } /** * Validates the specified property. @@ -74,8 +75,8 @@ System.register(['aurelia-templating', '../validator', '../validation-error', '. StandardValidator.prototype.getMessage = function (rule, object, value) { var expression = rule.message || this.messageProvider.getMessage(rule.messageKey); var _a = rule.property, propertyName = _a.name, displayName = _a.displayName; - if (displayName === null && propertyName !== null) { - displayName = this.messageProvider.getDisplayName(propertyName); + if (propertyName !== null) { + displayName = this.messageProvider.getDisplayName(propertyName, displayName); } var overrideContext = { $displayName: displayName, @@ -87,15 +88,15 @@ System.register(['aurelia-templating', '../validator', '../validation-error', '. }; return expression.evaluate({ bindingContext: object, overrideContext: overrideContext }, this.lookupFunctions); }; - StandardValidator.prototype.validateRuleSequence = function (object, propertyName, ruleSequence, sequence) { + StandardValidator.prototype.validateRuleSequence = function (object, propertyName, ruleSequence, sequence, results) { var _this = this; // are we validating all properties or a single property? var validateAllProperties = propertyName === null || propertyName === undefined; var rules = ruleSequence[sequence]; - var errors = []; + var allValid = true; // validate each rule. var promises = []; - var _loop_1 = function(i) { + var _loop_1 = function (i) { var rule = rules[i]; // is the rule related to the property we're validating. if (!validateAllProperties && rule.property.name !== propertyName) { @@ -111,11 +112,11 @@ System.register(['aurelia-templating', '../validator', '../validation-error', '. if (!(promiseOrBoolean instanceof Promise)) { promiseOrBoolean = Promise.resolve(promiseOrBoolean); } - promises.push(promiseOrBoolean.then(function (isValid) { - if (!isValid) { - var message = _this.getMessage(rule, object, value); - errors.push(new validation_error_1.ValidationError(rule, message, object, rule.property.name)); - } + promises.push(promiseOrBoolean.then(function (valid) { + var message = valid ? null : _this.getMessage(rule, object, value); + results.push(new validate_result_1.ValidateResult(rule, object, rule.property.name, valid, message)); + allValid = allValid && valid; + return valid; })); }; for (var i = 0; i < rules.length; i++) { @@ -124,10 +125,10 @@ System.register(['aurelia-templating', '../validator', '../validation-error', '. return Promise.all(promises) .then(function () { sequence++; - if (errors.length === 0 && sequence < ruleSequence.length) { - return _this.validateRuleSequence(object, propertyName, ruleSequence, sequence); + if (allValid && sequence < ruleSequence.length) { + return _this.validateRuleSequence(object, propertyName, ruleSequence, sequence, results); } - return errors; + return results; }); }; StandardValidator.prototype.validate = function (object, propertyName, rules) { @@ -140,12 +141,12 @@ System.register(['aurelia-templating', '../validator', '../validation-error', '. if (!rules) { return Promise.resolve([]); } - return this.validateRuleSequence(object, propertyName, rules, 0); + return this.validateRuleSequence(object, propertyName, rules, 0, []); }; - StandardValidator.inject = [validation_messages_1.ValidationMessageProvider, aurelia_templating_1.ViewResources]; return StandardValidator; }(validator_1.Validator)); + StandardValidator.inject = [validation_messages_1.ValidationMessageProvider, aurelia_templating_1.ViewResources]; exports_1("StandardValidator", StandardValidator); } - } + }; }); diff --git a/dist/system/implementation/util.js b/dist/system/implementation/util.js index 0d510619..22aab58c 100644 --- a/dist/system/implementation/util.js +++ b/dist/system/implementation/util.js @@ -1,4 +1,4 @@ -System.register([], function(exports_1, context_1) { +System.register([], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; function isString(value) { @@ -6,8 +6,8 @@ System.register([], function(exports_1, context_1) { } exports_1("isString", isString); return { - setters:[], - execute: function() { + setters: [], + execute: function () { } - } + }; }); diff --git a/dist/system/implementation/validation-messages.d.ts b/dist/system/implementation/validation-messages.d.ts index d9a09450..7a0978d7 100644 --- a/dist/system/implementation/validation-messages.d.ts +++ b/dist/system/implementation/validation-messages.d.ts @@ -20,10 +20,10 @@ export declare class ValidationMessageProvider { */ getMessage(key: string): Expression; /** - * When a display name is not provided, this method is used to formulate - * a display name using the property name. + * Formulates a property display name using the property name and the configured + * displayName (if provided). * Override this with your own custom logic. * @param propertyName The property name. */ - getDisplayName(propertyName: string): string; + getDisplayName(propertyName: string, displayName: string | null | undefined): string; } diff --git a/dist/system/implementation/validation-messages.js b/dist/system/implementation/validation-messages.js index 1a8e10a2..99b5b3ef 100644 --- a/dist/system/implementation/validation-messages.js +++ b/dist/system/implementation/validation-messages.js @@ -1,14 +1,14 @@ -System.register(['./validation-parser'], function(exports_1, context_1) { +System.register(["./validation-parser"], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; - var validation_parser_1; - var validationMessages, ValidationMessageProvider; + var validation_parser_1, validationMessages, ValidationMessageProvider; return { - setters:[ + setters: [ function (validation_parser_1_1) { validation_parser_1 = validation_parser_1_1; - }], - execute: function() { + } + ], + execute: function () { /** * Dictionary of validation messages. [messageKey]: messageExpression */ @@ -48,21 +48,24 @@ System.register(['./validation-parser'], function(exports_1, context_1) { return this.parser.parseMessage(message); }; /** - * When a display name is not provided, this method is used to formulate - * a display name using the property name. + * Formulates a property display name using the property name and the configured + * displayName (if provided). * Override this with your own custom logic. * @param propertyName The property name. */ - ValidationMessageProvider.prototype.getDisplayName = function (propertyName) { + ValidationMessageProvider.prototype.getDisplayName = function (propertyName, displayName) { + if (displayName !== null && displayName !== undefined) { + return displayName; + } // split on upper-case letters. var words = propertyName.split(/(?=[A-Z])/).join(' '); // capitalize first letter. return words.charAt(0).toUpperCase() + words.slice(1); }; - ValidationMessageProvider.inject = [validation_parser_1.ValidationParser]; return ValidationMessageProvider; }()); + ValidationMessageProvider.inject = [validation_parser_1.ValidationParser]; exports_1("ValidationMessageProvider", ValidationMessageProvider); } - } + }; }); diff --git a/dist/system/implementation/validation-parser.js b/dist/system/implementation/validation-parser.js index 6aa86a4e..c2721ec6 100644 --- a/dist/system/implementation/validation-parser.js +++ b/dist/system/implementation/validation-parser.js @@ -1,15 +1,14 @@ -System.register(['aurelia-binding', 'aurelia-templating', './util', 'aurelia-logging'], function(exports_1, context_1) { +System.register(["aurelia-binding", "aurelia-templating", "./util", "aurelia-logging"], function (exports_1, context_1) { "use strict"; - var __moduleName = context_1 && context_1.id; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; - var aurelia_binding_1, aurelia_templating_1, util_1, LogManager; - var ValidationParser, MessageExpressionValidator; + var __moduleName = context_1 && context_1.id; + var aurelia_binding_1, aurelia_templating_1, util_1, LogManager, ValidationParser, MessageExpressionValidator; return { - setters:[ + setters: [ function (aurelia_binding_1_1) { aurelia_binding_1 = aurelia_binding_1_1; }, @@ -21,8 +20,9 @@ System.register(['aurelia-binding', 'aurelia-templating', './util', 'aurelia-log }, function (LogManager_1) { LogManager = LogManager_1; - }], - execute: function() { + } + ], + execute: function () { ValidationParser = (function () { function ValidationParser(parser, bindinqLanguage) { this.parser = parser; @@ -75,15 +75,16 @@ System.register(['aurelia-binding', 'aurelia-templating', './util', 'aurelia-log } return this.parser.parse(match[1]); }; - ValidationParser.inject = [aurelia_binding_1.Parser, aurelia_templating_1.BindingLanguage]; return ValidationParser; }()); + ValidationParser.inject = [aurelia_binding_1.Parser, aurelia_templating_1.BindingLanguage]; exports_1("ValidationParser", ValidationParser); MessageExpressionValidator = (function (_super) { __extends(MessageExpressionValidator, _super); function MessageExpressionValidator(originalMessage) { - _super.call(this, []); - this.originalMessage = originalMessage; + var _this = _super.call(this, []) || this; + _this.originalMessage = originalMessage; + return _this; } MessageExpressionValidator.validate = function (expression, originalMessage) { var visitor = new MessageExpressionValidator(originalMessage); @@ -102,5 +103,5 @@ System.register(['aurelia-binding', 'aurelia-templating', './util', 'aurelia-log }(aurelia_binding_1.Unparser)); exports_1("MessageExpressionValidator", MessageExpressionValidator); } - } + }; }); diff --git a/dist/system/implementation/validation-rules.d.ts b/dist/system/implementation/validation-rules.d.ts index 59ba7410..13251d4d 100644 --- a/dist/system/implementation/validation-rules.d.ts +++ b/dist/system/implementation/validation-rules.d.ts @@ -122,6 +122,12 @@ export declare class FluentRules { argsToConfig?: (...args: any[]) => any; }; }; + /** + * Current rule sequence number. Used to postpone evaluation of rules until rules + * with lower sequence number have successfully validated. The "then" fluent API method + * manages this property, there's usually no need to set it directly. + */ + sequence: number; constructor(fluentEnsure: FluentEnsure, parser: ValidationParser, property: RuleProperty); /** * Sets the display name of the ensured property. @@ -191,7 +197,6 @@ export declare class FluentEnsure { * Rules that have been defined using the fluent API. */ rules: Rule[][]; - _sequence: number; constructor(parser: ValidationParser); /** * Target a property with validation rules. diff --git a/dist/system/implementation/validation-rules.js b/dist/system/implementation/validation-rules.js index 6984b449..f61fc35b 100644 --- a/dist/system/implementation/validation-rules.js +++ b/dist/system/implementation/validation-rules.js @@ -1,10 +1,9 @@ -System.register(['./util', './rules', './validation-messages'], function(exports_1, context_1) { +System.register(["./util", "./rules", "./validation-messages"], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; - var util_1, rules_1, validation_messages_1; - var FluentRuleCustomizer, FluentRules, FluentEnsure, ValidationRules; + var util_1, rules_1, validation_messages_1, FluentRuleCustomizer, FluentRules, FluentEnsure, ValidationRules; return { - setters:[ + setters: [ function (util_1_1) { util_1 = util_1_1; }, @@ -13,8 +12,9 @@ System.register(['./util', './rules', './validation-messages'], function(exports }, function (validation_messages_1_1) { validation_messages_1 = validation_messages_1_1; - }], - execute: function() { + } + ], + execute: function () { /** * Part of the fluent rule API. Enables customizing property rules. */ @@ -31,7 +31,7 @@ System.register(['./util', './rules', './validation-messages'], function(exports when: null, messageKey: 'default', message: null, - sequence: fluentEnsure._sequence + sequence: fluentRules.sequence }; this.fluentEnsure._addRule(this.rule); } @@ -41,7 +41,7 @@ System.register(['./util', './rules', './validation-messages'], function(exports * rules until less expensive rules pass validation. */ FluentRuleCustomizer.prototype.then = function () { - this.fluentEnsure._sequence++; + this.fluentRules.sequence++; return this; }; /** @@ -199,6 +199,12 @@ System.register(['./util', './rules', './validation-messages'], function(exports this.fluentEnsure = fluentEnsure; this.parser = parser; this.property = property; + /** + * Current rule sequence number. Used to postpone evaluation of rules until rules + * with lower sequence number have successfully validated. The "then" fluent API method + * manages this property, there's usually no need to set it directly. + */ + this.sequence = 0; } /** * Sets the display name of the ensured property. @@ -237,7 +243,10 @@ System.register(['./util', './rules', './validation-messages'], function(exports throw new Error("Rule with name \"" + name + "\" does not exist."); } var config = rule.argsToConfig ? rule.argsToConfig.apply(rule, args) : undefined; - return this.satisfies(function (value, obj) { return (_a = rule.condition).call.apply(_a, [_this, value, obj].concat(args)); var _a; }, config) + return this.satisfies(function (value, obj) { + return (_a = rule.condition).call.apply(_a, [_this, value, obj].concat(args)); + var _a; + }, config) .withMessageKey(name); }; /** @@ -310,23 +319,20 @@ System.register(['./util', './rules', './validation-messages'], function(exports return this.satisfies(function (value) { return value === null || value === undefined || value === '' || value === expectedValue; }, { expectedValue: expectedValue }) .withMessageKey('equals'); }; - FluentRules.customRules = {}; return FluentRules; }()); + FluentRules.customRules = {}; exports_1("FluentRules", FluentRules); /** * Part of the fluent rule API. Enables targeting properties and objects with rules. */ FluentEnsure = (function () { - /* tslint:enable */ function FluentEnsure(parser) { this.parser = parser; /** * Rules that have been defined using the fluent API. */ this.rules = []; - /* tslint:disable */ - this._sequence = 0; } /** * Target a property with validation rules. @@ -423,5 +429,5 @@ System.register(['./util', './rules', './validation-messages'], function(exports }()); exports_1("ValidationRules", ValidationRules); } - } + }; }); diff --git a/dist/system/property-info.js b/dist/system/property-info.js index 2ecb1a24..dd793e73 100644 --- a/dist/system/property-info.js +++ b/dist/system/property-info.js @@ -1,7 +1,6 @@ -System.register(['aurelia-binding'], function(exports_1, context_1) { +System.register(["aurelia-binding"], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; - var aurelia_binding_1; function getObject(expression, objectExpression, source) { var value = objectExpression.evaluate(source, null); if (value === null || value === undefined || value instanceof Object) { @@ -44,12 +43,14 @@ System.register(['aurelia-binding'], function(exports_1, context_1) { return { object: object, propertyName: propertyName }; } exports_1("getPropertyInfo", getPropertyInfo); + var aurelia_binding_1; return { - setters:[ + setters: [ function (aurelia_binding_1_1) { aurelia_binding_1 = aurelia_binding_1_1; - }], - execute: function() { + } + ], + execute: function () { } - } + }; }); diff --git a/dist/system/validate-binding-behavior-base.js b/dist/system/validate-binding-behavior-base.js index 441f776d..5dc6e123 100644 --- a/dist/system/validate-binding-behavior-base.js +++ b/dist/system/validate-binding-behavior-base.js @@ -1,10 +1,9 @@ -System.register(['aurelia-dependency-injection', 'aurelia-pal', './validation-controller', './validate-trigger'], function(exports_1, context_1) { +System.register(["aurelia-dependency-injection", "aurelia-pal", "./validation-controller", "./validate-trigger"], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; - var aurelia_dependency_injection_1, aurelia_pal_1, validation_controller_1, validate_trigger_1; - var ValidateBindingBehaviorBase; + var aurelia_dependency_injection_1, aurelia_pal_1, validation_controller_1, validate_trigger_1, ValidateBindingBehaviorBase; return { - setters:[ + setters: [ function (aurelia_dependency_injection_1_1) { aurelia_dependency_injection_1 = aurelia_dependency_injection_1_1; }, @@ -16,8 +15,9 @@ System.register(['aurelia-dependency-injection', 'aurelia-pal', './validation-co }, function (validate_trigger_1_1) { validate_trigger_1 = validate_trigger_1_1; - }], - execute: function() { + } + ], + execute: function () { /** * Binding behavior. Indicates the bound property should be validated. */ @@ -121,5 +121,5 @@ System.register(['aurelia-dependency-injection', 'aurelia-pal', './validation-co }()); exports_1("ValidateBindingBehaviorBase", ValidateBindingBehaviorBase); } - } + }; }); diff --git a/dist/system/validate-binding-behavior.js b/dist/system/validate-binding-behavior.js index 0d73a34c..b5158c1c 100644 --- a/dist/system/validate-binding-behavior.js +++ b/dist/system/validate-binding-behavior.js @@ -1,15 +1,14 @@ -System.register(['aurelia-task-queue', './validate-trigger', './validate-binding-behavior-base'], function(exports_1, context_1) { +System.register(["aurelia-task-queue", "./validate-trigger", "./validate-binding-behavior-base"], function (exports_1, context_1) { "use strict"; - var __moduleName = context_1 && context_1.id; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; - var aurelia_task_queue_1, validate_trigger_1, validate_binding_behavior_base_1; - var ValidateBindingBehavior, ValidateManuallyBindingBehavior, ValidateOnBlurBindingBehavior, ValidateOnChangeBindingBehavior, ValidateOnChangeOrBlurBindingBehavior; + var __moduleName = context_1 && context_1.id; + var aurelia_task_queue_1, validate_trigger_1, validate_binding_behavior_base_1, ValidateBindingBehavior, ValidateManuallyBindingBehavior, ValidateOnBlurBindingBehavior, ValidateOnChangeBindingBehavior, ValidateOnChangeOrBlurBindingBehavior; return { - setters:[ + setters: [ function (aurelia_task_queue_1_1) { aurelia_task_queue_1 = aurelia_task_queue_1_1; }, @@ -18,8 +17,9 @@ System.register(['aurelia-task-queue', './validate-trigger', './validate-binding }, function (validate_binding_behavior_base_1_1) { validate_binding_behavior_base_1 = validate_binding_behavior_base_1_1; - }], - execute: function() { + } + ], + execute: function () { /** * Binding behavior. Indicates the bound property should be validated * when the validate trigger specified by the associated controller's @@ -28,14 +28,14 @@ System.register(['aurelia-task-queue', './validate-trigger', './validate-binding ValidateBindingBehavior = (function (_super) { __extends(ValidateBindingBehavior, _super); function ValidateBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateBindingBehavior.prototype.getValidateTrigger = function (controller) { return controller.validateTrigger; }; - ValidateBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); + ValidateBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports_1("ValidateBindingBehavior", ValidateBindingBehavior); /** * Binding behavior. Indicates the bound property will be validated @@ -45,14 +45,14 @@ System.register(['aurelia-task-queue', './validate-trigger', './validate-binding ValidateManuallyBindingBehavior = (function (_super) { __extends(ValidateManuallyBindingBehavior, _super); function ValidateManuallyBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateManuallyBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.manual; }; - ValidateManuallyBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateManuallyBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); + ValidateManuallyBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports_1("ValidateManuallyBindingBehavior", ValidateManuallyBindingBehavior); /** * Binding behavior. Indicates the bound property should be validated @@ -61,14 +61,14 @@ System.register(['aurelia-task-queue', './validate-trigger', './validate-binding ValidateOnBlurBindingBehavior = (function (_super) { __extends(ValidateOnBlurBindingBehavior, _super); function ValidateOnBlurBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateOnBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.blur; }; - ValidateOnBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateOnBlurBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); + ValidateOnBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports_1("ValidateOnBlurBindingBehavior", ValidateOnBlurBindingBehavior); /** * Binding behavior. Indicates the bound property should be validated @@ -78,14 +78,14 @@ System.register(['aurelia-task-queue', './validate-trigger', './validate-binding ValidateOnChangeBindingBehavior = (function (_super) { __extends(ValidateOnChangeBindingBehavior, _super); function ValidateOnChangeBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateOnChangeBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.change; }; - ValidateOnChangeBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateOnChangeBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); + ValidateOnChangeBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports_1("ValidateOnChangeBindingBehavior", ValidateOnChangeBindingBehavior); /** * Binding behavior. Indicates the bound property should be validated @@ -95,15 +95,15 @@ System.register(['aurelia-task-queue', './validate-trigger', './validate-binding ValidateOnChangeOrBlurBindingBehavior = (function (_super) { __extends(ValidateOnChangeOrBlurBindingBehavior, _super); function ValidateOnChangeOrBlurBindingBehavior() { - _super.apply(this, arguments); + return _super.apply(this, arguments) || this; } ValidateOnChangeOrBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.changeOrBlur; }; - ValidateOnChangeOrBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; return ValidateOnChangeOrBlurBindingBehavior; }(validate_binding_behavior_base_1.ValidateBindingBehaviorBase)); + ValidateOnChangeOrBlurBindingBehavior.inject = [aurelia_task_queue_1.TaskQueue]; exports_1("ValidateOnChangeOrBlurBindingBehavior", ValidateOnChangeOrBlurBindingBehavior); } - } + }; }); diff --git a/dist/system/validate-instruction.d.ts b/dist/system/validate-instruction.d.ts new file mode 100644 index 00000000..2f792a70 --- /dev/null +++ b/dist/system/validate-instruction.d.ts @@ -0,0 +1,17 @@ +/** + * Instructions for the validation controller's validate method. + */ +export interface ValidateInstruction { + /** + * The object to validate. + */ + object: any; + /** + * The property to validate. Optional. + */ + propertyName?: any; + /** + * The rules to validate. Optional. + */ + rules?: any; +} diff --git a/dist/system/validate-instruction.js b/dist/system/validate-instruction.js new file mode 100644 index 00000000..083dc444 --- /dev/null +++ b/dist/system/validate-instruction.js @@ -0,0 +1,9 @@ +System.register([], function (exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () { + } + }; +}); diff --git a/dist/system/validate-result.d.ts b/dist/system/validate-result.d.ts new file mode 100644 index 00000000..461c2318 --- /dev/null +++ b/dist/system/validate-result.d.ts @@ -0,0 +1,23 @@ +/** + * The result of validating an individual validation rule. + */ +export declare class ValidateResult { + rule: any; + object: any; + propertyName: string | null; + valid: boolean; + message: string | null; + private static nextId; + /** + * A number that uniquely identifies the result instance. + */ + id: number; + /** + * @param rule The rule associated with the result. Validator implementation specific. + * @param object The object that was validated. + * @param propertyName The name of the property that was validated. + * @param error The error, if the result is a validation error. + */ + constructor(rule: any, object: any, propertyName: string | null, valid: boolean, message?: string | null); + toString(): string | null; +} diff --git a/dist/system/validate-result.js b/dist/system/validate-result.js new file mode 100644 index 00000000..0b93dd91 --- /dev/null +++ b/dist/system/validate-result.js @@ -0,0 +1,36 @@ +System.register([], function (exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var ValidateResult; + return { + setters: [], + execute: function () { + /** + * The result of validating an individual validation rule. + */ + ValidateResult = (function () { + /** + * @param rule The rule associated with the result. Validator implementation specific. + * @param object The object that was validated. + * @param propertyName The name of the property that was validated. + * @param error The error, if the result is a validation error. + */ + function ValidateResult(rule, object, propertyName, valid, message) { + if (message === void 0) { message = null; } + this.rule = rule; + this.object = object; + this.propertyName = propertyName; + this.valid = valid; + this.message = message; + this.id = ValidateResult.nextId++; + } + ValidateResult.prototype.toString = function () { + return this.valid ? 'Valid.' : this.message; + }; + return ValidateResult; + }()); + ValidateResult.nextId = 0; + exports_1("ValidateResult", ValidateResult); + } + }; +}); diff --git a/dist/system/validate-trigger.js b/dist/system/validate-trigger.js index 398898da..a8e60158 100644 --- a/dist/system/validate-trigger.js +++ b/dist/system/validate-trigger.js @@ -1,10 +1,10 @@ -System.register([], function(exports_1, context_1) { +System.register([], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; var validateTrigger; return { - setters:[], - execute: function() { + setters: [], + execute: function () { /** * Validation triggers. */ @@ -29,5 +29,5 @@ System.register([], function(exports_1, context_1) { changeOrBlur: 3 }); } - } + }; }); diff --git a/dist/system/validation-controller-factory.js b/dist/system/validation-controller-factory.js index 70adaa85..b7e3fb34 100644 --- a/dist/system/validation-controller-factory.js +++ b/dist/system/validation-controller-factory.js @@ -1,17 +1,17 @@ -System.register(['./validation-controller', './validator'], function(exports_1, context_1) { +System.register(["./validation-controller", "./validator"], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; - var validation_controller_1, validator_1; - var ValidationControllerFactory; + var validation_controller_1, validator_1, ValidationControllerFactory; return { - setters:[ + setters: [ function (validation_controller_1_1) { validation_controller_1 = validation_controller_1_1; }, function (validator_1_1) { validator_1 = validator_1_1; - }], - execute: function() { + } + ], + execute: function () { /** * Creates ValidationController instances. */ @@ -45,5 +45,5 @@ System.register(['./validation-controller', './validator'], function(exports_1, exports_1("ValidationControllerFactory", ValidationControllerFactory); ValidationControllerFactory['protocol:aurelia:resolver'] = true; } - } + }; }); diff --git a/dist/system/validation-controller.d.ts b/dist/system/validation-controller.d.ts index a65621f3..d88935e5 100644 --- a/dist/system/validation-controller.d.ts +++ b/dist/system/validation-controller.d.ts @@ -1,25 +1,13 @@ import { Binding } from 'aurelia-binding'; import { Validator } from './validator'; import { ValidationRenderer } from './validation-renderer'; -import { ValidationError } from './validation-error'; -export interface ValidateInstruction { - /** - * The object to validate. - */ - object: any; - /** - * The property to validate. Optional. - */ - propertyName?: any; - /** - * The rules to validate. Optional. - */ - rules?: any; -} +import { ValidateResult } from './validate-result'; +import { ValidateInstruction } from './validate-instruction'; +import { ControllerValidateResult } from './controller-validate-result'; /** * Orchestrates validation. * Manages a set of bindings, renderers and objects. - * Exposes the current list of validation errors for binding purposes. + * Exposes the current list of validation results for binding purposes. */ export declare class ValidationController { private validator; @@ -27,9 +15,13 @@ export declare class ValidationController { private bindings; private renderers; /** - * Errors that have been rendered by the controller. + * Validation results that have been rendered by the controller. + */ + private results; + /** + * Validation errors that have been rendered by the controller. */ - errors: ValidationError[]; + errors: ValidateResult[]; /** * Whether the controller is currently validating. */ @@ -54,13 +46,13 @@ export declare class ValidationController { */ removeObject(object: any): void; /** - * Adds and renders a ValidationError. + * Adds and renders an error. */ - addError(message: string, object: any, propertyName?: string): ValidationError; + addError(message: string, object: any, propertyName?: string | null): ValidateResult; /** - * Removes and unrenders a ValidationError. + * Removes and unrenders an error. */ - removeError(error: ValidationError): void; + removeError(result: ValidateResult): void; /** * Adds a renderer. * @param renderer The renderer. @@ -85,31 +77,32 @@ export declare class ValidationController { unregisterBinding(binding: Binding): void; /** * Interprets the instruction and returns a predicate that will identify - * relevant errors in the list of rendered errors. + * relevant results in the list of rendered validation results. */ private getInstructionPredicate(instruction?); /** - * Validates and renders errors. + * Validates and renders results. * @param instruction Optional. Instructions on what to validate. If undefined, all * objects and bindings will be validated. */ - validate(instruction?: ValidateInstruction): Promise; + validate(instruction?: ValidateInstruction): Promise; /** - * Resets any rendered errors (unrenders). - * @param instruction Optional. Instructions on what to reset. If unspecified all rendered errors will be unrendered. + * Resets any rendered validation results (unrenders). + * @param instruction Optional. Instructions on what to reset. If unspecified all rendered results + * will be unrendered. */ reset(instruction?: ValidateInstruction): void; /** * Gets the elements associated with an object and propertyName (if any). */ private getAssociatedElements({object, propertyName}); - private processErrorDelta(kind, oldErrors, newErrors); + private processResultDelta(kind, oldResults, newResults); /** * Validates the property associated with a binding. */ validateBinding(binding: Binding): void; /** - * Resets the errors for a property associated with a binding. + * Resets the results for a property associated with a binding. */ resetBinding(binding: Binding): void; } diff --git a/dist/system/validation-controller.js b/dist/system/validation-controller.js index eaf565a8..87cb141c 100644 --- a/dist/system/validation-controller.js +++ b/dist/system/validation-controller.js @@ -1,10 +1,9 @@ -System.register(['./validator', './validate-trigger', './property-info', './validation-error'], function(exports_1, context_1) { +System.register(["./validator", "./validate-trigger", "./property-info", "./validate-result"], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; - var validator_1, validate_trigger_1, property_info_1, validation_error_1; - var ValidationController; + var validator_1, validate_trigger_1, property_info_1, validate_result_1, ValidationController; return { - setters:[ + setters: [ function (validator_1_1) { validator_1 = validator_1_1; }, @@ -14,14 +13,15 @@ System.register(['./validator', './validate-trigger', './property-info', './vali function (property_info_1_1) { property_info_1 = property_info_1_1; }, - function (validation_error_1_1) { - validation_error_1 = validation_error_1_1; - }], - execute: function() { + function (validate_result_1_1) { + validate_result_1 = validate_result_1_1; + } + ], + execute: function () { /** * Orchestrates validation. * Manages a set of bindings, renderers and objects. - * Exposes the current list of validation errors for binding purposes. + * Exposes the current list of validation results for binding purposes. */ ValidationController = (function () { function ValidationController(validator) { @@ -31,14 +31,18 @@ System.register(['./validator', './validate-trigger', './property-info', './vali // Renderers that have been added to the controller instance. this.renderers = []; /** - * Errors that have been rendered by the controller. + * Validation results that have been rendered by the controller. + */ + this.results = []; + /** + * Validation errors that have been rendered by the controller. */ this.errors = []; /** * Whether the controller is currently validating. */ this.validating = false; - // Elements related to errors that have been rendered. + // Elements related to validation results that have been rendered. this.elements = new Map(); // Objects that have been added to the controller instance (entity-style validation). this.objects = new Map(); @@ -63,22 +67,23 @@ System.register(['./validator', './validate-trigger', './property-info', './vali */ ValidationController.prototype.removeObject = function (object) { this.objects.delete(object); - this.processErrorDelta('reset', this.errors.filter(function (error) { return error.object === object; }), []); + this.processResultDelta('reset', this.results.filter(function (result) { return result.object === object; }), []); }; /** - * Adds and renders a ValidationError. + * Adds and renders an error. */ ValidationController.prototype.addError = function (message, object, propertyName) { - var error = new validation_error_1.ValidationError({}, message, object, propertyName); - this.processErrorDelta('validate', [], [error]); - return error; + if (propertyName === void 0) { propertyName = null; } + var result = new validate_result_1.ValidateResult({}, object, propertyName, false, message); + this.processResultDelta('validate', [], [result]); + return result; }; /** - * Removes and unrenders a ValidationError. + * Removes and unrenders an error. */ - ValidationController.prototype.removeError = function (error) { - if (this.errors.indexOf(error) !== -1) { - this.processErrorDelta('reset', [error], []); + ValidationController.prototype.removeError = function (result) { + if (this.results.indexOf(result) !== -1) { + this.processResultDelta('reset', [result], []); } }; /** @@ -90,7 +95,7 @@ System.register(['./validator', './validate-trigger', './property-info', './vali this.renderers.push(renderer); renderer.render({ kind: 'validate', - render: this.errors.map(function (error) { return ({ error: error, elements: _this.elements.get(error) }); }), + render: this.results.map(function (result) { return ({ result: result, elements: _this.elements.get(result) }); }), unrender: [] }); }; @@ -104,7 +109,7 @@ System.register(['./validator', './validate-trigger', './property-info', './vali renderer.render({ kind: 'reset', render: [], - unrender: this.errors.map(function (error) { return ({ error: error, elements: _this.elements.get(error) }); }) + unrender: this.results.map(function (result) { return ({ result: result, elements: _this.elements.get(result) }); }) }); }; /** @@ -126,7 +131,7 @@ System.register(['./validator', './validate-trigger', './property-info', './vali }; /** * Interprets the instruction and returns a predicate that will identify - * relevant errors in the list of rendered errors. + * relevant results in the list of rendered validation results. */ ValidationController.prototype.getInstructionPredicate = function (instruction) { var _this = this; @@ -149,7 +154,7 @@ System.register(['./validator', './validate-trigger', './property-info', './vali } }; /** - * Validates and renders errors. + * Validates and renders results. * @param instruction Optional. Instructions on what to validate. If undefined, all * objects and bindings will be validated. */ @@ -187,39 +192,45 @@ System.register(['./validator', './validate-trigger', './property-info', './vali } promises.push(_this.validator.validateProperty(propertyInfo.object, propertyInfo.propertyName, rules)); } - return Promise.all(promises).then(function (errorSets) { return errorSets.reduce(function (a, b) { return a.concat(b); }, []); }); + return Promise.all(promises).then(function (resultSets) { return resultSets.reduce(function (a, b) { return a.concat(b); }, []); }); }; } - // Wait for any existing validation to finish, execute the instruction, render the errors. + // Wait for any existing validation to finish, execute the instruction, render the results. this.validating = true; - var result = this.finishValidating + var returnPromise = this.finishValidating .then(execute) - .then(function (newErrors) { + .then(function (newResults) { var predicate = _this.getInstructionPredicate(instruction); - var oldErrors = _this.errors.filter(predicate); - _this.processErrorDelta('validate', oldErrors, newErrors); - if (result === _this.finishValidating) { + var oldResults = _this.results.filter(predicate); + _this.processResultDelta('validate', oldResults, newResults); + if (returnPromise === _this.finishValidating) { _this.validating = false; } - return newErrors; + var result = { + instruction: instruction, + valid: newResults.find(function (x) { return !x.valid; }) === undefined, + results: newResults + }; + return result; }) - .catch(function (error) { + .catch(function (exception) { // recover, to enable subsequent calls to validate() _this.validating = false; _this.finishValidating = Promise.resolve(); - return Promise.reject(error); + return Promise.reject(exception); }); - this.finishValidating = result; - return result; + this.finishValidating = returnPromise; + return returnPromise; }; /** - * Resets any rendered errors (unrenders). - * @param instruction Optional. Instructions on what to reset. If unspecified all rendered errors will be unrendered. + * Resets any rendered validation results (unrenders). + * @param instruction Optional. Instructions on what to reset. If unspecified all rendered results + * will be unrendered. */ ValidationController.prototype.reset = function (instruction) { var predicate = this.getInstructionPredicate(instruction); - var oldErrors = this.errors.filter(predicate); - this.processErrorDelta('reset', oldErrors, []); + var oldResults = this.results.filter(predicate); + this.processResultDelta('reset', oldResults, []); }; /** * Gets the elements associated with an object and propertyName (if any). @@ -236,54 +247,66 @@ System.register(['./validator', './validate-trigger', './property-info', './vali } return elements; }; - ValidationController.prototype.processErrorDelta = function (kind, oldErrors, newErrors) { + ValidationController.prototype.processResultDelta = function (kind, oldResults, newResults) { // prepare the instruction. var instruction = { kind: kind, render: [], unrender: [] }; - // create a shallow copy of newErrors so we can mutate it without causing side-effects. - newErrors = newErrors.slice(0); - // create unrender instructions from the old errors. - var _loop_1 = function(oldError) { - // get the elements associated with the old error. - var elements = this_1.elements.get(oldError); - // remove the old error from the element map. - this_1.elements.delete(oldError); + // create a shallow copy of newResults so we can mutate it without causing side-effects. + newResults = newResults.slice(0); + var _loop_1 = function (oldResult) { + // get the elements associated with the old result. + var elements = this_1.elements.get(oldResult); + // remove the old result from the element map. + this_1.elements.delete(oldResult); // create the unrender instruction. - instruction.unrender.push({ error: oldError, elements: elements }); - // determine if there's a corresponding new error for the old error we are unrendering. - var newErrorIndex = newErrors.findIndex(function (x) { return x.rule === oldError.rule && x.object === oldError.object && x.propertyName === oldError.propertyName; }); - if (newErrorIndex === -1) { - // no corresponding new error... simple remove. - this_1.errors.splice(this_1.errors.indexOf(oldError), 1); + instruction.unrender.push({ result: oldResult, elements: elements }); + // determine if there's a corresponding new result for the old result we are unrendering. + var newResultIndex = newResults.findIndex(function (x) { return x.rule === oldResult.rule && x.object === oldResult.object && x.propertyName === oldResult.propertyName; }); + if (newResultIndex === -1) { + // no corresponding new result... simple remove. + this_1.results.splice(this_1.results.indexOf(oldResult), 1); + if (!oldResult.valid) { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1); + } } else { - // there is a corresponding new error... - var newError = newErrors.splice(newErrorIndex, 1)[0]; - // get the elements that are associated with the new error. - var elements_1 = this_1.getAssociatedElements(newError); - this_1.elements.set(newError, elements_1); - // create a render instruction for the new error. - instruction.render.push({ error: newError, elements: elements_1 }); - // do an in-place replacement of the old error with the new error. - // this ensures any repeats bound to this.errors will not thrash. - this_1.errors.splice(this_1.errors.indexOf(oldError), 1, newError); + // there is a corresponding new result... + var newResult = newResults.splice(newResultIndex, 1)[0]; + // get the elements that are associated with the new result. + var elements_1 = this_1.getAssociatedElements(newResult); + this_1.elements.set(newResult, elements_1); + // create a render instruction for the new result. + instruction.render.push({ result: newResult, elements: elements_1 }); + // do an in-place replacement of the old result with the new result. + // this ensures any repeats bound to this.results will not thrash. + this_1.results.splice(this_1.results.indexOf(oldResult), 1, newResult); + if (newResult.valid) { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1); + } + else { + this_1.errors.splice(this_1.errors.indexOf(oldResult), 1, newResult); + } } }; var this_1 = this; - for (var _i = 0, oldErrors_1 = oldErrors; _i < oldErrors_1.length; _i++) { - var oldError = oldErrors_1[_i]; - _loop_1(oldError); + // create unrender instructions from the old results. + for (var _i = 0, oldResults_1 = oldResults; _i < oldResults_1.length; _i++) { + var oldResult = oldResults_1[_i]; + _loop_1(oldResult); } - // create render instructions from the remaining new errors. - for (var _a = 0, newErrors_1 = newErrors; _a < newErrors_1.length; _a++) { - var error = newErrors_1[_a]; - var elements = this.getAssociatedElements(error); - instruction.render.push({ error: error, elements: elements }); - this.elements.set(error, elements); - this.errors.push(error); + // create render instructions from the remaining new results. + for (var _a = 0, newResults_1 = newResults; _a < newResults_1.length; _a++) { + var result = newResults_1[_a]; + var elements = this.getAssociatedElements(result); + instruction.render.push({ result: result, elements: elements }); + this.elements.set(result, elements); + this.results.push(result); + if (!result.valid) { + this.errors.push(result); + } } // render. for (var _b = 0, _c = this.renderers; _b < _c.length; _b++) { @@ -312,7 +335,7 @@ System.register(['./validator', './validate-trigger', './property-info', './vali this.validate({ object: object, propertyName: propertyName, rules: rules }); }; /** - * Resets the errors for a property associated with a binding. + * Resets the results for a property associated with a binding. */ ValidationController.prototype.resetBinding = function (binding) { var registeredBinding = this.bindings.get(binding); @@ -329,10 +352,10 @@ System.register(['./validator', './validate-trigger', './property-info', './vali var object = propertyInfo.object, propertyName = propertyInfo.propertyName; this.reset({ object: object, propertyName: propertyName }); }; - ValidationController.inject = [validator_1.Validator]; return ValidationController; }()); + ValidationController.inject = [validator_1.Validator]; exports_1("ValidationController", ValidationController); } - } + }; }); diff --git a/dist/system/validation-error.d.ts b/dist/system/validation-error.d.ts deleted file mode 100644 index 34064d03..00000000 --- a/dist/system/validation-error.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A validation error. - */ -export declare class ValidationError { - rule: any; - message: string; - object: any; - propertyName: string | null; - private static nextId; - /** - * A number that uniquely identifies the error instance. - */ - id: number; - /** - * @param rule The rule associated with the error. Validator implementation specific. - * @param message The error message. - * @param object The invalid object - * @param propertyName The name of the invalid property. Optional. - */ - constructor(rule: any, message: string, object: any, propertyName?: string | null); - toString(): string; -} diff --git a/dist/system/validation-error.js b/dist/system/validation-error.js deleted file mode 100644 index 0b89d8de..00000000 --- a/dist/system/validation-error.js +++ /dev/null @@ -1,35 +0,0 @@ -System.register([], function(exports_1, context_1) { - "use strict"; - var __moduleName = context_1 && context_1.id; - var ValidationError; - return { - setters:[], - execute: function() { - /** - * A validation error. - */ - ValidationError = (function () { - /** - * @param rule The rule associated with the error. Validator implementation specific. - * @param message The error message. - * @param object The invalid object - * @param propertyName The name of the invalid property. Optional. - */ - function ValidationError(rule, message, object, propertyName) { - if (propertyName === void 0) { propertyName = null; } - this.rule = rule; - this.message = message; - this.object = object; - this.propertyName = propertyName; - this.id = ValidationError.nextId++; - } - ValidationError.prototype.toString = function () { - return this.message; - }; - ValidationError.nextId = 0; - return ValidationError; - }()); - exports_1("ValidationError", ValidationError); - } - } -}); diff --git a/dist/system/validation-errors-custom-attribute.d.ts b/dist/system/validation-errors-custom-attribute.d.ts index 9342dd0d..73340e73 100644 --- a/dist/system/validation-errors-custom-attribute.d.ts +++ b/dist/system/validation-errors-custom-attribute.d.ts @@ -1,9 +1,9 @@ import { Lazy } from 'aurelia-dependency-injection'; import { ValidationController } from './validation-controller'; -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; import { ValidationRenderer, RenderInstruction } from './validation-renderer'; export interface RenderedError { - error: ValidationError; + error: ValidateResult; targets: Element[]; } export declare class ValidationErrorsCustomAttribute implements ValidationRenderer { diff --git a/dist/system/validation-errors-custom-attribute.js b/dist/system/validation-errors-custom-attribute.js index c91e2de2..a9cdc4db 100644 --- a/dist/system/validation-errors-custom-attribute.js +++ b/dist/system/validation-errors-custom-attribute.js @@ -1,16 +1,15 @@ -System.register(['aurelia-binding', 'aurelia-dependency-injection', 'aurelia-templating', './validation-controller'], function(exports_1, context_1) { +System.register(["aurelia-binding", "aurelia-dependency-injection", "aurelia-templating", "./validation-controller"], function (exports_1, context_1) { "use strict"; - var __moduleName = context_1 && context_1.id; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; - var aurelia_binding_1, aurelia_dependency_injection_1, aurelia_templating_1, validation_controller_1; - var ValidationErrorsCustomAttribute; + var __moduleName = context_1 && context_1.id; + var aurelia_binding_1, aurelia_dependency_injection_1, aurelia_templating_1, validation_controller_1, ValidationErrorsCustomAttribute; return { - setters:[ + setters: [ function (aurelia_binding_1_1) { aurelia_binding_1 = aurelia_binding_1_1; }, @@ -22,8 +21,9 @@ System.register(['aurelia-binding', 'aurelia-dependency-injection', 'aurelia-tem }, function (validation_controller_1_1) { validation_controller_1 = validation_controller_1_1; - }], - execute: function() { + } + ], + execute: function () { ValidationErrorsCustomAttribute = (function () { function ValidationErrorsCustomAttribute(boundaryElement, controllerAccessor) { this.boundaryElement = boundaryElement; @@ -45,22 +45,25 @@ System.register(['aurelia-binding', 'aurelia-dependency-injection', 'aurelia-tem return elements.filter(function (e) { return _this.boundaryElement.contains(e); }); }; ValidationErrorsCustomAttribute.prototype.render = function (instruction) { - var _loop_1 = function(error) { - var index = this_1.errors.findIndex(function (x) { return x.error === error; }); + var _loop_1 = function (result) { + var index = this_1.errors.findIndex(function (x) { return x.error === result; }); if (index !== -1) { this_1.errors.splice(index, 1); } }; var this_1 = this; for (var _i = 0, _a = instruction.unrender; _i < _a.length; _i++) { - var error = _a[_i].error; - _loop_1(error); + var result = _a[_i].result; + _loop_1(result); } for (var _b = 0, _c = instruction.render; _b < _c.length; _b++) { - var _d = _c[_b], error = _d.error, elements = _d.elements; + var _d = _c[_b], result = _d.result, elements = _d.elements; + if (result.valid) { + continue; + } var targets = this.interestingElements(elements); if (targets.length) { - this.errors.push({ error: error, targets: targets }); + this.errors.push({ error: result, targets: targets }); } } this.sort(); @@ -73,13 +76,13 @@ System.register(['aurelia-binding', 'aurelia-dependency-injection', 'aurelia-tem ValidationErrorsCustomAttribute.prototype.unbind = function () { this.controllerAccessor().removeRenderer(this); }; - ValidationErrorsCustomAttribute.inject = [Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; - ValidationErrorsCustomAttribute = __decorate([ - aurelia_templating_1.customAttribute('validation-errors', aurelia_binding_1.bindingMode.twoWay) - ], ValidationErrorsCustomAttribute); return ValidationErrorsCustomAttribute; }()); + ValidationErrorsCustomAttribute.inject = [Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; + ValidationErrorsCustomAttribute = __decorate([ + aurelia_templating_1.customAttribute('validation-errors', aurelia_binding_1.bindingMode.twoWay) + ], ValidationErrorsCustomAttribute); exports_1("ValidationErrorsCustomAttribute", ValidationErrorsCustomAttribute); } - } + }; }); diff --git a/dist/system/validation-renderer-custom-attribute.js b/dist/system/validation-renderer-custom-attribute.js index 02981a08..903d6f03 100644 --- a/dist/system/validation-renderer-custom-attribute.js +++ b/dist/system/validation-renderer-custom-attribute.js @@ -1,14 +1,14 @@ -System.register(['./validation-controller'], function(exports_1, context_1) { +System.register(["./validation-controller"], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; - var validation_controller_1; - var ValidationRendererCustomAttribute; + var validation_controller_1, ValidationRendererCustomAttribute; return { - setters:[ + setters: [ function (validation_controller_1_1) { validation_controller_1 = validation_controller_1_1; - }], - execute: function() { + } + ], + execute: function () { ValidationRendererCustomAttribute = (function () { function ValidationRendererCustomAttribute() { } @@ -29,5 +29,5 @@ System.register(['./validation-controller'], function(exports_1, context_1) { }()); exports_1("ValidationRendererCustomAttribute", ValidationRendererCustomAttribute); } - } + }; }); diff --git a/dist/system/validation-renderer.d.ts b/dist/system/validation-renderer.d.ts index 0422409b..eb430d9d 100644 --- a/dist/system/validation-renderer.d.ts +++ b/dist/system/validation-renderer.d.ts @@ -1,19 +1,19 @@ -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; /** - * An error to render (or unrender) and the associated elements (if any) + * A result to render (or unrender) and the associated elements (if any) */ -export interface RenderErrorInstruction { +export interface ResultInstruction { /** - * The validation error. + * The validation result. */ - error: ValidationError; + result: ValidateResult; /** * The associated elements (if any). */ elements: Element[]; } /** - * Defines which errors to render and which errors to unrender. + * Defines which validation results to render and which validation results to unrender. */ export interface RenderInstruction { /** @@ -21,22 +21,22 @@ export interface RenderInstruction { */ kind: 'validate' | 'reset'; /** - * The errors to render. + * The results to render. */ - render: RenderErrorInstruction[]; + render: ResultInstruction[]; /** - * The errors to unrender. + * The results to unrender. */ - unrender: RenderErrorInstruction[]; + unrender: ResultInstruction[]; } /** - * Renders validation errors. + * Renders validation results. */ export interface ValidationRenderer { /** - * Render the errors. - * @param instruction The render instruction. Defines which errors to render and which - * errors to unrender. + * Render the validation results. + * @param instruction The render instruction. Defines which results to render and which + * results to unrender. */ render(instruction: RenderInstruction): void; } diff --git a/dist/system/validation-renderer.js b/dist/system/validation-renderer.js index b73def3d..083dc444 100644 --- a/dist/system/validation-renderer.js +++ b/dist/system/validation-renderer.js @@ -1,9 +1,9 @@ -System.register([], function(exports_1, context_1) { +System.register([], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; return { - setters:[], - execute: function() { + setters: [], + execute: function () { } - } + }; }); diff --git a/dist/system/validator.d.ts b/dist/system/validator.d.ts index edaa3f40..82c045e8 100644 --- a/dist/system/validator.d.ts +++ b/dist/system/validator.d.ts @@ -1,7 +1,6 @@ -import { ValidationError } from './validation-error'; +import { ValidateResult } from './validate-result'; /** - * Validates. - * Responsible for validating objects and properties. + * Validates objects and properties. */ export declare abstract class Validator { /** @@ -11,14 +10,14 @@ export declare abstract class Validator { * @param rules Optional. If unspecified, the implementation should lookup the rules for the * specified object. This may not be possible for all implementations of this interface. */ - abstract validateProperty(object: any, propertyName: string, rules?: any): Promise; + abstract validateProperty(object: any, propertyName: string, rules?: any): Promise; /** * Validates all rules for specified object and it's properties. * @param object The object to validate. * @param rules Optional. If unspecified, the implementation should lookup the rules for the * specified object. This may not be possible for all implementations of this interface. */ - abstract validateObject(object: any, rules?: any): Promise; + abstract validateObject(object: any, rules?: any): Promise; /** * Determines whether a rule exists in a set of rules. * @param rules The rules to search. diff --git a/dist/system/validator.js b/dist/system/validator.js index 522d9b31..b12f9845 100644 --- a/dist/system/validator.js +++ b/dist/system/validator.js @@ -1,13 +1,12 @@ -System.register([], function(exports_1, context_1) { +System.register([], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; var Validator; return { - setters:[], - execute: function() { + setters: [], + execute: function () { /** - * Validates. - * Responsible for validating objects and properties. + * Validates objects and properties. */ Validator = (function () { function Validator() { @@ -16,5 +15,5 @@ System.register([], function(exports_1, context_1) { }()); exports_1("Validator", Validator); } - } + }; }); diff --git a/doc/api.json b/doc/api.json index c94ffdd1..83ef444d 100644 --- a/doc/api.json +++ b/doc/api.json @@ -1 +1 @@ -{"name":"aurelia-validation","children":[{"id":625,"name":"AureliaValidationConfiguration","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Aurelia Validation Configuration API"},"children":[{"id":626,"name":"validatorType","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":776,"character":29}],"type":{"type":"instrinct","name":"any"}},{"id":634,"name":"apply","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":635,"name":"apply","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the configuration."},"parameters":[{"id":636,"name":"container","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Container"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":786,"character":13}]},{"id":627,"name":"customValidator","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":628,"name":"customValidator","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Use a custom Validator implementation."},"parameters":[{"id":629,"name":"type","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":630,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":631,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":632,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":633,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"reference","name":"__type","id":630}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":780,"character":31}]}],"groups":[{"title":"Constructors","kind":512,"children":[631]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":780,"character":29}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":780,"character":23}]}],"groups":[{"title":"Properties","kind":1024,"children":[626]},{"title":"Methods","kind":2048,"children":[634,627]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":775,"character":47}]},{"id":569,"name":"FluentEnsure","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Part of the fluent rule API. Enables targeting properties and objects with rules."},"typeParameter":[{"id":570,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":574,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":575,"name":"new FluentEnsure","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":576,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":332}}],"type":{"type":"reference","name":"FluentEnsure","id":569}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":696,"character":26}]},{"id":573,"name":"_sequence","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":696,"character":17}],"type":{"type":"instrinct","name":"number"}},{"id":571,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":691,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":572,"name":"rules","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Rules that have been defined using the fluent API."},"sources":[{"fileName":"aurelia-validation.d.ts","line":695,"character":13}],"type":{"type":"reference","isArray":true,"name":"Rule","id":297,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"instrinct","name":"any"}]}},{"id":586,"name":"_addRule","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":587,"name":"_addRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a rule definition to the sequenced ruleset."},"parameters":[{"id":588,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Rule","id":297,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"instrinct","name":"any"}]}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":716,"character":16}]},{"id":589,"name":"assertInitialized","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":590,"name":"assertInitialized","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":717,"character":33}]},{"id":577,"name":"ensure","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":578,"name":"ensure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Target a property with validation rules."},"typeParameter":[{"id":579,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":580,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The property to target. Can be the property name or a property accessor\nfunction.\n"},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"reference","name":"PropertyAccessor","id":327,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}]}}],"type":{"type":"reference","name":"FluentRules","id":506,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":703,"character":14}]},{"id":581,"name":"ensureObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":582,"name":"ensureObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Targets an object with validation rules."},"type":{"type":"reference","name":"FluentRules","id":506,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":707,"character":20}]},{"id":583,"name":"on","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":584,"name":"on","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the rules to a class or object, making them discoverable by the StandardValidator."},"parameters":[{"id":585,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A class or object.\n"},"type":{"type":"instrinct","name":"any"}}]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":712,"character":10}]}],"groups":[{"title":"Constructors","kind":512,"children":[574]},{"title":"Properties","kind":1024,"children":[573,571,572]},{"title":"Methods","kind":2048,"children":[586,589,577,581,583]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":690,"character":29}]},{"id":423,"name":"FluentRuleCustomizer","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Part of the fluent rule API. Enables customizing property rules."},"typeParameter":[{"id":424,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":425,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":430,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":431,"name":"new FluentRuleCustomizer","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":432,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RuleProperty","id":294}},{"id":433,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":434,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":435,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":436,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":437,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":513,"character":54}]}}},{"id":438,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Object"}},{"id":439,"name":"fluentEnsure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FluentEnsure","id":569,"typeArguments":[{"type":"typeParameter","name":"TObject"}]}},{"id":440,"name":"fluentRules","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FluentRules","id":506,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}},{"id":441,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":332}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":512,"character":21}]},{"id":426,"name":"fluentEnsure","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":509,"character":28}],"type":{"type":"instrinct","name":"any"}},{"id":427,"name":"fluentRules","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":510,"character":27}],"type":{"type":"instrinct","name":"any"}},{"id":428,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":511,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":429,"name":"rule","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":512,"character":20}],"type":{"type":"instrinct","name":"any"}},{"id":468,"name":"rules","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Rules that have been defined using the fluent API."},"sources":[{"fileName":"aurelia-validation.d.ts","line":553,"character":22}],"type":{"type":"reference","isArray":true,"name":"Rule","id":297,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"instrinct","name":"any"}]}},{"id":489,"name":"email","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":490,"name":"email","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"email\" rule to the property.\nnull, undefined and empty-string values are considered valid."},"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":587,"character":13}]},{"id":459,"name":"ensure","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":460,"name":"ensure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Target a property with validation rules."},"typeParameter":[{"id":461,"name":"TValue2","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":462,"name":"subject","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"reflection","declaration":{"id":463,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":464,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":465,"name":"model","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"typeParameter","name":"TValue2"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":543,"character":41}]}}]}}],"type":{"type":"reference","name":"FluentRules","id":506,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue2"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":543,"character":14}]},{"id":466,"name":"ensureObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":467,"name":"ensureObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Targets an object with validation rules."},"type":{"type":"reference","name":"FluentRules","id":506,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":549,"character":20}]},{"id":503,"name":"equals","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":504,"name":"equals","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"equals\" validation rule to the property.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":505,"name":"expectedValue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":612,"character":14}]},{"id":486,"name":"matches","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":487,"name":"matches","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"matches\" rule to the property.\nValue must match the specified regular expression.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":488,"name":"regex","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RegExp"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":582,"character":15}]},{"id":500,"name":"maxItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":501,"name":"maxItems","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"maxItems\" ARRAY validation rule to the property.\nnull and undefined values are considered valid."},"parameters":[{"id":502,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":607,"character":16}]},{"id":494,"name":"maxLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":495,"name":"maxLength","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"maxLength\" STRING validation rule to the property.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":496,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":597,"character":17}]},{"id":497,"name":"minItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":498,"name":"minItems","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"minItems\" ARRAY validation rule to the property.\nnull and undefined values are considered valid."},"parameters":[{"id":499,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":602,"character":16}]},{"id":491,"name":"minLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":492,"name":"minLength","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"minLength\" STRING validation rule to the property.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":493,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":592,"character":17}]},{"id":469,"name":"on","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":470,"name":"on","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the rules to a class or object, making them discoverable by the StandardValidator."},"parameters":[{"id":471,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A class or object.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"FluentEnsure","id":569,"typeArguments":[{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":558,"character":10}]},{"id":484,"name":"required","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":485,"name":"required","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"required\" rule to the property.\nThe value cannot be null, undefined or whitespace."},"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":576,"character":16}]},{"id":472,"name":"satisfies","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":473,"name":"satisfies","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies an ad-hoc rule function to the ensured property or object."},"parameters":[{"id":474,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function to validate the rule.\nWill be called with two arguments, the property value and the object.\nShould return a boolean or a Promise that resolves to a boolean.\n"},"type":{"type":"reflection","declaration":{"id":475,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":476,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":477,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":478,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":565,"character":28}]}}},{"id":479,"name":"config","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Object"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":565,"character":17}]},{"id":480,"name":"satisfiesRule","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":481,"name":"satisfiesRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies a rule by name."},"parameters":[{"id":482,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the custom or standard rule."},"type":{"type":"instrinct","name":"string"}},{"id":483,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The rule's arguments.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":571,"character":21}]},{"id":456,"name":"tag","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":457,"name":"tag","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Tags the rule instance, enabling the rule to be found easily\nusing ValidationRules.taggedRules(rules, tag)"},"parameters":[{"id":458,"name":"tag","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":538,"character":11}]},{"id":442,"name":"then","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":443,"name":"then","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validate subsequent rules after previously declared rules have\nbeen validated successfully. Use to postpone validation of costly\nrules until less expensive rules pass validation."}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":519,"character":12}]},{"id":450,"name":"when","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":451,"name":"when","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Specifies a condition that must be met before attempting to validate the rule."},"parameters":[{"id":452,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A function that accepts the object as a parameter and returns true\nor false whether the rule should be evaluated.\n"},"type":{"type":"reflection","declaration":{"id":453,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":454,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":455,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":533,"character":23}]}}}]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":533,"character":12}]},{"id":447,"name":"withMessage","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":448,"name":"withMessage","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Specifies rule's validation message."},"parameters":[{"id":449,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":527,"character":19}]},{"id":444,"name":"withMessageKey","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":445,"name":"withMessageKey","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Specifies the key to use when looking up the rule's validation message."},"parameters":[{"id":446,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":523,"character":22}]}],"groups":[{"title":"Constructors","kind":512,"children":[430]},{"title":"Properties","kind":1024,"children":[426,427,428,429,468]},{"title":"Methods","kind":2048,"children":[489,459,466,503,486,500,494,497,491,469,484,472,480,456,442,450,447,444]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":508,"character":37}]},{"id":506,"name":"FluentRules","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Part of the fluent rule API. Enables applying rules to properties and objects."},"typeParameter":[{"id":507,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":508,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":527,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":528,"name":"new FluentRules","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":529,"name":"fluentEnsure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FluentEnsure","id":569,"typeArguments":[{"type":"typeParameter","name":"TObject"}]}},{"id":530,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":332}},{"id":531,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RuleProperty","id":294}}],"type":{"type":"reference","name":"FluentRules","id":506}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":626,"character":10}]},{"id":509,"name":"fluentEnsure","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":618,"character":28}],"type":{"type":"instrinct","name":"any"}},{"id":510,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":619,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":511,"name":"property","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":620,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":512,"name":"customRules","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":621,"character":26}],"type":{"type":"reflection","declaration":{"id":513,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"indexSignature":[{"id":514,"name":"__index","kind":8192,"kindString":"Index signature","flags":{},"parameters":[{"id":515,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reflection","declaration":{"id":516,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":523,"name":"argsToConfig","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":624,"character":28}],"type":{"type":"reflection","declaration":{"id":524,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":525,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":526,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":624,"character":30}]}}},{"id":517,"name":"condition","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":623,"character":25}],"type":{"type":"reflection","declaration":{"id":518,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":519,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":520,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":521,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}},{"id":522,"name":"fluentArgs","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":623,"character":26}]}}}],"groups":[{"title":"Variables","kind":32,"children":[523,517]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":622,"character":27}]}}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":621,"character":27}]}}},{"id":532,"name":"displayName","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":533,"name":"displayName","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets the display name of the ensured property."},"parameters":[{"id":534,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":631,"character":19}]},{"id":552,"name":"email","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":553,"name":"email","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"email\" rule to the property.\nnull, undefined and empty-string values are considered valid."},"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":660,"character":13}]},{"id":566,"name":"equals","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":567,"name":"equals","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"equals\" validation rule to the property.\nnull and undefined values are considered valid."},"parameters":[{"id":568,"name":"expectedValue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":685,"character":14}]},{"id":549,"name":"matches","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":550,"name":"matches","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"matches\" rule to the property.\nValue must match the specified regular expression.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":551,"name":"regex","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RegExp"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":655,"character":15}]},{"id":563,"name":"maxItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":564,"name":"maxItems","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"maxItems\" ARRAY validation rule to the property.\nnull and undefined values are considered valid."},"parameters":[{"id":565,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":680,"character":16}]},{"id":557,"name":"maxLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":558,"name":"maxLength","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"maxLength\" STRING validation rule to the property.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":559,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":670,"character":17}]},{"id":560,"name":"minItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":561,"name":"minItems","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"minItems\" ARRAY validation rule to the property.\nnull and undefined values are considered valid."},"parameters":[{"id":562,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":675,"character":16}]},{"id":554,"name":"minLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":555,"name":"minLength","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"minLength\" STRING validation rule to the property.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":556,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":665,"character":17}]},{"id":547,"name":"required","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":548,"name":"required","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"required\" rule to the property.\nThe value cannot be null, undefined or whitespace."},"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":649,"character":16}]},{"id":535,"name":"satisfies","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":536,"name":"satisfies","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies an ad-hoc rule function to the ensured property or object."},"parameters":[{"id":537,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function to validate the rule.\nWill be called with two arguments, the property value and the object.\nShould return a boolean or a Promise that resolves to a boolean.\n"},"type":{"type":"reflection","declaration":{"id":538,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":539,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":540,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":541,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":638,"character":28}]}}},{"id":542,"name":"config","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Object"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":638,"character":17}]},{"id":543,"name":"satisfiesRule","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":544,"name":"satisfiesRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies a rule by name."},"parameters":[{"id":545,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the custom or standard rule."},"type":{"type":"instrinct","name":"string"}},{"id":546,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The rule's arguments.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":423,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":644,"character":21}]}],"groups":[{"title":"Constructors","kind":512,"children":[527]},{"title":"Properties","kind":1024,"children":[509,510,511,512]},{"title":"Methods","kind":2048,"children":[532,552,566,549,563,557,560,554,547,535,543]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":617,"character":28}]},{"id":358,"name":"MessageExpressionValidator","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":364,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":365,"name":"new MessageExpressionValidator","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":366,"name":"originalMessage","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"MessageExpressionValidator","id":358},"overwrites":{"type":"reference","name":"Unparser.__constructor"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":430,"character":79}],"overwrites":{"type":"reference","name":"Unparser.__constructor"}},{"id":359,"name":"originalMessage","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":429,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":367,"name":"visitAccessScope","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":368,"name":"visitAccessScope","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":369,"name":"access","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"AccessScope"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":432,"character":24}]},{"id":360,"name":"validate","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":361,"name":"validate","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":362,"name":"expression","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Expression"}},{"id":363,"name":"originalMessage","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":430,"character":23}]}],"groups":[{"title":"Constructors","kind":512,"children":[364]},{"title":"Properties","kind":1024,"children":[359]},{"title":"Methods","kind":2048,"children":[367,360]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":428,"character":43}],"extendedTypes":[{"type":"reference","name":"Unparser"}],"implementedTypes":[{"type":"reference","name":"ExpressionVisitor"}]},{"id":315,"name":"Rules","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Sets, unsets and retrieves rules on an object or constructor function."},"children":[{"id":316,"name":"key","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isPrivate":true,"isExported":true},"comment":{"shortText":"The name of the property that stores the rules."},"sources":[{"fileName":"aurelia-validation.d.ts","line":392,"character":26}],"type":{"type":"instrinct","name":"any"}},{"id":324,"name":"get","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":325,"name":"get","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Retrieves the target's rules."},"parameters":[{"id":326,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"union","types":[{"type":"reference","isArray":true,"name":"Rule","id":297,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]},{"type":"instrinct","name":"null"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":404,"character":18}]},{"id":317,"name":"set","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":318,"name":"set","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the rules to a target."},"parameters":[{"id":319,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":320,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","isArray":true,"name":"Rule","id":297,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":396,"character":18}]},{"id":321,"name":"unset","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":322,"name":"unset","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes rules from a target."},"parameters":[{"id":323,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":400,"character":20}]}],"groups":[{"title":"Properties","kind":1024,"children":[316]},{"title":"Methods","kind":2048,"children":[324,317,321]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":388,"character":22}]},{"id":385,"name":"StandardValidator","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Validates.\nResponsible for validating objects and properties."},"children":[{"id":390,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":391,"name":"new StandardValidator","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":392,"name":"messageProvider","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationMessageProvider","id":373}},{"id":393,"name":"resources","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ViewResources"}}],"type":{"type":"reference","name":"StandardValidator","id":385}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":476,"character":31}]},{"id":389,"name":"getDisplayName","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":476,"character":30}],"type":{"type":"instrinct","name":"any"}},{"id":388,"name":"lookupFunctions","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":475,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":387,"name":"messageProvider","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":474,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":386,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":473,"character":21}],"type":{"type":"union","isArray":true,"types":[{"type":"reference","name":"ValidationMessageProvider","id":373},{"type":"reference","name":"ViewResources"}]}},{"id":407,"name":"getMessage","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":408,"name":"getMessage","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":409,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":410,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":411,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":499,"character":26}]},{"id":403,"name":"ruleExists","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":404,"name":"ruleExists","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Determines whether a rule exists in a set of rules.","tags":[{"tag":"parem","text":"rule The rule to find.\n"}]},"parameters":[{"id":405,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rules to search."},"type":{"type":"reference","isArray":true,"name":"Rule","id":297,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}},{"id":406,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Rule","id":297,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}}],"type":{"type":"instrinct","name":"boolean"},"overwrites":{"type":"reference","name":"Validator.ruleExists","id":27}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":498,"character":18}],"overwrites":{"type":"reference","name":"Validator.ruleExists","id":27}},{"id":418,"name":"validate","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":419,"name":"validate","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":420,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":421,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":422,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":501,"character":24}]},{"id":399,"name":"validateObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":400,"name":"validateObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates all rules for specified object and it's properties."},"parameters":[{"id":401,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":402,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. If unspecified, the rules will be looked up using the metadata\nfor the object created by ValidationRules....on(class/object)\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","isArray":true,"name":"ValidationError","id":2}]},"overwrites":{"type":"reference","name":"Validator.validateObject","id":23}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":492,"character":22}],"overwrites":{"type":"reference","name":"Validator.validateObject","id":23}},{"id":394,"name":"validateProperty","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":395,"name":"validateProperty","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates the specified property."},"parameters":[{"id":396,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":397,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the property to validate."},"type":{"type":"instrinct","name":"string"}},{"id":398,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. If unspecified, the rules will be looked up using the metadata\nfor the object created by ValidationRules....on(class/object)\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","isArray":true,"name":"ValidationError","id":2}]},"overwrites":{"type":"reference","name":"Validator.validateProperty","id":18}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":485,"character":24}],"overwrites":{"type":"reference","name":"Validator.validateProperty","id":18}},{"id":412,"name":"validateRuleSequence","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":413,"name":"validateRuleSequence","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":414,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":415,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":416,"name":"ruleSequence","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":417,"name":"sequence","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":500,"character":36}]}],"groups":[{"title":"Constructors","kind":512,"children":[390]},{"title":"Properties","kind":1024,"children":[389,388,387,386]},{"title":"Methods","kind":2048,"children":[407,403,418,399,394,412]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":472,"character":34}],"extendedTypes":[{"type":"reference","name":"Validator","id":17}]},{"id":136,"name":"ValidateBindingBehavior","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property should be validated\nwhen the validate trigger specified by the associated controller's\nvalidateTrigger property occurs."},"children":[{"id":141,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":142,"name":"new ValidateBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":143,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateBindingBehavior","id":136},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":117}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":239,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":117}},{"id":137,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":261,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":148,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":149,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":150,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":151,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":152,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":46},{"type":"instrinct","name":"any"}]}},{"id":153,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":127}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":249,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":127}},{"id":144,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":145,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":146,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":147,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":123}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":248,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":123}},{"id":138,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":139,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":140,"name":"controller","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationController","id":46}}],"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":120}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":262,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":120}},{"id":154,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":155,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":156,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":133}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":250,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":133}}],"groups":[{"title":"Constructors","kind":512,"children":[141]},{"title":"Properties","kind":1024,"children":[137]},{"title":"Methods","kind":2048,"children":[148,144,138,154]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":260,"character":40}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":115}]},{"id":115,"name":"ValidateBindingBehaviorBase","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property should be validated."},"children":[{"id":117,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":118,"name":"new ValidateBindingBehaviorBase","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":119,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateBindingBehaviorBase","id":115}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":239,"character":26}]},{"id":116,"name":"taskQueue","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":239,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":127,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":128,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":129,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":130,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":131,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":46},{"type":"instrinct","name":"any"}]}},{"id":132,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":249,"character":12}]},{"id":123,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":124,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":125,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":126,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":248,"character":17}]},{"id":120,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true,"isProtected":true},"signatures":[{"id":121,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":122,"name":"controller","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationController","id":46}}],"type":{"type":"instrinct","name":"number"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":241,"character":45}]},{"id":133,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":134,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":135,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":250,"character":14}]}],"groups":[{"title":"Constructors","kind":512,"children":[117]},{"title":"Properties","kind":1024,"children":[116]},{"title":"Methods","kind":2048,"children":[127,123,120,133]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":238,"character":53}],"extendedBy":[{"type":"reference","name":"ValidateBindingBehavior","id":136},{"type":"reference","name":"ValidateManuallyBindingBehavior","id":157},{"type":"reference","name":"ValidateOnBlurBindingBehavior","id":177},{"type":"reference","name":"ValidateOnChangeBindingBehavior","id":197},{"type":"reference","name":"ValidateOnChangeOrBlurBindingBehavior","id":217}]},{"id":157,"name":"ValidateManuallyBindingBehavior","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property will be validated\nmanually, by calling controller.validate(). No automatic validation\ntriggered by data-entry or blur will occur."},"children":[{"id":161,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":162,"name":"new ValidateManuallyBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":163,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateManuallyBindingBehavior","id":157},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":117}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":239,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":117}},{"id":158,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":270,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":168,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":169,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":170,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":171,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":172,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":46},{"type":"instrinct","name":"any"}]}},{"id":173,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":127}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":249,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":127}},{"id":164,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":165,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":166,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":167,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":123}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":248,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":123}},{"id":159,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":160,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":120}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":271,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":120}},{"id":174,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":175,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":176,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":133}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":250,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":133}}],"groups":[{"title":"Constructors","kind":512,"children":[161]},{"title":"Properties","kind":1024,"children":[158]},{"title":"Methods","kind":2048,"children":[168,164,159,174]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":269,"character":48}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":115}]},{"id":177,"name":"ValidateOnBlurBindingBehavior","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property should be validated\nwhen the associated element blurs."},"children":[{"id":181,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":182,"name":"new ValidateOnBlurBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":183,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateOnBlurBindingBehavior","id":177},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":117}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":239,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":117}},{"id":178,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":278,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":188,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":189,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":190,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":191,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":192,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":46},{"type":"instrinct","name":"any"}]}},{"id":193,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":127}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":249,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":127}},{"id":184,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":185,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":186,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":187,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":123}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":248,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":123}},{"id":179,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":180,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":120}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":279,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":120}},{"id":194,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":195,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":196,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":133}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":250,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":133}}],"groups":[{"title":"Constructors","kind":512,"children":[181]},{"title":"Properties","kind":1024,"children":[178]},{"title":"Methods","kind":2048,"children":[188,184,179,194]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":277,"character":46}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":115}]},{"id":197,"name":"ValidateOnChangeBindingBehavior","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property should be validated\nwhen the associated element is changed by the user, causing a change\nto the model."},"children":[{"id":201,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":202,"name":"new ValidateOnChangeBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":203,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateOnChangeBindingBehavior","id":197},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":117}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":239,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":117}},{"id":198,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":287,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":208,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":209,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":210,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":211,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":212,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":46},{"type":"instrinct","name":"any"}]}},{"id":213,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":127}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":249,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":127}},{"id":204,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":205,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":206,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":207,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":123}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":248,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":123}},{"id":199,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":200,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":120}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":288,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":120}},{"id":214,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":215,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":216,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":133}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":250,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":133}}],"groups":[{"title":"Constructors","kind":512,"children":[201]},{"title":"Properties","kind":1024,"children":[198]},{"title":"Methods","kind":2048,"children":[208,204,199,214]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":286,"character":48}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":115}]},{"id":217,"name":"ValidateOnChangeOrBlurBindingBehavior","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property should be validated\nwhen the associated element blurs or is changed by the user, causing\na change to the model."},"children":[{"id":221,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":222,"name":"new ValidateOnChangeOrBlurBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":223,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateOnChangeOrBlurBindingBehavior","id":217},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":117}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":239,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":117}},{"id":218,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":296,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":228,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":229,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":230,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":231,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":232,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":46},{"type":"instrinct","name":"any"}]}},{"id":233,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":127}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":249,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":127}},{"id":224,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":225,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":226,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":227,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":123}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":248,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":123}},{"id":219,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":220,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":120}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":297,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":120}},{"id":234,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":235,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":236,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":133}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":250,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":133}}],"groups":[{"title":"Constructors","kind":512,"children":[221]},{"title":"Properties","kind":1024,"children":[218]},{"title":"Methods","kind":2048,"children":[228,224,219,234]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":295,"character":54}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":115}]},{"id":46,"name":"ValidationController","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Orchestrates validation.\nManages a set of bindings, renderers and objects.\nExposes the current list of validation errors for binding purposes."},"children":[{"id":57,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":58,"name":"new ValidationController","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":59,"name":"validator","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Validator","id":17}}],"type":{"type":"reference","name":"ValidationController","id":46}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":160,"character":33}]},{"id":49,"name":"bindings","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":144,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":53,"name":"elements","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":154,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":51,"name":"errors","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Errors that have been rendered by the controller."},"sources":[{"fileName":"aurelia-validation.d.ts","line":149,"character":14}],"type":{"type":"reference","isArray":true,"name":"ValidationError","id":2}},{"id":56,"name":"finishValidating","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":160,"character":32}],"type":{"type":"instrinct","name":"any"}},{"id":54,"name":"objects","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":155,"character":23}],"type":{"type":"instrinct","name":"any"}},{"id":50,"name":"renderers","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":145,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":55,"name":"validateTrigger","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The trigger that will invoke automatic validation of a property used in a binding."},"sources":[{"fileName":"aurelia-validation.d.ts","line":159,"character":23}],"type":{"type":"instrinct","name":"number"}},{"id":52,"name":"validating","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":" Whether the controller is currently validating."},"sources":[{"fileName":"aurelia-validation.d.ts","line":153,"character":18}],"type":{"type":"instrinct","name":"boolean"}},{"id":47,"name":"validator","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":142,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":48,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":143,"character":21}],"type":{"type":"reference","isArray":true,"name":"Validator","id":17}},{"id":67,"name":"addError","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":68,"name":"addError","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds and renders a ValidationError."},"parameters":[{"id":69,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}},{"id":70,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":71,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"ValidationError","id":2}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":176,"character":16}]},{"id":60,"name":"addObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":61,"name":"addObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds an object to the set of objects that should be validated when validate is called."},"parameters":[{"id":62,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object."},"type":{"type":"instrinct","name":"any"}},{"id":63,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. The rules. If rules aren't supplied the Validator implementation will lookup the rules.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":167,"character":17}]},{"id":75,"name":"addRenderer","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":76,"name":"addRenderer","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a renderer."},"parameters":[{"id":77,"name":"renderer","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The renderer.\n"},"type":{"type":"reference","name":"ValidationRenderer","id":38}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":185,"character":19}]},{"id":98,"name":"getAssociatedElements","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":99,"name":"getAssociatedElements","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the elements associated with an object and propertyName (if any)."},"parameters":[{"id":100,"name":"__namedParameters","kind":32768,"kindString":"Parameter","flags":{},"originalName":"__0","type":{"type":"reflection","declaration":{"id":101,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":102,"name":"object","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":222,"character":45}],"type":{"type":"instrinct","name":"any"}},{"id":103,"name":"propertyName","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":222,"character":59}],"type":{"type":"instrinct","name":"any"}}],"groups":[{"title":"Variables","kind":32,"children":[102,103]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":222,"character":38}]}}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":222,"character":37}]},{"id":89,"name":"getInstructionPredicate","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":90,"name":"getInstructionPredicate","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Interprets the instruction and returns a predicate that will identify\nrelevant errors in the list of rendered errors."},"parameters":[{"id":91,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":207,"character":39}]},{"id":104,"name":"processErrorDelta","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":105,"name":"processErrorDelta","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":106,"name":"kind","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":107,"name":"oldErrors","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":108,"name":"newErrors","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":223,"character":33}]},{"id":81,"name":"registerBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":82,"name":"registerBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Registers a binding with the controller."},"parameters":[{"id":83,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The binding instance."},"type":{"type":"reference","name":"Binding"}},{"id":84,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The DOM element."},"type":{"type":"reference","name":"Element"}},{"id":85,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"(optional) rules associated with the binding. Validator implementation specific.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":197,"character":23}]},{"id":72,"name":"removeError","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":73,"name":"removeError","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes and unrenders a ValidationError."},"parameters":[{"id":74,"name":"error","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationError","id":2}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":180,"character":19}]},{"id":64,"name":"removeObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":65,"name":"removeObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes an object from the set of objects that should be validated when validate is called."},"parameters":[{"id":66,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":172,"character":20}]},{"id":78,"name":"removeRenderer","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":79,"name":"removeRenderer","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes a renderer."},"parameters":[{"id":80,"name":"renderer","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The renderer.\n"},"type":{"type":"reference","name":"ValidationRenderer","id":38}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":190,"character":22}]},{"id":95,"name":"reset","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":96,"name":"reset","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Resets any rendered errors (unrenders)."},"parameters":[{"id":97,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. Instructions on what to reset. If unspecified all rendered errors will be unrendered.\n"},"type":{"type":"reference","name":"ValidateInstruction","id":42}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":218,"character":13}]},{"id":112,"name":"resetBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":113,"name":"resetBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Resets the errors for a property associated with a binding."},"parameters":[{"id":114,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Binding"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":231,"character":20}]},{"id":86,"name":"unregisterBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":87,"name":"unregisterBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Unregisters a binding with the controller."},"parameters":[{"id":88,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The binding instance.\n"},"type":{"type":"reference","name":"Binding"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":202,"character":25}]},{"id":92,"name":"validate","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":93,"name":"validate","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates and renders errors."},"parameters":[{"id":94,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. Instructions on what to validate. If undefined, all\nobjects and bindings will be validated.\n"},"type":{"type":"reference","name":"ValidateInstruction","id":42}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","isArray":true,"name":"ValidationError","id":2}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":213,"character":16}]},{"id":109,"name":"validateBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":110,"name":"validateBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates the property associated with a binding."},"parameters":[{"id":111,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Binding"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":227,"character":23}]}],"groups":[{"title":"Constructors","kind":512,"children":[57]},{"title":"Properties","kind":1024,"children":[49,53,51,56,54,50,55,52,47,48]},{"title":"Methods","kind":2048,"children":[67,60,75,98,89,104,81,72,64,78,95,112,86,92,109]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":141,"character":37}]},{"id":237,"name":"ValidationControllerFactory","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Creates ValidationController instances."},"children":[{"id":242,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":243,"name":"new ValidationControllerFactory","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":244,"name":"container","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Container"}}],"type":{"type":"reference","name":"ValidationControllerFactory","id":237}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":307,"character":70}]},{"id":238,"name":"container","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":306,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":245,"name":"create","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":246,"name":"create","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a new controller instance."},"parameters":[{"id":247,"name":"validator","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Validator","id":17}}],"type":{"type":"reference","name":"ValidationController","id":46}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":312,"character":14}]},{"id":248,"name":"createForCurrentScope","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":249,"name":"createForCurrentScope","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a new controller and registers it in the current element's container so that it's\navailable to the validate binding behavior and renderers."},"parameters":[{"id":250,"name":"validator","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Validator","id":17}}],"type":{"type":"reference","name":"ValidationController","id":46}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":317,"character":29}]},{"id":239,"name":"get","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":240,"name":"get","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":241,"name":"container","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Container"}}],"type":{"type":"reference","name":"ValidationControllerFactory","id":237}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":307,"character":18}]}],"groups":[{"title":"Constructors","kind":512,"children":[242]},{"title":"Properties","kind":1024,"children":[238]},{"title":"Methods","kind":2048,"children":[245,248,239]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":305,"character":44}]},{"id":2,"name":"ValidationError","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"A validation error."},"children":[{"id":9,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{},"signatures":[{"id":10,"name":"new ValidationError","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{},"parameters":[{"id":11,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The rule associated with the error. Validator implementation specific."},"type":{"type":"instrinct","name":"any"}},{"id":12,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The error message."},"type":{"type":"instrinct","name":"string"}},{"id":13,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The invalid object"},"type":{"type":"instrinct","name":"any"}},{"id":14,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"The name of the invalid property. Optional.\n"},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}}],"type":{"type":"reference","name":"ValidationError","id":2}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":18,"character":19}]},{"id":8,"name":"id","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"A number that uniquely identifies the error instance."},"sources":[{"fileName":"aurelia-validation.d.ts","line":18,"character":10}],"type":{"type":"instrinct","name":"number"}},{"id":4,"name":"message","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":11,"character":15}],"type":{"type":"instrinct","name":"string"}},{"id":5,"name":"object","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":12,"character":14}],"type":{"type":"instrinct","name":"any"}},{"id":6,"name":"propertyName","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":13,"character":20}],"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}},{"id":3,"name":"rule","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":10,"character":12}],"type":{"type":"instrinct","name":"any"}},{"id":7,"name":"nextId","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":14,"character":29}],"type":{"type":"instrinct","name":"any"}},{"id":15,"name":"toString","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":16,"name":"toString","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"string"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":26,"character":16}]}],"groups":[{"title":"Constructors","kind":512,"children":[9]},{"title":"Properties","kind":1024,"children":[8,4,5,6,3,7]},{"title":"Methods","kind":2048,"children":[15]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":9,"character":32}]},{"id":254,"name":"ValidationErrorsCustomAttribute","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":264,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":265,"name":"new ValidationErrorsCustomAttribute","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":266,"name":"boundaryElement","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Element"}},{"id":267,"name":"controllerAccessor","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":268,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":269,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"ValidationController","id":46}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":336,"character":65}]}}}],"type":{"type":"reference","name":"ValidationErrorsCustomAttribute","id":254}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":335,"character":32}]},{"id":255,"name":"boundaryElement","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":328,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":256,"name":"controllerAccessor","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":329,"character":34}],"type":{"type":"instrinct","name":"any"}},{"id":263,"name":"errors","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":335,"character":14}],"type":{"type":"reference","isArray":true,"name":"RenderedError","id":251}},{"id":262,"name":"value","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":334,"character":13}],"type":{"type":"reference","isArray":true,"name":"RenderedError","id":251}},{"id":257,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":330,"character":21}],"type":{"type":"union","isArray":true,"types":[{"type":"reflection","declaration":{"id":258,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":259,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":260,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"type":{"type":"reference","name":"__type","id":258}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":330,"character":25}]},{"id":261,"name":"prototype","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":332,"character":21}],"type":{"type":"reference","name":"Element"}}],"groups":[{"title":"Constructors","kind":512,"children":[259]},{"title":"Variables","kind":32,"children":[261]}]}},{"type":"reference","name":"Lazy"}]}},{"id":278,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":279,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":342,"character":12}]},{"id":272,"name":"interestingElements","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":273,"name":"interestingElements","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":274,"name":"elements","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","isArray":true,"name":"Element"}}],"type":{"type":"reference","isArray":true,"name":"Element"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":340,"character":27}]},{"id":275,"name":"render","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":276,"name":"render","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":277,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RenderInstruction","id":34}}],"type":{"type":"instrinct","name":"void"},"implementationOf":{"type":"reference","name":"ValidationRenderer.render","id":40}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":341,"character":14}],"implementationOf":{"type":"reference","name":"ValidationRenderer.render","id":39}},{"id":270,"name":"sort","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":271,"name":"sort","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":339,"character":12}]},{"id":280,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":281,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":343,"character":14}]}],"groups":[{"title":"Constructors","kind":512,"children":[264]},{"title":"Properties","kind":1024,"children":[255,256,263,262,257]},{"title":"Methods","kind":2048,"children":[278,272,275,270,280]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":327,"character":48}],"implementedTypes":[{"type":"reference","name":"ValidationRenderer","id":38}]},{"id":373,"name":"ValidationMessageProvider","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Retrieves validation messages and property display names."},"children":[{"id":376,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":377,"name":"new ValidationMessageProvider","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":378,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":332}}],"type":{"type":"reference","name":"ValidationMessageProvider","id":373}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":448,"character":49}]},{"id":374,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":447,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":375,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":448,"character":21}],"type":{"type":"reference","isArray":true,"name":"ValidationParser","id":332}},{"id":382,"name":"getDisplayName","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":383,"name":"getDisplayName","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"When a display name is not provided, this method is used to formulate\na display name using the property name.\nOverride this with your own custom logic."},"parameters":[{"id":384,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The property name.\n"},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"string"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":461,"character":22}]},{"id":379,"name":"getMessage","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":380,"name":"getMessage","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Returns a message binding expression that corresponds to the key."},"parameters":[{"id":381,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message key.\n"},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Expression"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":454,"character":18}]}],"groups":[{"title":"Constructors","kind":512,"children":[376]},{"title":"Properties","kind":1024,"children":[374,375]},{"title":"Methods","kind":2048,"children":[382,379]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":446,"character":42}]},{"id":332,"name":"ValidationParser","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":340,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":341,"name":"new ValidationParser","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":342,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Parser"}},{"id":343,"name":"bindinqLanguage","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"BindingLanguage"}}],"type":{"type":"reference","name":"ValidationParser","id":332}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":421,"character":22}]},{"id":334,"name":"bindinqLanguage","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":416,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":339,"name":"cache","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":421,"character":21}],"type":{"type":"instrinct","name":"any"}},{"id":336,"name":"emptyStringExpression","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":418,"character":37}],"type":{"type":"instrinct","name":"any"}},{"id":337,"name":"nullExpression","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":419,"character":30}],"type":{"type":"instrinct","name":"any"}},{"id":333,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":415,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":338,"name":"undefinedExpression","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":420,"character":35}],"type":{"type":"instrinct","name":"any"}},{"id":335,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":417,"character":21}],"type":{"type":"union","isArray":true,"types":[{"type":"reference","name":"Parser"},{"type":"reference","name":"BindingLanguage"}]}},{"id":352,"name":"coalesce","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":353,"name":"coalesce","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":354,"name":"part","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":425,"character":24}]},{"id":355,"name":"getAccessorExpression","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":356,"name":"getAccessorExpression","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":357,"name":"fn","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":426,"character":37}]},{"id":344,"name":"parseMessage","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":345,"name":"parseMessage","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":346,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Expression"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":423,"character":20}]},{"id":347,"name":"parseProperty","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":348,"name":"parseProperty","kind":4096,"kindString":"Call signature","flags":{},"typeParameter":[{"id":349,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":350,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":351,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"reference","name":"PropertyAccessor","id":327,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}]}}],"type":{"type":"reference","name":"RuleProperty","id":294}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":424,"character":21}]}],"groups":[{"title":"Constructors","kind":512,"children":[340]},{"title":"Properties","kind":1024,"children":[334,339,336,337,333,338,335]},{"title":"Methods","kind":2048,"children":[352,355,344,347]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":414,"character":33}]},{"id":282,"name":"ValidationRendererCustomAttribute","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":283,"name":"container","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":347,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":284,"name":"controller","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":348,"character":26}],"type":{"type":"instrinct","name":"any"}},{"id":286,"name":"renderer","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":350,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":285,"name":"value","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":349,"character":21}],"type":{"type":"instrinct","name":"any"}},{"id":290,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":291,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":352,"character":12}]},{"id":287,"name":"created","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":288,"name":"created","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":289,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":351,"character":15}]},{"id":292,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":293,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":353,"character":14}]}],"groups":[{"title":"Properties","kind":1024,"children":[283,284,286,285]},{"title":"Methods","kind":2048,"children":[290,287,292]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":346,"character":50}]},{"id":591,"name":"ValidationRules","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Fluent rule definition API."},"children":[{"id":592,"name":"parser","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":723,"character":29}],"type":{"type":"instrinct","name":"any"}},{"id":604,"name":"customRule","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":605,"name":"customRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Defines a custom rule."},"parameters":[{"id":606,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the custom rule. Also serves as the message key."},"type":{"type":"instrinct","name":"string"}},{"id":607,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rule function."},"type":{"type":"reflection","declaration":{"id":608,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":609,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":610,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":611,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}},{"id":612,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":742,"character":50}]}}},{"id":613,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message expression"},"type":{"type":"instrinct","name":"string"}},{"id":614,"name":"argsToConfig","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"A function that maps the rule's arguments to a \"config\"\nobject that can be used when evaluating the message expression.\n"},"type":{"type":"reflection","declaration":{"id":615,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":616,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":617,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":742,"character":156}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":742,"character":25}]},{"id":596,"name":"ensure","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":597,"name":"ensure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Target a property with validation rules."},"typeParameter":[{"id":598,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":599,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":600,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The property to target. Can be the property name or a property accessor function.\n"},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"reference","name":"PropertyAccessor","id":327,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}]}}],"type":{"type":"reference","name":"FluentRules","id":506,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":729,"character":21}]},{"id":601,"name":"ensureObject","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":602,"name":"ensureObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Targets an object with validation rules."},"typeParameter":[{"id":603,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}}],"type":{"type":"reference","name":"FluentRules","id":506,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":733,"character":27}]},{"id":593,"name":"initialize","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":594,"name":"initialize","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":595,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":332}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":724,"character":25}]},{"id":622,"name":"off","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":623,"name":"off","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes the rules from a class or object."},"parameters":[{"id":624,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A class or object.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":753,"character":18}]},{"id":618,"name":"taggedRules","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":619,"name":"taggedRules","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Returns rules with the matching tag."},"parameters":[{"id":620,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rules to search."},"type":{"type":"reference","isArray":true,"name":"Rule","id":297,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}},{"id":621,"name":"tag","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The tag to search for.\n"},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","isArray":true,"name":"Rule","id":297,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":748,"character":26}]}],"groups":[{"title":"Properties","kind":1024,"children":[592]},{"title":"Methods","kind":2048,"children":[604,596,601,593,622,618]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":722,"character":32}]},{"id":17,"name":"Validator","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Validates.\nResponsible for validating objects and properties."},"children":[{"id":27,"name":"ruleExists","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":28,"name":"ruleExists","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Determines whether a rule exists in a set of rules.","tags":[{"tag":"parem","text":"rule The rule to find.\n"}]},"parameters":[{"id":29,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rules to search."},"type":{"type":"instrinct","name":"any"}},{"id":30,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":54,"character":27}]},{"id":23,"name":"validateObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":24,"name":"validateObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates all rules for specified object and it's properties."},"parameters":[{"id":25,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":26,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. If unspecified, the implementation should lookup the rules for the\nspecified object. This may not be possible for all implementations of this interface.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","isArray":true,"name":"ValidationError","id":2}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":48,"character":31}]},{"id":18,"name":"validateProperty","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":19,"name":"validateProperty","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates the specified property."},"parameters":[{"id":20,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":21,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the property to validate."},"type":{"type":"instrinct","name":"string"}},{"id":22,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. If unspecified, the implementation should lookup the rules for the\nspecified object. This may not be possible for all implementations of this interface.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","isArray":true,"name":"ValidationError","id":2}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":41,"character":33}]}],"groups":[{"title":"Methods","kind":2048,"children":[27,23,18]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":33,"character":35}],"extendedBy":[{"type":"reference","name":"StandardValidator","id":385}]},{"id":327,"name":"PropertyAccessor","kind":256,"kindString":"Interface","flags":{"isExported":true},"typeParameter":[{"id":328,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":329,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"signatures":[{"id":330,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":331,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"typeParameter","name":"TValue"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":411,"character":37}]},{"id":31,"name":"RenderErrorInstruction","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"An error to render (or unrender) and the associated elements (if any)"},"children":[{"id":33,"name":"elements","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The associated elements (if any)."},"sources":[{"fileName":"aurelia-validation.d.ts","line":88,"character":16}],"type":{"type":"reference","isArray":true,"name":"Element"}},{"id":32,"name":"error","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The validation error."},"sources":[{"fileName":"aurelia-validation.d.ts","line":84,"character":13}],"type":{"type":"reference","name":"ValidationError","id":2}}],"groups":[{"title":"Properties","kind":1024,"children":[33,32]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":80,"character":43}]},{"id":34,"name":"RenderInstruction","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Defines which errors to render and which errors to unrender."},"children":[{"id":35,"name":"kind","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The \"kind\" of render instruction. Either 'validate' or 'reset'."},"sources":[{"fileName":"aurelia-validation.d.ts","line":97,"character":12}],"type":{"type":"union","types":[{"type":"stringLiteral","value":"validate"},{"type":"stringLiteral","value":"reset"}]}},{"id":36,"name":"render","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The errors to render."},"sources":[{"fileName":"aurelia-validation.d.ts","line":101,"character":14}],"type":{"type":"reference","isArray":true,"name":"RenderErrorInstruction","id":31}},{"id":37,"name":"unrender","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The errors to unrender."},"sources":[{"fileName":"aurelia-validation.d.ts","line":105,"character":16}],"type":{"type":"reference","isArray":true,"name":"RenderErrorInstruction","id":31}}],"groups":[{"title":"Properties","kind":1024,"children":[35,36,37]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":93,"character":38}]},{"id":251,"name":"RenderedError","kind":256,"kindString":"Interface","flags":{"isExported":true},"children":[{"id":252,"name":"error","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":324,"character":13}],"type":{"type":"reference","name":"ValidationError","id":2}},{"id":253,"name":"targets","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":325,"character":15}],"type":{"type":"reference","isArray":true,"name":"Element"}}],"groups":[{"title":"Properties","kind":1024,"children":[252,253]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":323,"character":34}]},{"id":297,"name":"Rule","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"A rule definition. Associations a rule with a property or object."},"typeParameter":[{"id":298,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":299,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":301,"name":"condition","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":374,"character":17}],"type":{"type":"reflection","declaration":{"id":302,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":303,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":304,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":305,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":374,"character":18}]}}},{"id":306,"name":"config","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":375,"character":14}],"type":{"type":"reference","name":"Object"}},{"id":312,"name":"message","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":380,"character":15}],"type":{"type":"union","types":[{"type":"reference","name":"Expression"},{"type":"instrinct","name":"null"}]}},{"id":311,"name":"messageKey","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":379,"character":18}],"type":{"type":"instrinct","name":"string"}},{"id":300,"name":"property","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":373,"character":16}],"type":{"type":"reference","name":"RuleProperty","id":294}},{"id":313,"name":"sequence","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":381,"character":16}],"type":{"type":"instrinct","name":"number"}},{"id":314,"name":"tag","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":382,"character":11}],"type":{"type":"instrinct","name":"string"}},{"id":307,"name":"when","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":376,"character":12}],"type":{"type":"union","types":[{"type":"reflection","declaration":{"id":308,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":309,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":310,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":376,"character":13}]}},{"type":"instrinct","name":"null"}]}}],"groups":[{"title":"Properties","kind":1024,"children":[301,306,312,311,300,313,314,307]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":372,"character":25}]},{"id":294,"name":"RuleProperty","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Information related to a property that is the subject of validation."},"children":[{"id":296,"name":"displayName","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The displayName of the property (or object)."},"sources":[{"fileName":"aurelia-validation.d.ts","line":367,"character":19}],"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}},{"id":295,"name":"name","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The property name. null indicates the rule targets the object itself."},"sources":[{"fileName":"aurelia-validation.d.ts","line":363,"character":12}],"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}}],"groups":[{"title":"Properties","kind":1024,"children":[296,295]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":359,"character":33}]},{"id":42,"name":"ValidateInstruction","kind":256,"kindString":"Interface","flags":{"isExported":true},"children":[{"id":43,"name":"object","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The object to validate."},"sources":[{"fileName":"aurelia-validation.d.ts","line":126,"character":14}],"type":{"type":"instrinct","name":"any"}},{"id":44,"name":"propertyName","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"comment":{"shortText":"The property to validate. Optional."},"sources":[{"fileName":"aurelia-validation.d.ts","line":130,"character":20}],"type":{"type":"instrinct","name":"any"}},{"id":45,"name":"rules","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"comment":{"shortText":"The rules to validate. Optional."},"sources":[{"fileName":"aurelia-validation.d.ts","line":134,"character":13}],"type":{"type":"instrinct","name":"any"}}],"groups":[{"title":"Properties","kind":1024,"children":[43,44,45]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":122,"character":40}]},{"id":370,"name":"ValidationMessages","kind":256,"kindString":"Interface","flags":{"isExported":true},"indexSignature":[{"id":371,"name":"__index","kind":8192,"kindString":"Index signature","flags":{},"parameters":[{"id":372,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"string"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":436,"character":39}]},{"id":38,"name":"ValidationRenderer","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Renders validation errors."},"children":[{"id":39,"name":"render","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":40,"name":"render","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Render the errors."},"parameters":[{"id":41,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The render instruction. Defines which errors to render and which\nerrors to unrender.\n"},"type":{"type":"reference","name":"RenderInstruction","id":34}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":116,"character":14}]}],"groups":[{"title":"Methods","kind":2048,"children":[39]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":110,"character":39}],"implementedBy":[{"type":"reference","name":"ValidationErrorsCustomAttribute","id":254}]},{"id":637,"name":"validateTrigger","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"Validation triggers."},"sources":[{"fileName":"aurelia-validation.d.ts","line":60,"character":32}],"type":{"type":"reflection","declaration":{"id":638,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":640,"name":"blur","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":62,"character":12}],"type":{"type":"instrinct","name":"number"}},{"id":641,"name":"change","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":63,"character":14}],"type":{"type":"instrinct","name":"number"}},{"id":642,"name":"changeOrBlur","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":64,"character":20}],"type":{"type":"instrinct","name":"number"}},{"id":639,"name":"manual","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":61,"character":14}],"type":{"type":"instrinct","name":"number"}}],"groups":[{"title":"Variables","kind":32,"children":[640,641,642,639]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":60,"character":33}]}}},{"id":653,"name":"validationMessages","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"Dictionary of validation messages. [messageKey]: messageExpression"},"sources":[{"fileName":"aurelia-validation.d.ts","line":442,"character":35}],"type":{"type":"reference","name":"ValidationMessages","id":370}},{"id":654,"name":"configure","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":655,"name":"configure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Configures the plugin."},"parameters":[{"id":656,"name":"frameworkConfig","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":657,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":658,"name":"container","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":792,"character":17}],"type":{"type":"reference","name":"Container"}},{"id":659,"name":"globalResources","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":793,"character":23}],"type":{"type":"reflection","declaration":{"id":660,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":661,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":662,"name":"resources","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"string"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":793,"character":24}]}}}],"groups":[{"title":"Variables","kind":32,"children":[658,659]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":791,"character":46}]}}},{"id":663,"name":"callback","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":664,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":665,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":666,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"AureliaValidationConfiguration","id":625}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":794,"character":17}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":791,"character":29}]},{"id":643,"name":"getPropertyInfo","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":644,"name":"getPropertyInfo","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Retrieves the object and property name for the specified expression."},"parameters":[{"id":645,"name":"expression","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The expression"},"type":{"type":"reference","name":"Expression"}},{"id":646,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The scope\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"union","types":[{"type":"reflection","declaration":{"id":647,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":648,"name":"object","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":73,"character":14}],"type":{"type":"reference","name":"Object"}},{"id":649,"name":"propertyName","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":74,"character":20}],"type":{"type":"instrinct","name":"string"}}],"groups":[{"title":"Variables","kind":32,"children":[648,649]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":72,"character":73}]}},{"type":"instrinct","name":"null"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":72,"character":35}]},{"id":650,"name":"isString","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":651,"name":"isString","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":652,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":407,"character":28}]}],"groups":[{"title":"Classes","kind":128,"children":[625,569,423,506,358,315,385,136,115,157,177,197,217,46,237,2,254,373,332,282,591,17]},{"title":"Interfaces","kind":256,"children":[327,31,34,251,297,294,42,370,38]},{"title":"Variables","kind":32,"children":[637,653]},{"title":"Functions","kind":64,"children":[654,643,650]}]} +{"name":"aurelia-validation","children":[{"id":671,"name":"\"aurelia-validation\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":672,"name":"AureliaValidationConfiguration","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Aurelia Validation Configuration API"},"children":[{"id":673,"name":"validatorType","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":846,"character":29}],"type":{"type":"instrinct","name":"any"}},{"id":681,"name":"apply","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":682,"name":"apply","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the configuration."},"parameters":[{"id":683,"name":"container","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Container"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":856,"character":13}]},{"id":674,"name":"customValidator","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":675,"name":"customValidator","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Use a custom Validator implementation."},"parameters":[{"id":676,"name":"type","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":677,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":678,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":679,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":680,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"reference","name":"__type","id":677}}],"sources":[{"fileName":"index.d.ts","line":850,"character":31}]}],"groups":[{"title":"Constructors","kind":512,"children":[678]}],"sources":[{"fileName":"index.d.ts","line":850,"character":29}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":850,"character":23}]}],"groups":[{"title":"Properties","kind":1024,"children":[673]},{"title":"Methods","kind":2048,"children":[681,674]}],"sources":[{"fileName":"index.d.ts","line":845,"character":47}]},{"id":684,"name":"configure","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":685,"name":"configure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Configures the plugin."},"parameters":[{"id":686,"name":"frameworkConfig","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":687,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":688,"name":"container","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":862,"character":17}],"type":{"type":"reference","name":"Container"}},{"id":689,"name":"globalResources","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":863,"character":23}],"type":{"type":"reflection","declaration":{"id":690,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":691,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":692,"name":"resources","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"string"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":863,"character":24}]}}}],"groups":[{"title":"Variables","kind":32,"children":[688,689]}],"sources":[{"fileName":"index.d.ts","line":861,"character":46}]}}},{"id":693,"name":"callback","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":694,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":695,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":696,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"AureliaValidationConfiguration","id":672}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":864,"character":17}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":861,"character":29}]}],"groups":[{"title":"Classes","kind":128,"children":[672]},{"title":"Functions","kind":64,"children":[684]}],"sources":[{"fileName":"index.d.ts","line":821,"character":35}]},{"id":25,"name":"\"controller-validate-result\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":26,"name":"ControllerValidateResult","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"The result of a call to the validation controller's validate method."},"children":[{"id":29,"name":"instruction","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"comment":{"shortText":"The instruction passed to the controller's validate method."},"sources":[{"fileName":"index.d.ts","line":63,"character":19}],"type":{"type":"reference","name":"ValidateInstruction","id":21}},{"id":28,"name":"results","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The validation result of every rule that was evaluated."},"sources":[{"fileName":"index.d.ts","line":59,"character":15}],"type":{"type":"reference","isArray":true,"name":"ValidateResult","id":3}},{"id":27,"name":"valid","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Whether validation passed."},"sources":[{"fileName":"index.d.ts","line":55,"character":13}],"type":{"type":"instrinct","name":"boolean"}}],"groups":[{"title":"Properties","kind":1024,"children":[29,28,27]}],"sources":[{"fileName":"index.d.ts","line":51,"character":45}]}],"groups":[{"title":"Interfaces","kind":256,"children":[26]}],"sources":[{"fileName":"index.d.ts","line":45,"character":43}]},{"id":327,"name":"\"implementation/rule\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":331,"name":"Rule","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"A rule definition. Associations a rule with a property or object."},"typeParameter":[{"id":332,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":333,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":335,"name":"condition","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":423,"character":17}],"type":{"type":"reflection","declaration":{"id":336,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":337,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":338,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":339,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"index.d.ts","line":423,"character":18}]}}},{"id":340,"name":"config","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":424,"character":14}],"type":{"type":"reference","name":"Object"}},{"id":346,"name":"message","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":429,"character":15}],"type":{"type":"union","types":[{"type":"reference","name":"Expression"},{"type":"instrinct","name":"null"}]}},{"id":345,"name":"messageKey","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":428,"character":18}],"type":{"type":"instrinct","name":"string"}},{"id":334,"name":"property","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":422,"character":16}],"type":{"type":"reference","name":"RuleProperty","id":328}},{"id":347,"name":"sequence","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":430,"character":16}],"type":{"type":"instrinct","name":"number"}},{"id":348,"name":"tag","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"sources":[{"fileName":"index.d.ts","line":431,"character":11}],"type":{"type":"instrinct","name":"string"}},{"id":341,"name":"when","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":425,"character":12}],"type":{"type":"union","types":[{"type":"reflection","declaration":{"id":342,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":343,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":344,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"index.d.ts","line":425,"character":13}]}},{"type":"instrinct","name":"null"}]}}],"groups":[{"title":"Properties","kind":1024,"children":[335,340,346,345,334,347,348,341]}],"sources":[{"fileName":"index.d.ts","line":421,"character":25}]},{"id":328,"name":"RuleProperty","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Information related to a property that is the subject of validation."},"children":[{"id":330,"name":"displayName","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The displayName of the property (or object)."},"sources":[{"fileName":"index.d.ts","line":416,"character":19}],"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}},{"id":329,"name":"name","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The property name. null indicates the rule targets the object itself."},"sources":[{"fileName":"index.d.ts","line":412,"character":12}],"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}}],"groups":[{"title":"Properties","kind":1024,"children":[330,329]}],"sources":[{"fileName":"index.d.ts","line":408,"character":33}]}],"groups":[{"title":"Interfaces","kind":256,"children":[331,328]}],"sources":[{"fileName":"index.d.ts","line":403,"character":36}]},{"id":349,"name":"\"implementation/rules\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":350,"name":"Rules","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Sets, unsets and retrieves rules on an object or constructor function."},"children":[{"id":351,"name":"key","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isPrivate":true,"isExported":true},"comment":{"shortText":"The name of the property that stores the rules."},"sources":[{"fileName":"index.d.ts","line":443,"character":26}],"type":{"type":"instrinct","name":"any"}},{"id":359,"name":"get","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":360,"name":"get","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Retrieves the target's rules."},"parameters":[{"id":361,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"union","types":[{"type":"reference","isArray":true,"name":"Rule","id":331,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]},{"type":"instrinct","name":"null"}]}}],"sources":[{"fileName":"index.d.ts","line":455,"character":18}]},{"id":352,"name":"set","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":353,"name":"set","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the rules to a target."},"parameters":[{"id":354,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":355,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","isArray":true,"name":"Rule","id":331,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":447,"character":18}]},{"id":356,"name":"unset","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":357,"name":"unset","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes rules from a target."},"parameters":[{"id":358,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":451,"character":20}]}],"groups":[{"title":"Properties","kind":1024,"children":[351]},{"title":"Methods","kind":2048,"children":[359,352,356]}],"sources":[{"fileName":"index.d.ts","line":439,"character":22}]}],"groups":[{"title":"Classes","kind":128,"children":[350]}],"sources":[{"fileName":"index.d.ts","line":434,"character":37}]},{"id":428,"name":"\"implementation/standard-validator\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":429,"name":"StandardValidator","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Validates.\nResponsible for validating objects and properties."},"children":[{"id":434,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":435,"name":"new StandardValidator","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":436,"name":"messageProvider","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationMessageProvider","id":414}},{"id":437,"name":"resources","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ViewResources"}}],"type":{"type":"reference","name":"StandardValidator","id":429}}],"sources":[{"fileName":"index.d.ts","line":534,"character":31}]},{"id":433,"name":"getDisplayName","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":534,"character":30}],"type":{"type":"instrinct","name":"any"}},{"id":432,"name":"lookupFunctions","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":533,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":431,"name":"messageProvider","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":532,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":430,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":531,"character":21}],"type":{"type":"union","isArray":true,"types":[{"type":"reference","name":"ViewResources"},{"type":"reference","name":"ValidationMessageProvider","id":414}]}},{"id":451,"name":"getMessage","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":452,"name":"getMessage","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":453,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":454,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":455,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":557,"character":26}]},{"id":447,"name":"ruleExists","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":448,"name":"ruleExists","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Determines whether a rule exists in a set of rules.","tags":[{"tag":"parem","text":"rule The rule to find.\n"}]},"parameters":[{"id":449,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rules to search."},"type":{"type":"reference","isArray":true,"name":"Rule","id":331,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}},{"id":450,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Rule","id":331,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}}],"type":{"type":"instrinct","name":"boolean"},"overwrites":{"type":"reference","name":"Validator.ruleExists","id":49}}],"sources":[{"fileName":"index.d.ts","line":556,"character":18}],"overwrites":{"type":"reference","name":"Validator.ruleExists","id":49}},{"id":463,"name":"validate","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":464,"name":"validate","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":465,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":466,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":467,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":559,"character":24}]},{"id":443,"name":"validateObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":444,"name":"validateObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates all rules for specified object and it's properties."},"parameters":[{"id":445,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":446,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. If unspecified, the rules will be looked up using the metadata\nfor the object created by ValidationRules....on(class/object)\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","isArray":true,"name":"ValidateResult","id":3}]},"overwrites":{"type":"reference","name":"Validator.validateObject","id":45}}],"sources":[{"fileName":"index.d.ts","line":550,"character":22}],"overwrites":{"type":"reference","name":"Validator.validateObject","id":45}},{"id":438,"name":"validateProperty","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":439,"name":"validateProperty","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates the specified property."},"parameters":[{"id":440,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":441,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the property to validate."},"type":{"type":"instrinct","name":"string"}},{"id":442,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. If unspecified, the rules will be looked up using the metadata\nfor the object created by ValidationRules....on(class/object)\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","isArray":true,"name":"ValidateResult","id":3}]},"overwrites":{"type":"reference","name":"Validator.validateProperty","id":40}}],"sources":[{"fileName":"index.d.ts","line":543,"character":24}],"overwrites":{"type":"reference","name":"Validator.validateProperty","id":40}},{"id":456,"name":"validateRuleSequence","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":457,"name":"validateRuleSequence","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":458,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":459,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":460,"name":"ruleSequence","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":461,"name":"sequence","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":462,"name":"results","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":558,"character":36}]}],"groups":[{"title":"Constructors","kind":512,"children":[434]},{"title":"Properties","kind":1024,"children":[433,432,431,430]},{"title":"Methods","kind":2048,"children":[451,447,463,443,438,456]}],"sources":[{"fileName":"index.d.ts","line":530,"character":34}],"extendedTypes":[{"type":"reference","name":"Validator","id":39}]}],"groups":[{"title":"Classes","kind":128,"children":[429]}],"sources":[{"fileName":"index.d.ts","line":520,"character":50}]},{"id":362,"name":"\"implementation/util\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":363,"name":"isString","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":364,"name":"isString","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":365,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"index.d.ts","line":459,"character":28}]}],"groups":[{"title":"Functions","kind":64,"children":[363]}],"sources":[{"fileName":"index.d.ts","line":458,"character":36}]},{"id":410,"name":"\"implementation/validation-messages\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":414,"name":"ValidationMessageProvider","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Retrieves validation messages and property display names."},"children":[{"id":417,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":418,"name":"new ValidationMessageProvider","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":419,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":372}}],"type":{"type":"reference","name":"ValidationMessageProvider","id":414}}],"sources":[{"fileName":"index.d.ts","line":504,"character":49}]},{"id":415,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":503,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":416,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":504,"character":21}],"type":{"type":"reference","isArray":true,"name":"ValidationParser","id":372}},{"id":423,"name":"getDisplayName","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":424,"name":"getDisplayName","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Formulates a property display name using the property name and the configured\ndisplayName (if provided).\nOverride this with your own custom logic."},"parameters":[{"id":425,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The property name.\n"},"type":{"type":"instrinct","name":"string"}},{"id":426,"name":"displayName","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"},{"type":"instrinct","name":"undefined"}]}}],"type":{"type":"instrinct","name":"string"}}],"sources":[{"fileName":"index.d.ts","line":517,"character":22}]},{"id":420,"name":"getMessage","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":421,"name":"getMessage","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Returns a message binding expression that corresponds to the key."},"parameters":[{"id":422,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message key.\n"},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Expression"}}],"sources":[{"fileName":"index.d.ts","line":510,"character":18}]}],"groups":[{"title":"Constructors","kind":512,"children":[417]},{"title":"Properties","kind":1024,"children":[415,416]},{"title":"Methods","kind":2048,"children":[423,420]}],"sources":[{"fileName":"index.d.ts","line":502,"character":42}]},{"id":411,"name":"ValidationMessages","kind":256,"kindString":"Interface","flags":{"isExported":true},"indexSignature":[{"id":412,"name":"__index","kind":8192,"kindString":"Index signature","flags":{},"parameters":[{"id":413,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"string"}}],"sources":[{"fileName":"index.d.ts","line":492,"character":39}]},{"id":427,"name":"validationMessages","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"Dictionary of validation messages. [messageKey]: messageExpression"},"sources":[{"fileName":"index.d.ts","line":498,"character":35}],"type":{"type":"reference","name":"ValidationMessages","id":411}}],"groups":[{"title":"Classes","kind":128,"children":[414]},{"title":"Interfaces","kind":256,"children":[411]},{"title":"Variables","kind":32,"children":[427]}],"sources":[{"fileName":"index.d.ts","line":489,"character":51}]},{"id":366,"name":"\"implementation/validation-parser\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":398,"name":"MessageExpressionValidator","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":404,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":405,"name":"new MessageExpressionValidator","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":406,"name":"originalMessage","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"MessageExpressionValidator","id":398},"overwrites":{"type":"reference","name":"Unparser.__constructor"}}],"sources":[{"fileName":"index.d.ts","line":484,"character":79}],"overwrites":{"type":"reference","name":"Unparser.__constructor"}},{"id":399,"name":"originalMessage","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":483,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":407,"name":"visitAccessScope","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":408,"name":"visitAccessScope","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":409,"name":"access","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"AccessScope"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":486,"character":24}]},{"id":400,"name":"validate","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":401,"name":"validate","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":402,"name":"expression","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Expression"}},{"id":403,"name":"originalMessage","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":484,"character":23}]}],"groups":[{"title":"Constructors","kind":512,"children":[404]},{"title":"Properties","kind":1024,"children":[399]},{"title":"Methods","kind":2048,"children":[407,400]}],"sources":[{"fileName":"index.d.ts","line":482,"character":43}],"extendedTypes":[{"type":"reference","name":"Unparser"}],"implementedTypes":[{"type":"reference","name":"ExpressionVisitor"}]},{"id":372,"name":"ValidationParser","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":380,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":381,"name":"new ValidationParser","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":382,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Parser"}},{"id":383,"name":"bindinqLanguage","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"BindingLanguage"}}],"type":{"type":"reference","name":"ValidationParser","id":372}}],"sources":[{"fileName":"index.d.ts","line":475,"character":22}]},{"id":374,"name":"bindinqLanguage","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":470,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":379,"name":"cache","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":475,"character":21}],"type":{"type":"instrinct","name":"any"}},{"id":376,"name":"emptyStringExpression","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":472,"character":37}],"type":{"type":"instrinct","name":"any"}},{"id":377,"name":"nullExpression","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":473,"character":30}],"type":{"type":"instrinct","name":"any"}},{"id":373,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":469,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":378,"name":"undefinedExpression","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":474,"character":35}],"type":{"type":"instrinct","name":"any"}},{"id":375,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":471,"character":21}],"type":{"type":"union","isArray":true,"types":[{"type":"reference","name":"Parser"},{"type":"reference","name":"BindingLanguage"}]}},{"id":392,"name":"coalesce","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":393,"name":"coalesce","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":394,"name":"part","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":479,"character":24}]},{"id":395,"name":"getAccessorExpression","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":396,"name":"getAccessorExpression","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":397,"name":"fn","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":480,"character":37}]},{"id":384,"name":"parseMessage","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":385,"name":"parseMessage","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":386,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Expression"}}],"sources":[{"fileName":"index.d.ts","line":477,"character":20}]},{"id":387,"name":"parseProperty","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":388,"name":"parseProperty","kind":4096,"kindString":"Call signature","flags":{},"typeParameter":[{"id":389,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":390,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":391,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"reference","name":"PropertyAccessor","id":367,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}]}}],"type":{"type":"reference","name":"RuleProperty","id":328}}],"sources":[{"fileName":"index.d.ts","line":478,"character":21}]}],"groups":[{"title":"Constructors","kind":512,"children":[380]},{"title":"Properties","kind":1024,"children":[374,379,376,377,373,378,375]},{"title":"Methods","kind":2048,"children":[392,395,384,387]}],"sources":[{"fileName":"index.d.ts","line":468,"character":33}]},{"id":367,"name":"PropertyAccessor","kind":256,"kindString":"Interface","flags":{"isExported":true},"typeParameter":[{"id":368,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":369,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"signatures":[{"id":370,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":371,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"typeParameter","name":"TValue"}}],"sources":[{"fileName":"index.d.ts","line":465,"character":37}]}],"groups":[{"title":"Classes","kind":128,"children":[398,372]},{"title":"Interfaces","kind":256,"children":[367]}],"sources":[{"fileName":"index.d.ts","line":461,"character":49}]},{"id":468,"name":"\"implementation/validation-rules\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":616,"name":"FluentEnsure","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Part of the fluent rule API. Enables targeting properties and objects with rules."},"typeParameter":[{"id":617,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":620,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":621,"name":"new FluentEnsure","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":622,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":372}}],"type":{"type":"reference","name":"FluentEnsure","id":616}}],"sources":[{"fileName":"index.d.ts","line":761,"character":38}]},{"id":618,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":757,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":619,"name":"rules","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Rules that have been defined using the fluent API."},"sources":[{"fileName":"index.d.ts","line":761,"character":13}],"type":{"type":"reference","isArray":true,"name":"Rule","id":331,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"instrinct","name":"any"}]}},{"id":632,"name":"_addRule","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":633,"name":"_addRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a rule definition to the sequenced ruleset."},"parameters":[{"id":634,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Rule","id":331,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"instrinct","name":"any"}]}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":781,"character":16}]},{"id":635,"name":"assertInitialized","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":636,"name":"assertInitialized","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":782,"character":33}]},{"id":623,"name":"ensure","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":624,"name":"ensure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Target a property with validation rules."},"typeParameter":[{"id":625,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":626,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The property to target. Can be the property name or a property accessor\nfunction.\n"},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"reference","name":"PropertyAccessor","id":367,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}]}}],"type":{"type":"reference","name":"FluentRules","id":552,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":768,"character":14}]},{"id":627,"name":"ensureObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":628,"name":"ensureObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Targets an object with validation rules."},"type":{"type":"reference","name":"FluentRules","id":552,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"index.d.ts","line":772,"character":20}]},{"id":629,"name":"on","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":630,"name":"on","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the rules to a class or object, making them discoverable by the StandardValidator."},"parameters":[{"id":631,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A class or object.\n"},"type":{"type":"instrinct","name":"any"}}]}],"sources":[{"fileName":"index.d.ts","line":777,"character":10}]}],"groups":[{"title":"Constructors","kind":512,"children":[620]},{"title":"Properties","kind":1024,"children":[618,619]},{"title":"Methods","kind":2048,"children":[632,635,623,627,629]}],"sources":[{"fileName":"index.d.ts","line":756,"character":29}]},{"id":469,"name":"FluentRuleCustomizer","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Part of the fluent rule API. Enables customizing property rules."},"typeParameter":[{"id":470,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":471,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":476,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":477,"name":"new FluentRuleCustomizer","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":478,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RuleProperty","id":328}},{"id":479,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":480,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":481,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":482,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":483,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"index.d.ts","line":573,"character":54}]}}},{"id":484,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Object"}},{"id":485,"name":"fluentEnsure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FluentEnsure","id":616,"typeArguments":[{"type":"typeParameter","name":"TObject"}]}},{"id":486,"name":"fluentRules","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FluentRules","id":552,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}},{"id":487,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":372}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469}}],"sources":[{"fileName":"index.d.ts","line":572,"character":21}]},{"id":472,"name":"fluentEnsure","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":569,"character":28}],"type":{"type":"instrinct","name":"any"}},{"id":473,"name":"fluentRules","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":570,"character":27}],"type":{"type":"instrinct","name":"any"}},{"id":474,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":571,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":475,"name":"rule","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":572,"character":20}],"type":{"type":"instrinct","name":"any"}},{"id":514,"name":"rules","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Rules that have been defined using the fluent API."},"sources":[{"fileName":"index.d.ts","line":613,"character":22}],"type":{"type":"reference","isArray":true,"name":"Rule","id":331,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"instrinct","name":"any"}]}},{"id":535,"name":"email","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":536,"name":"email","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"email\" rule to the property.\nnull, undefined and empty-string values are considered valid."},"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":647,"character":13}]},{"id":505,"name":"ensure","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":506,"name":"ensure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Target a property with validation rules."},"typeParameter":[{"id":507,"name":"TValue2","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":508,"name":"subject","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"reflection","declaration":{"id":509,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":510,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":511,"name":"model","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"typeParameter","name":"TValue2"}}],"sources":[{"fileName":"index.d.ts","line":603,"character":41}]}}]}}],"type":{"type":"reference","name":"FluentRules","id":552,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue2"}]}}],"sources":[{"fileName":"index.d.ts","line":603,"character":14}]},{"id":512,"name":"ensureObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":513,"name":"ensureObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Targets an object with validation rules."},"type":{"type":"reference","name":"FluentRules","id":552,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"index.d.ts","line":609,"character":20}]},{"id":549,"name":"equals","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":550,"name":"equals","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"equals\" validation rule to the property.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":551,"name":"expectedValue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":672,"character":14}]},{"id":532,"name":"matches","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":533,"name":"matches","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"matches\" rule to the property.\nValue must match the specified regular expression.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":534,"name":"regex","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RegExp"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":642,"character":15}]},{"id":546,"name":"maxItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":547,"name":"maxItems","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"maxItems\" ARRAY validation rule to the property.\nnull and undefined values are considered valid."},"parameters":[{"id":548,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":667,"character":16}]},{"id":540,"name":"maxLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":541,"name":"maxLength","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"maxLength\" STRING validation rule to the property.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":542,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":657,"character":17}]},{"id":543,"name":"minItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":544,"name":"minItems","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"minItems\" ARRAY validation rule to the property.\nnull and undefined values are considered valid."},"parameters":[{"id":545,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":662,"character":16}]},{"id":537,"name":"minLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":538,"name":"minLength","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"minLength\" STRING validation rule to the property.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":539,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":652,"character":17}]},{"id":515,"name":"on","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":516,"name":"on","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the rules to a class or object, making them discoverable by the StandardValidator."},"parameters":[{"id":517,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A class or object.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"FluentEnsure","id":616,"typeArguments":[{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"index.d.ts","line":618,"character":10}]},{"id":530,"name":"required","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":531,"name":"required","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"required\" rule to the property.\nThe value cannot be null, undefined or whitespace."},"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":636,"character":16}]},{"id":518,"name":"satisfies","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":519,"name":"satisfies","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies an ad-hoc rule function to the ensured property or object."},"parameters":[{"id":520,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function to validate the rule.\nWill be called with two arguments, the property value and the object.\nShould return a boolean or a Promise that resolves to a boolean.\n"},"type":{"type":"reflection","declaration":{"id":521,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":522,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":523,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":524,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"index.d.ts","line":625,"character":28}]}}},{"id":525,"name":"config","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Object"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":625,"character":17}]},{"id":526,"name":"satisfiesRule","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":527,"name":"satisfiesRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies a rule by name."},"parameters":[{"id":528,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the custom or standard rule."},"type":{"type":"instrinct","name":"string"}},{"id":529,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The rule's arguments.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":631,"character":21}]},{"id":502,"name":"tag","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":503,"name":"tag","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Tags the rule instance, enabling the rule to be found easily\nusing ValidationRules.taggedRules(rules, tag)"},"parameters":[{"id":504,"name":"tag","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"index.d.ts","line":598,"character":11}]},{"id":488,"name":"then","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":489,"name":"then","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validate subsequent rules after previously declared rules have\nbeen validated successfully. Use to postpone validation of costly\nrules until less expensive rules pass validation."}}],"sources":[{"fileName":"index.d.ts","line":579,"character":12}]},{"id":496,"name":"when","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":497,"name":"when","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Specifies a condition that must be met before attempting to validate the rule."},"parameters":[{"id":498,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A function that accepts the object as a parameter and returns true\nor false whether the rule should be evaluated.\n"},"type":{"type":"reflection","declaration":{"id":499,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":500,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":501,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"index.d.ts","line":593,"character":23}]}}}]}],"sources":[{"fileName":"index.d.ts","line":593,"character":12}]},{"id":493,"name":"withMessage","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":494,"name":"withMessage","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Specifies rule's validation message."},"parameters":[{"id":495,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"index.d.ts","line":587,"character":19}]},{"id":490,"name":"withMessageKey","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":491,"name":"withMessageKey","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Specifies the key to use when looking up the rule's validation message."},"parameters":[{"id":492,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"index.d.ts","line":583,"character":22}]}],"groups":[{"title":"Constructors","kind":512,"children":[476]},{"title":"Properties","kind":1024,"children":[472,473,474,475,514]},{"title":"Methods","kind":2048,"children":[535,505,512,549,532,546,540,543,537,515,530,518,526,502,488,496,493,490]}],"sources":[{"fileName":"index.d.ts","line":568,"character":37}]},{"id":552,"name":"FluentRules","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Part of the fluent rule API. Enables applying rules to properties and objects."},"typeParameter":[{"id":553,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":554,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":574,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":575,"name":"new FluentRules","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":576,"name":"fluentEnsure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FluentEnsure","id":616,"typeArguments":[{"type":"typeParameter","name":"TObject"}]}},{"id":577,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":372}},{"id":578,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RuleProperty","id":328}}],"type":{"type":"reference","name":"FluentRules","id":552}}],"sources":[{"fileName":"index.d.ts","line":692,"character":25}]},{"id":555,"name":"fluentEnsure","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":678,"character":28}],"type":{"type":"instrinct","name":"any"}},{"id":556,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":679,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":557,"name":"property","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":680,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":573,"name":"sequence","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Current rule sequence number. Used to postpone evaluation of rules until rules\nwith lower sequence number have successfully validated. The \"then\" fluent API method\nmanages this property, there's usually no need to set it directly."},"sources":[{"fileName":"index.d.ts","line":692,"character":16}],"type":{"type":"instrinct","name":"number"}},{"id":558,"name":"customRules","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":681,"character":26}],"type":{"type":"reflection","declaration":{"id":559,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"indexSignature":[{"id":560,"name":"__index","kind":8192,"kindString":"Index signature","flags":{},"parameters":[{"id":561,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reflection","declaration":{"id":562,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":569,"name":"argsToConfig","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"index.d.ts","line":684,"character":28}],"type":{"type":"reflection","declaration":{"id":570,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":571,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":572,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":684,"character":30}]}}},{"id":563,"name":"condition","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":683,"character":25}],"type":{"type":"reflection","declaration":{"id":564,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":565,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":566,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":567,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}},{"id":568,"name":"fluentArgs","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"index.d.ts","line":683,"character":26}]}}}],"groups":[{"title":"Variables","kind":32,"children":[569,563]}],"sources":[{"fileName":"index.d.ts","line":682,"character":27}]}}}],"sources":[{"fileName":"index.d.ts","line":681,"character":27}]}}},{"id":579,"name":"displayName","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":580,"name":"displayName","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets the display name of the ensured property."},"parameters":[{"id":581,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"index.d.ts","line":697,"character":19}]},{"id":599,"name":"email","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":600,"name":"email","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"email\" rule to the property.\nnull, undefined and empty-string values are considered valid."},"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":726,"character":13}]},{"id":613,"name":"equals","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":614,"name":"equals","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"equals\" validation rule to the property.\nnull and undefined values are considered valid."},"parameters":[{"id":615,"name":"expectedValue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":751,"character":14}]},{"id":596,"name":"matches","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":597,"name":"matches","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"matches\" rule to the property.\nValue must match the specified regular expression.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":598,"name":"regex","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RegExp"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":721,"character":15}]},{"id":610,"name":"maxItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":611,"name":"maxItems","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"maxItems\" ARRAY validation rule to the property.\nnull and undefined values are considered valid."},"parameters":[{"id":612,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":746,"character":16}]},{"id":604,"name":"maxLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":605,"name":"maxLength","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"maxLength\" STRING validation rule to the property.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":606,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":736,"character":17}]},{"id":607,"name":"minItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":608,"name":"minItems","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"minItems\" ARRAY validation rule to the property.\nnull and undefined values are considered valid."},"parameters":[{"id":609,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":741,"character":16}]},{"id":601,"name":"minLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":602,"name":"minLength","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"minLength\" STRING validation rule to the property.\nnull, undefined and empty-string values are considered valid."},"parameters":[{"id":603,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":731,"character":17}]},{"id":594,"name":"required","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":595,"name":"required","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the \"required\" rule to the property.\nThe value cannot be null, undefined or whitespace."},"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":715,"character":16}]},{"id":582,"name":"satisfies","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":583,"name":"satisfies","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies an ad-hoc rule function to the ensured property or object."},"parameters":[{"id":584,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function to validate the rule.\nWill be called with two arguments, the property value and the object.\nShould return a boolean or a Promise that resolves to a boolean.\n"},"type":{"type":"reflection","declaration":{"id":585,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":586,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":587,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":588,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"index.d.ts","line":704,"character":28}]}}},{"id":589,"name":"config","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Object"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":704,"character":17}]},{"id":590,"name":"satisfiesRule","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":591,"name":"satisfiesRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies a rule by name."},"parameters":[{"id":592,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the custom or standard rule."},"type":{"type":"instrinct","name":"string"}},{"id":593,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The rule's arguments.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":469,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":710,"character":21}]}],"groups":[{"title":"Constructors","kind":512,"children":[574]},{"title":"Properties","kind":1024,"children":[555,556,557,573,558]},{"title":"Methods","kind":2048,"children":[579,599,613,596,610,604,607,601,594,582,590]}],"sources":[{"fileName":"index.d.ts","line":677,"character":28}]},{"id":637,"name":"ValidationRules","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Fluent rule definition API."},"children":[{"id":638,"name":"parser","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":788,"character":29}],"type":{"type":"instrinct","name":"any"}},{"id":650,"name":"customRule","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":651,"name":"customRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Defines a custom rule."},"parameters":[{"id":652,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the custom rule. Also serves as the message key."},"type":{"type":"instrinct","name":"string"}},{"id":653,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rule function."},"type":{"type":"reflection","declaration":{"id":654,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":655,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":656,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":657,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}},{"id":658,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"union","types":[{"type":"instrinct","name":"boolean"},{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"boolean"}]}]}}],"sources":[{"fileName":"index.d.ts","line":807,"character":50}]}}},{"id":659,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message expression"},"type":{"type":"instrinct","name":"string"}},{"id":660,"name":"argsToConfig","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"A function that maps the rule's arguments to a \"config\"\nobject that can be used when evaluating the message expression.\n"},"type":{"type":"reflection","declaration":{"id":661,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":662,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":663,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":807,"character":156}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":807,"character":25}]},{"id":642,"name":"ensure","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":643,"name":"ensure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Target a property with validation rules."},"typeParameter":[{"id":644,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":645,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":646,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The property to target. Can be the property name or a property accessor function.\n"},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"reference","name":"PropertyAccessor","id":367,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}]}}],"type":{"type":"reference","name":"FluentRules","id":552,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"index.d.ts","line":794,"character":21}]},{"id":647,"name":"ensureObject","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":648,"name":"ensureObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Targets an object with validation rules."},"typeParameter":[{"id":649,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}}],"type":{"type":"reference","name":"FluentRules","id":552,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"index.d.ts","line":798,"character":27}]},{"id":639,"name":"initialize","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":640,"name":"initialize","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":641,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":372}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":789,"character":25}]},{"id":668,"name":"off","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":669,"name":"off","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes the rules from a class or object."},"parameters":[{"id":670,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"A class or object.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":818,"character":18}]},{"id":664,"name":"taggedRules","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":665,"name":"taggedRules","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Returns rules with the matching tag."},"parameters":[{"id":666,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rules to search."},"type":{"type":"reference","isArray":true,"name":"Rule","id":331,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}},{"id":667,"name":"tag","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The tag to search for.\n"},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","isArray":true,"name":"Rule","id":331,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}}],"sources":[{"fileName":"index.d.ts","line":813,"character":26}]}],"groups":[{"title":"Properties","kind":1024,"children":[638]},{"title":"Methods","kind":2048,"children":[650,642,647,639,668,664]}],"sources":[{"fileName":"index.d.ts","line":787,"character":32}]}],"groups":[{"title":"Classes","kind":128,"children":[616,469,552,637]}],"sources":[{"fileName":"index.d.ts","line":562,"character":48}]},{"id":30,"name":"\"property-info\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":31,"name":"getPropertyInfo","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":32,"name":"getPropertyInfo","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Retrieves the object and property name for the specified expression."},"parameters":[{"id":33,"name":"expression","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The expression"},"type":{"type":"reference","name":"Expression"}},{"id":34,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The scope\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"union","types":[{"type":"reflection","declaration":{"id":35,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":36,"name":"object","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":74,"character":14}],"type":{"type":"reference","name":"Object"}},{"id":37,"name":"propertyName","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":75,"character":20}],"type":{"type":"instrinct","name":"string"}}],"groups":[{"title":"Variables","kind":32,"children":[36,37]}],"sources":[{"fileName":"index.d.ts","line":73,"character":73}]}},{"type":"instrinct","name":"null"}]}}],"sources":[{"fileName":"index.d.ts","line":73,"character":35}]}],"groups":[{"title":"Functions","kind":64,"children":[31]}],"sources":[{"fileName":"index.d.ts","line":66,"character":30}]},{"id":165,"name":"\"validate-binding-behavior\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":166,"name":"ValidateBindingBehavior","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property should be validated\nwhen the validate trigger specified by the associated controller's\nvalidateTrigger property occurs."},"children":[{"id":171,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":172,"name":"new ValidateBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":173,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateBindingBehavior","id":166},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":146}}],"sources":[{"fileName":"index.d.ts","line":279,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":146}},{"id":167,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":303,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":178,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":179,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":180,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":181,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":182,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":73},{"type":"instrinct","name":"any"}]}},{"id":183,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":156}}],"sources":[{"fileName":"index.d.ts","line":289,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":156}},{"id":174,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":175,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":176,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":177,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":152}}],"sources":[{"fileName":"index.d.ts","line":288,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":152}},{"id":168,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":169,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":170,"name":"controller","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationController","id":73}}],"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":149}}],"sources":[{"fileName":"index.d.ts","line":304,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":149}},{"id":184,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":185,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":186,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":162}}],"sources":[{"fileName":"index.d.ts","line":290,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":162}}],"groups":[{"title":"Constructors","kind":512,"children":[171]},{"title":"Properties","kind":1024,"children":[167]},{"title":"Methods","kind":2048,"children":[178,174,168,184]}],"sources":[{"fileName":"index.d.ts","line":302,"character":40}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":144}]},{"id":187,"name":"ValidateManuallyBindingBehavior","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property will be validated\nmanually, by calling controller.validate(). No automatic validation\ntriggered by data-entry or blur will occur."},"children":[{"id":191,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":192,"name":"new ValidateManuallyBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":193,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateManuallyBindingBehavior","id":187},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":146}}],"sources":[{"fileName":"index.d.ts","line":279,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":146}},{"id":188,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":312,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":198,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":199,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":200,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":201,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":202,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":73},{"type":"instrinct","name":"any"}]}},{"id":203,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":156}}],"sources":[{"fileName":"index.d.ts","line":289,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":156}},{"id":194,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":195,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":196,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":197,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":152}}],"sources":[{"fileName":"index.d.ts","line":288,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":152}},{"id":189,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":190,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":149}}],"sources":[{"fileName":"index.d.ts","line":313,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":149}},{"id":204,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":205,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":206,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":162}}],"sources":[{"fileName":"index.d.ts","line":290,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":162}}],"groups":[{"title":"Constructors","kind":512,"children":[191]},{"title":"Properties","kind":1024,"children":[188]},{"title":"Methods","kind":2048,"children":[198,194,189,204]}],"sources":[{"fileName":"index.d.ts","line":311,"character":48}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":144}]},{"id":207,"name":"ValidateOnBlurBindingBehavior","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property should be validated\nwhen the associated element blurs."},"children":[{"id":211,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":212,"name":"new ValidateOnBlurBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":213,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateOnBlurBindingBehavior","id":207},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":146}}],"sources":[{"fileName":"index.d.ts","line":279,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":146}},{"id":208,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":320,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":218,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":219,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":220,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":221,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":222,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":73},{"type":"instrinct","name":"any"}]}},{"id":223,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":156}}],"sources":[{"fileName":"index.d.ts","line":289,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":156}},{"id":214,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":215,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":216,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":217,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":152}}],"sources":[{"fileName":"index.d.ts","line":288,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":152}},{"id":209,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":210,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":149}}],"sources":[{"fileName":"index.d.ts","line":321,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":149}},{"id":224,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":225,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":226,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":162}}],"sources":[{"fileName":"index.d.ts","line":290,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":162}}],"groups":[{"title":"Constructors","kind":512,"children":[211]},{"title":"Properties","kind":1024,"children":[208]},{"title":"Methods","kind":2048,"children":[218,214,209,224]}],"sources":[{"fileName":"index.d.ts","line":319,"character":46}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":144}]},{"id":227,"name":"ValidateOnChangeBindingBehavior","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property should be validated\nwhen the associated element is changed by the user, causing a change\nto the model."},"children":[{"id":231,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":232,"name":"new ValidateOnChangeBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":233,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateOnChangeBindingBehavior","id":227},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":146}}],"sources":[{"fileName":"index.d.ts","line":279,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":146}},{"id":228,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":329,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":238,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":239,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":240,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":241,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":242,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":73},{"type":"instrinct","name":"any"}]}},{"id":243,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":156}}],"sources":[{"fileName":"index.d.ts","line":289,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":156}},{"id":234,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":235,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":236,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":237,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":152}}],"sources":[{"fileName":"index.d.ts","line":288,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":152}},{"id":229,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":230,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":149}}],"sources":[{"fileName":"index.d.ts","line":330,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":149}},{"id":244,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":245,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":246,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":162}}],"sources":[{"fileName":"index.d.ts","line":290,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":162}}],"groups":[{"title":"Constructors","kind":512,"children":[231]},{"title":"Properties","kind":1024,"children":[228]},{"title":"Methods","kind":2048,"children":[238,234,229,244]}],"sources":[{"fileName":"index.d.ts","line":328,"character":48}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":144}]},{"id":247,"name":"ValidateOnChangeOrBlurBindingBehavior","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property should be validated\nwhen the associated element blurs or is changed by the user, causing\na change to the model."},"children":[{"id":251,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":252,"name":"new ValidateOnChangeOrBlurBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":253,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateOnChangeOrBlurBindingBehavior","id":247},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":146}}],"sources":[{"fileName":"index.d.ts","line":279,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":146}},{"id":248,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":338,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":258,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":259,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":260,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":261,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":262,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":73},{"type":"instrinct","name":"any"}]}},{"id":263,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":156}}],"sources":[{"fileName":"index.d.ts","line":289,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":156}},{"id":254,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":255,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":256,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":257,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":152}}],"sources":[{"fileName":"index.d.ts","line":288,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":152}},{"id":249,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":250,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":149}}],"sources":[{"fileName":"index.d.ts","line":339,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":149}},{"id":264,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":265,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":266,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":162}}],"sources":[{"fileName":"index.d.ts","line":290,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":162}}],"groups":[{"title":"Constructors","kind":512,"children":[251]},{"title":"Properties","kind":1024,"children":[248]},{"title":"Methods","kind":2048,"children":[258,254,249,264]}],"sources":[{"fileName":"index.d.ts","line":337,"character":54}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":144}]}],"groups":[{"title":"Classes","kind":128,"children":[166,187,207,227,247]}],"sources":[{"fileName":"index.d.ts","line":293,"character":42}]},{"id":143,"name":"\"validate-binding-behavior-base\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":144,"name":"ValidateBindingBehaviorBase","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property should be validated."},"children":[{"id":146,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":147,"name":"new ValidateBindingBehaviorBase","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":148,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateBindingBehaviorBase","id":144}}],"sources":[{"fileName":"index.d.ts","line":279,"character":26}]},{"id":145,"name":"taskQueue","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":279,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":156,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":157,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":158,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":159,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":160,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":73},{"type":"instrinct","name":"any"}]}},{"id":161,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":289,"character":12}]},{"id":152,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":153,"name":"getTarget","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the DOM element associated with the data-binding. Most of the time it's\nthe binding.target but sometimes binding.target is an aurelia custom element,\nor custom attribute which is a javascript \"class\" instance, so we need to use\nthe controller's container to retrieve the actual DOM element."},"parameters":[{"id":154,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":155,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":288,"character":17}]},{"id":149,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true,"isProtected":true},"signatures":[{"id":150,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":151,"name":"controller","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationController","id":73}}],"type":{"type":"instrinct","name":"number"}}],"sources":[{"fileName":"index.d.ts","line":281,"character":45}]},{"id":162,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":163,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":164,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":290,"character":14}]}],"groups":[{"title":"Constructors","kind":512,"children":[146]},{"title":"Properties","kind":1024,"children":[145]},{"title":"Methods","kind":2048,"children":[156,152,149,162]}],"sources":[{"fileName":"index.d.ts","line":278,"character":53}],"extendedBy":[{"type":"reference","name":"ValidateBindingBehavior","id":166},{"type":"reference","name":"ValidateManuallyBindingBehavior","id":187},{"type":"reference","name":"ValidateOnBlurBindingBehavior","id":207},{"type":"reference","name":"ValidateOnChangeBindingBehavior","id":227},{"type":"reference","name":"ValidateOnChangeOrBlurBindingBehavior","id":247}]}],"groups":[{"title":"Classes","kind":128,"children":[144]}],"sources":[{"fileName":"index.d.ts","line":272,"character":47}]},{"id":20,"name":"\"validate-instruction\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":21,"name":"ValidateInstruction","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Instructions for the validation controller's validate method."},"children":[{"id":22,"name":"object","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The object to validate."},"sources":[{"fileName":"index.d.ts","line":34,"character":14}],"type":{"type":"instrinct","name":"any"}},{"id":23,"name":"propertyName","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"comment":{"shortText":"The property to validate. Optional."},"sources":[{"fileName":"index.d.ts","line":38,"character":20}],"type":{"type":"instrinct","name":"any"}},{"id":24,"name":"rules","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"comment":{"shortText":"The rules to validate. Optional."},"sources":[{"fileName":"index.d.ts","line":42,"character":13}],"type":{"type":"instrinct","name":"any"}}],"groups":[{"title":"Properties","kind":1024,"children":[22,23,24]}],"sources":[{"fileName":"index.d.ts","line":30,"character":40}]}],"groups":[{"title":"Interfaces","kind":256,"children":[21]}],"sources":[{"fileName":"index.d.ts","line":26,"character":37}]},{"id":2,"name":"\"validate-result\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":3,"name":"ValidateResult","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"The result of validating an individual validation rule."},"children":[{"id":11,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{},"signatures":[{"id":12,"name":"new ValidateResult","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{},"parameters":[{"id":13,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The rule associated with the result. Validator implementation specific."},"type":{"type":"instrinct","name":"any"}},{"id":14,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The object that was validated."},"type":{"type":"instrinct","name":"any"}},{"id":15,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The name of the property that was validated."},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}},{"id":16,"name":"valid","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"boolean"}},{"id":17,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}}],"type":{"type":"reference","name":"ValidateResult","id":3}}],"sources":[{"fileName":"index.d.ts","line":15,"character":19}]},{"id":10,"name":"id","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"A number that uniquely identifies the result instance."},"sources":[{"fileName":"index.d.ts","line":15,"character":10}],"type":{"type":"instrinct","name":"number"}},{"id":8,"name":"message","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":10,"character":15}],"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}},{"id":5,"name":"object","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":7,"character":14}],"type":{"type":"instrinct","name":"any"}},{"id":6,"name":"propertyName","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":8,"character":20}],"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}},{"id":4,"name":"rule","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":6,"character":12}],"type":{"type":"instrinct","name":"any"}},{"id":7,"name":"valid","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":9,"character":13}],"type":{"type":"instrinct","name":"boolean"}},{"id":9,"name":"nextId","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":11,"character":29}],"type":{"type":"instrinct","name":"any"}},{"id":18,"name":"toString","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":19,"name":"toString","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}}],"sources":[{"fileName":"index.d.ts","line":23,"character":16}]}],"groups":[{"title":"Constructors","kind":512,"children":[11]},{"title":"Properties","kind":1024,"children":[10,8,5,6,4,7,9]},{"title":"Methods","kind":2048,"children":[18]}],"sources":[{"fileName":"index.d.ts","line":5,"character":31}]}],"groups":[{"title":"Classes","kind":128,"children":[3]}],"sources":[{"fileName":"index.d.ts","line":1,"character":32}]},{"id":53,"name":"\"validate-trigger\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":54,"name":"validateTrigger","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"Validation triggers."},"sources":[{"fileName":"index.d.ts","line":111,"character":32}],"type":{"type":"reflection","declaration":{"id":55,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":57,"name":"blur","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":113,"character":12}],"type":{"type":"instrinct","name":"number"}},{"id":58,"name":"change","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":114,"character":14}],"type":{"type":"instrinct","name":"number"}},{"id":59,"name":"changeOrBlur","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":115,"character":20}],"type":{"type":"instrinct","name":"number"}},{"id":56,"name":"manual","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":112,"character":14}],"type":{"type":"instrinct","name":"number"}}],"groups":[{"title":"Variables","kind":32,"children":[57,58,59,56]}],"sources":[{"fileName":"index.d.ts","line":111,"character":33}]}}}],"groups":[{"title":"Variables","kind":32,"children":[54]}],"sources":[{"fileName":"index.d.ts","line":107,"character":33}]},{"id":72,"name":"\"validation-controller\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":73,"name":"ValidationController","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Orchestrates validation.\nManages a set of bindings, renderers and objects.\nExposes the current list of validation results for binding purposes."},"children":[{"id":85,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":86,"name":"new ValidationController","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":87,"name":"validator","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Validator","id":39}}],"type":{"type":"reference","name":"ValidationController","id":73}}],"sources":[{"fileName":"index.d.ts","line":197,"character":33}]},{"id":76,"name":"bindings","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":177,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":81,"name":"elements","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":191,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":79,"name":"errors","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Validation errors that have been rendered by the controller."},"sources":[{"fileName":"index.d.ts","line":186,"character":14}],"type":{"type":"reference","isArray":true,"name":"ValidateResult","id":3}},{"id":84,"name":"finishValidating","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":197,"character":32}],"type":{"type":"instrinct","name":"any"}},{"id":82,"name":"objects","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":192,"character":23}],"type":{"type":"instrinct","name":"any"}},{"id":77,"name":"renderers","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":178,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":78,"name":"results","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"comment":{"shortText":"Validation results that have been rendered by the controller."},"sources":[{"fileName":"index.d.ts","line":182,"character":23}],"type":{"type":"instrinct","name":"any"}},{"id":83,"name":"validateTrigger","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The trigger that will invoke automatic validation of a property used in a binding."},"sources":[{"fileName":"index.d.ts","line":196,"character":23}],"type":{"type":"instrinct","name":"number"}},{"id":80,"name":"validating","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":" Whether the controller is currently validating."},"sources":[{"fileName":"index.d.ts","line":190,"character":18}],"type":{"type":"instrinct","name":"boolean"}},{"id":74,"name":"validator","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":175,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":75,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":176,"character":21}],"type":{"type":"reference","isArray":true,"name":"Validator","id":39}},{"id":95,"name":"addError","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":96,"name":"addError","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds and renders an error."},"parameters":[{"id":97,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}},{"id":98,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":99,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}}],"type":{"type":"reference","name":"ValidateResult","id":3}}],"sources":[{"fileName":"index.d.ts","line":213,"character":16}]},{"id":88,"name":"addObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":89,"name":"addObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds an object to the set of objects that should be validated when validate is called."},"parameters":[{"id":90,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object."},"type":{"type":"instrinct","name":"any"}},{"id":91,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. The rules. If rules aren't supplied the Validator implementation will lookup the rules.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":204,"character":17}]},{"id":103,"name":"addRenderer","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":104,"name":"addRenderer","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a renderer."},"parameters":[{"id":105,"name":"renderer","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The renderer.\n"},"type":{"type":"reference","name":"ValidationRenderer","id":68}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":222,"character":19}]},{"id":126,"name":"getAssociatedElements","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":127,"name":"getAssociatedElements","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the elements associated with an object and propertyName (if any)."},"parameters":[{"id":128,"name":"__namedParameters","kind":32768,"kindString":"Parameter","flags":{},"originalName":"__0","type":{"type":"reflection","declaration":{"id":129,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":130,"name":"object","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":260,"character":45}],"type":{"type":"instrinct","name":"any"}},{"id":131,"name":"propertyName","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":260,"character":59}],"type":{"type":"instrinct","name":"any"}}],"groups":[{"title":"Variables","kind":32,"children":[130,131]}],"sources":[{"fileName":"index.d.ts","line":260,"character":38}]}}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":260,"character":37}]},{"id":117,"name":"getInstructionPredicate","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":118,"name":"getInstructionPredicate","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Interprets the instruction and returns a predicate that will identify\nrelevant results in the list of rendered validation results."},"parameters":[{"id":119,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":244,"character":39}]},{"id":132,"name":"processResultDelta","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":133,"name":"processResultDelta","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":134,"name":"kind","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":135,"name":"oldResults","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":136,"name":"newResults","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"index.d.ts","line":261,"character":34}]},{"id":109,"name":"registerBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":110,"name":"registerBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Registers a binding with the controller."},"parameters":[{"id":111,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The binding instance."},"type":{"type":"reference","name":"Binding"}},{"id":112,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The DOM element."},"type":{"type":"reference","name":"Element"}},{"id":113,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"(optional) rules associated with the binding. Validator implementation specific.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":234,"character":23}]},{"id":100,"name":"removeError","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":101,"name":"removeError","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes and unrenders an error."},"parameters":[{"id":102,"name":"result","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidateResult","id":3}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":217,"character":19}]},{"id":92,"name":"removeObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":93,"name":"removeObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes an object from the set of objects that should be validated when validate is called."},"parameters":[{"id":94,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":209,"character":20}]},{"id":106,"name":"removeRenderer","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":107,"name":"removeRenderer","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes a renderer."},"parameters":[{"id":108,"name":"renderer","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The renderer.\n"},"type":{"type":"reference","name":"ValidationRenderer","id":68}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":227,"character":22}]},{"id":123,"name":"reset","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":124,"name":"reset","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Resets any rendered validation results (unrenders)."},"parameters":[{"id":125,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. Instructions on what to reset. If unspecified all rendered results\nwill be unrendered.\n"},"type":{"type":"reference","name":"ValidateInstruction","id":21}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":256,"character":13}]},{"id":140,"name":"resetBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":141,"name":"resetBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Resets the results for a property associated with a binding."},"parameters":[{"id":142,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Binding"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":269,"character":20}]},{"id":114,"name":"unregisterBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":115,"name":"unregisterBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Unregisters a binding with the controller."},"parameters":[{"id":116,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The binding instance.\n"},"type":{"type":"reference","name":"Binding"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":239,"character":25}]},{"id":120,"name":"validate","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":121,"name":"validate","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates and renders results."},"parameters":[{"id":122,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. Instructions on what to validate. If undefined, all\nobjects and bindings will be validated.\n"},"type":{"type":"reference","name":"ValidateInstruction","id":21}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"ControllerValidateResult","id":26}]}}],"sources":[{"fileName":"index.d.ts","line":250,"character":16}]},{"id":137,"name":"validateBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":138,"name":"validateBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates the property associated with a binding."},"parameters":[{"id":139,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Binding"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":265,"character":23}]}],"groups":[{"title":"Constructors","kind":512,"children":[85]},{"title":"Properties","kind":1024,"children":[76,81,79,84,82,77,78,83,80,74,75]},{"title":"Methods","kind":2048,"children":[95,88,103,126,117,132,109,100,92,106,123,140,114,120,137]}],"sources":[{"fileName":"index.d.ts","line":174,"character":37}]}],"groups":[{"title":"Classes","kind":128,"children":[73]}],"sources":[{"fileName":"index.d.ts","line":162,"character":38}]},{"id":267,"name":"\"validation-controller-factory\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":268,"name":"ValidationControllerFactory","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Creates ValidationController instances."},"children":[{"id":273,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":274,"name":"new ValidationControllerFactory","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":275,"name":"container","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Container"}}],"type":{"type":"reference","name":"ValidationControllerFactory","id":268}}],"sources":[{"fileName":"index.d.ts","line":351,"character":70}]},{"id":269,"name":"container","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":350,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":276,"name":"create","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":277,"name":"create","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a new controller instance."},"parameters":[{"id":278,"name":"validator","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Validator","id":39}}],"type":{"type":"reference","name":"ValidationController","id":73}}],"sources":[{"fileName":"index.d.ts","line":356,"character":14}]},{"id":279,"name":"createForCurrentScope","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":280,"name":"createForCurrentScope","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a new controller and registers it in the current element's container so that it's\navailable to the validate binding behavior and renderers."},"parameters":[{"id":281,"name":"validator","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Validator","id":39}}],"type":{"type":"reference","name":"ValidationController","id":73}}],"sources":[{"fileName":"index.d.ts","line":361,"character":29}]},{"id":270,"name":"get","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":271,"name":"get","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":272,"name":"container","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Container"}}],"type":{"type":"reference","name":"ValidationControllerFactory","id":268}}],"sources":[{"fileName":"index.d.ts","line":351,"character":18}]}],"groups":[{"title":"Constructors","kind":512,"children":[273]},{"title":"Properties","kind":1024,"children":[269]},{"title":"Methods","kind":2048,"children":[276,279,270]}],"sources":[{"fileName":"index.d.ts","line":349,"character":44}]}],"groups":[{"title":"Classes","kind":128,"children":[268]}],"sources":[{"fileName":"index.d.ts","line":342,"character":46}]},{"id":282,"name":"\"validation-errors-custom-attribute\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":286,"name":"ValidationErrorsCustomAttribute","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":296,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":297,"name":"new ValidationErrorsCustomAttribute","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":298,"name":"boundaryElement","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Element"}},{"id":299,"name":"controllerAccessor","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":300,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":301,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"ValidationController","id":73}}],"sources":[{"fileName":"index.d.ts","line":382,"character":65}]}}}],"type":{"type":"reference","name":"ValidationErrorsCustomAttribute","id":286}}],"sources":[{"fileName":"index.d.ts","line":381,"character":32}]},{"id":287,"name":"boundaryElement","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":374,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":288,"name":"controllerAccessor","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":375,"character":34}],"type":{"type":"instrinct","name":"any"}},{"id":295,"name":"errors","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":381,"character":14}],"type":{"type":"reference","isArray":true,"name":"RenderedError","id":283}},{"id":294,"name":"value","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":380,"character":13}],"type":{"type":"reference","isArray":true,"name":"RenderedError","id":283}},{"id":289,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":376,"character":21}],"type":{"type":"union","isArray":true,"types":[{"type":"reflection","declaration":{"id":290,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":291,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":292,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"type":{"type":"reference","name":"__type","id":290}}],"sources":[{"fileName":"index.d.ts","line":376,"character":25}]},{"id":293,"name":"prototype","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"index.d.ts","line":378,"character":21}],"type":{"type":"reference","name":"Element"}}],"groups":[{"title":"Constructors","kind":512,"children":[291]},{"title":"Variables","kind":32,"children":[293]}]}},{"type":"reference","name":"Lazy"}]}},{"id":310,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":311,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":388,"character":12}]},{"id":304,"name":"interestingElements","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":305,"name":"interestingElements","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":306,"name":"elements","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","isArray":true,"name":"Element"}}],"type":{"type":"reference","isArray":true,"name":"Element"}}],"sources":[{"fileName":"index.d.ts","line":386,"character":27}]},{"id":307,"name":"render","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":308,"name":"render","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":309,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RenderInstruction","id":64}}],"type":{"type":"instrinct","name":"void"},"implementationOf":{"type":"reference","name":"ValidationRenderer.render","id":70}}],"sources":[{"fileName":"index.d.ts","line":387,"character":14}],"implementationOf":{"type":"reference","name":"ValidationRenderer.render","id":69}},{"id":302,"name":"sort","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":303,"name":"sort","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":385,"character":12}]},{"id":312,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":313,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":389,"character":14}]}],"groups":[{"title":"Constructors","kind":512,"children":[296]},{"title":"Properties","kind":1024,"children":[287,288,295,294,289]},{"title":"Methods","kind":2048,"children":[310,304,307,302,312]}],"sources":[{"fileName":"index.d.ts","line":373,"character":48}],"implementedTypes":[{"type":"reference","name":"ValidationRenderer","id":68}]},{"id":283,"name":"RenderedError","kind":256,"kindString":"Interface","flags":{"isExported":true},"children":[{"id":284,"name":"error","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":370,"character":13}],"type":{"type":"reference","name":"ValidateResult","id":3}},{"id":285,"name":"targets","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"index.d.ts","line":371,"character":15}],"type":{"type":"reference","isArray":true,"name":"Element"}}],"groups":[{"title":"Properties","kind":1024,"children":[284,285]}],"sources":[{"fileName":"index.d.ts","line":369,"character":34}]}],"groups":[{"title":"Classes","kind":128,"children":[286]},{"title":"Interfaces","kind":256,"children":[283]}],"sources":[{"fileName":"index.d.ts","line":364,"character":51}]},{"id":60,"name":"\"validation-renderer\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":64,"name":"RenderInstruction","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Defines which validation results to render and which validation results to unrender."},"children":[{"id":65,"name":"kind","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The \"kind\" of render instruction. Either 'validate' or 'reset'."},"sources":[{"fileName":"index.d.ts","line":140,"character":12}],"type":{"type":"union","types":[{"type":"stringLiteral","value":"validate"},{"type":"stringLiteral","value":"reset"}]}},{"id":66,"name":"render","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The results to render."},"sources":[{"fileName":"index.d.ts","line":144,"character":14}],"type":{"type":"reference","isArray":true,"name":"ResultInstruction","id":61}},{"id":67,"name":"unrender","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The results to unrender."},"sources":[{"fileName":"index.d.ts","line":148,"character":16}],"type":{"type":"reference","isArray":true,"name":"ResultInstruction","id":61}}],"groups":[{"title":"Properties","kind":1024,"children":[65,66,67]}],"sources":[{"fileName":"index.d.ts","line":136,"character":38}]},{"id":61,"name":"ResultInstruction","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"A result to render (or unrender) and the associated elements (if any)"},"children":[{"id":63,"name":"elements","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The associated elements (if any)."},"sources":[{"fileName":"index.d.ts","line":131,"character":16}],"type":{"type":"reference","isArray":true,"name":"Element"}},{"id":62,"name":"result","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The validation result."},"sources":[{"fileName":"index.d.ts","line":127,"character":14}],"type":{"type":"reference","name":"ValidateResult","id":3}}],"groups":[{"title":"Properties","kind":1024,"children":[63,62]}],"sources":[{"fileName":"index.d.ts","line":123,"character":38}]},{"id":68,"name":"ValidationRenderer","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Renders validation results."},"children":[{"id":69,"name":"render","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":70,"name":"render","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Render the validation results."},"parameters":[{"id":71,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The render instruction. Defines which results to render and which\nresults to unrender.\n"},"type":{"type":"reference","name":"RenderInstruction","id":64}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":159,"character":14}]}],"groups":[{"title":"Methods","kind":2048,"children":[69]}],"sources":[{"fileName":"index.d.ts","line":153,"character":39}],"implementedBy":[{"type":"reference","name":"ValidationErrorsCustomAttribute","id":286}]}],"groups":[{"title":"Interfaces","kind":256,"children":[64,61,68]}],"sources":[{"fileName":"index.d.ts","line":118,"character":36}]},{"id":314,"name":"\"validation-renderer-custom-attribute\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":315,"name":"ValidationRendererCustomAttribute","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":316,"name":"container","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":394,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":317,"name":"controller","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":395,"character":26}],"type":{"type":"instrinct","name":"any"}},{"id":319,"name":"renderer","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":397,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":318,"name":"value","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"index.d.ts","line":396,"character":21}],"type":{"type":"instrinct","name":"any"}},{"id":323,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":324,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":399,"character":12}]},{"id":320,"name":"created","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":321,"name":"created","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":322,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":398,"character":15}]},{"id":325,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":326,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"index.d.ts","line":400,"character":14}]}],"groups":[{"title":"Properties","kind":1024,"children":[316,317,319,318]},{"title":"Methods","kind":2048,"children":[323,320,325]}],"sources":[{"fileName":"index.d.ts","line":393,"character":50}]}],"groups":[{"title":"Classes","kind":128,"children":[315]}],"sources":[{"fileName":"index.d.ts","line":392,"character":53}]},{"id":38,"name":"\"validator\"","kind":2,"kindString":"Module","flags":{},"children":[{"id":39,"name":"Validator","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Validates objects and properties."},"children":[{"id":49,"name":"ruleExists","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":50,"name":"ruleExists","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Determines whether a rule exists in a set of rules.","tags":[{"tag":"parem","text":"rule The rule to find.\n"}]},"parameters":[{"id":51,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rules to search."},"type":{"type":"instrinct","name":"any"}},{"id":52,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"index.d.ts","line":104,"character":27}]},{"id":45,"name":"validateObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":46,"name":"validateObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates all rules for specified object and it's properties."},"parameters":[{"id":47,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":48,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. If unspecified, the implementation should lookup the rules for the\nspecified object. This may not be possible for all implementations of this interface.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","isArray":true,"name":"ValidateResult","id":3}]}}],"sources":[{"fileName":"index.d.ts","line":98,"character":31}]},{"id":40,"name":"validateProperty","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":41,"name":"validateProperty","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates the specified property."},"parameters":[{"id":42,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":43,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the property to validate."},"type":{"type":"instrinct","name":"string"}},{"id":44,"name":"rules","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"Optional. If unspecified, the implementation should lookup the rules for the\nspecified object. This may not be possible for all implementations of this interface.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","isArray":true,"name":"ValidateResult","id":3}]}}],"sources":[{"fileName":"index.d.ts","line":91,"character":33}]}],"groups":[{"title":"Methods","kind":2048,"children":[49,45,40]}],"sources":[{"fileName":"index.d.ts","line":83,"character":35}],"extendedBy":[{"type":"reference","name":"StandardValidator","id":429}]}],"groups":[{"title":"Classes","kind":128,"children":[39]}],"sources":[{"fileName":"index.d.ts","line":78,"character":26}]}],"groups":[{"title":"Modules","kind":2,"children":[671,25,327,349,428,362,410,366,468,30,165,143,20,2,53,72,267,282,60,314,38]}]} diff --git a/package.json b/package.json index a6ec8e96..ca4513f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-validation", - "version": "0.14.0", + "version": "1.0.0-beta.1.0.0", "description": "Validation for Aurelia applications", "keywords": [ "aurelia",