From 87da3ca0d0b4f11c3bc11199c3fedc9cf13c067f Mon Sep 17 00:00:00 2001 From: Rob Eisenberg Date: Tue, 28 Feb 2017 21:51:42 -0800 Subject: [PATCH] chore(all): prepare release 1.0.0 --- bower.json | 2 +- dist/amd/aurelia-validation.d.ts | 3 +- dist/amd/aurelia-validation.js | 10 ++-- dist/amd/controller-validate-result.js | 1 + dist/amd/get-target-dom-element.d.ts | 7 +++ dist/amd/get-target-dom-element.js | 31 ++++++++++++ dist/amd/implementation/rule.d.ts | 7 ++- dist/amd/implementation/rule.js | 1 + dist/amd/implementation/rules.js | 1 + dist/amd/implementation/standard-validator.js | 19 +++++-- dist/amd/implementation/util.js | 1 + .../implementation/validation-messages.d.ts | 2 +- .../amd/implementation/validation-messages.js | 3 +- .../amd/implementation/validation-parser.d.ts | 4 +- dist/amd/implementation/validation-parser.js | 20 +++++--- dist/amd/implementation/validation-rules.d.ts | 17 +++---- dist/amd/implementation/validation-rules.js | 4 +- dist/amd/property-info.js | 4 +- dist/amd/validate-binding-behavior-base.d.ts | 10 +--- dist/amd/validate-binding-behavior-base.js | 42 +++------------- dist/amd/validate-binding-behavior.d.ts | 11 +++-- dist/amd/validate-binding-behavior.js | 26 ++++++---- dist/amd/validate-instruction.js | 1 + dist/amd/validate-result.js | 1 + dist/amd/validate-trigger.d.ts | 26 +++++++--- dist/amd/validate-trigger.js | 15 +++--- dist/amd/validation-controller-factory.js | 1 + dist/amd/validation-controller.d.ts | 3 +- dist/amd/validation-controller.js | 6 ++- .../validation-errors-custom-attribute.d.ts | 7 ++- .../amd/validation-errors-custom-attribute.js | 39 ++++++++++----- .../validation-renderer-custom-attribute.js | 1 + dist/amd/validation-renderer.js | 1 + dist/amd/validator.js | 1 + dist/commonjs/aurelia-validation.d.ts | 3 +- dist/commonjs/aurelia-validation.js | 10 +++- dist/commonjs/controller-validate-result.js | 1 + dist/commonjs/get-target-dom-element.d.ts | 7 +++ dist/commonjs/get-target-dom-element.js | 30 ++++++++++++ dist/commonjs/implementation/rule.d.ts | 7 ++- dist/commonjs/implementation/rule.js | 1 + dist/commonjs/implementation/rules.js | 1 + .../implementation/standard-validator.js | 19 +++++-- dist/commonjs/implementation/util.js | 1 + .../implementation/validation-messages.d.ts | 2 +- .../implementation/validation-messages.js | 3 +- .../implementation/validation-parser.d.ts | 4 +- .../implementation/validation-parser.js | 20 +++++--- .../implementation/validation-rules.d.ts | 17 +++---- .../implementation/validation-rules.js | 4 +- dist/commonjs/property-info.js | 4 +- .../validate-binding-behavior-base.d.ts | 10 +--- .../validate-binding-behavior-base.js | 42 +++------------- dist/commonjs/validate-binding-behavior.d.ts | 11 +++-- dist/commonjs/validate-binding-behavior.js | 26 ++++++---- dist/commonjs/validate-instruction.js | 1 + dist/commonjs/validate-result.js | 1 + dist/commonjs/validate-trigger.d.ts | 26 +++++++--- dist/commonjs/validate-trigger.js | 15 +++--- .../commonjs/validation-controller-factory.js | 1 + dist/commonjs/validation-controller.d.ts | 3 +- dist/commonjs/validation-controller.js | 6 ++- .../validation-errors-custom-attribute.d.ts | 7 ++- .../validation-errors-custom-attribute.js | 38 +++++++++----- .../validation-renderer-custom-attribute.js | 1 + dist/commonjs/validation-renderer.js | 1 + dist/commonjs/validator.js | 1 + dist/es2015/aurelia-validation.d.ts | 3 +- dist/es2015/aurelia-validation.js | 9 +++- dist/es2015/get-target-dom-element.d.ts | 7 +++ dist/es2015/get-target-dom-element.js | 27 ++++++++++ dist/es2015/implementation/rule.d.ts | 7 ++- .../implementation/standard-validator.js | 3 ++ .../implementation/validation-messages.d.ts | 2 +- .../implementation/validation-messages.js | 2 +- .../implementation/validation-parser.d.ts | 4 +- .../implementation/validation-parser.js | 4 +- .../implementation/validation-rules.d.ts | 17 +++---- .../es2015/implementation/validation-rules.js | 3 +- dist/es2015/property-info.js | 5 +- .../validate-binding-behavior-base.d.ts | 10 +--- dist/es2015/validate-binding-behavior-base.js | 41 +++------------- dist/es2015/validate-binding-behavior.d.ts | 11 +++-- dist/es2015/validate-trigger.d.ts | 26 +++++++--- dist/es2015/validate-trigger.js | 14 +++--- dist/es2015/validation-controller.d.ts | 3 +- dist/es2015/validation-controller.js | 21 ++++---- .../validation-errors-custom-attribute.d.ts | 7 ++- .../validation-errors-custom-attribute.js | 43 ++++++++++------ dist/native-modules/aurelia-validation.d.ts | 3 +- dist/native-modules/aurelia-validation.js | 9 +++- .../get-target-dom-element.d.ts | 7 +++ dist/native-modules/get-target-dom-element.js | 27 ++++++++++ dist/native-modules/implementation/rule.d.ts | 7 ++- .../implementation/standard-validator.js | 18 +++++-- .../implementation/validation-messages.d.ts | 2 +- .../implementation/validation-messages.js | 2 +- .../implementation/validation-parser.d.ts | 4 +- .../implementation/validation-parser.js | 19 ++++--- .../implementation/validation-rules.d.ts | 17 +++---- .../implementation/validation-rules.js | 3 +- dist/native-modules/property-info.js | 3 +- .../validate-binding-behavior-base.d.ts | 10 +--- .../validate-binding-behavior-base.js | 41 +++------------- .../validate-binding-behavior.d.ts | 11 +++-- .../validate-binding-behavior.js | 25 ++++++---- dist/native-modules/validate-trigger.d.ts | 26 +++++++--- dist/native-modules/validate-trigger.js | 14 +++--- .../native-modules/validation-controller.d.ts | 3 +- dist/native-modules/validation-controller.js | 5 +- .../validation-errors-custom-attribute.d.ts | 7 ++- .../validation-errors-custom-attribute.js | 39 ++++++++++----- dist/system/aurelia-validation.d.ts | 3 +- dist/system/aurelia-validation.js | 19 ++++--- dist/system/get-target-dom-element.d.ts | 7 +++ dist/system/get-target-dom-element.js | 41 ++++++++++++++++ dist/system/implementation/rule.d.ts | 7 ++- .../implementation/standard-validator.js | 18 +++++-- .../implementation/validation-messages.d.ts | 2 +- .../implementation/validation-messages.js | 2 +- .../implementation/validation-parser.d.ts | 4 +- .../implementation/validation-parser.js | 19 ++++--- .../implementation/validation-rules.d.ts | 17 +++---- .../system/implementation/validation-rules.js | 3 +- dist/system/property-info.js | 3 +- .../validate-binding-behavior-base.d.ts | 10 +--- dist/system/validate-binding-behavior-base.js | 49 ++++--------------- dist/system/validate-binding-behavior.d.ts | 11 +++-- dist/system/validate-binding-behavior.js | 25 ++++++---- dist/system/validate-trigger.d.ts | 26 +++++++--- dist/system/validate-trigger.js | 14 +++--- dist/system/validation-controller.d.ts | 3 +- dist/system/validation-controller.js | 5 +- .../validation-errors-custom-attribute.d.ts | 7 ++- .../validation-errors-custom-attribute.js | 43 ++++++++++------ doc/CHANGELOG.md | 20 ++++++++ doc/api.json | 2 +- package.json | 2 +- 138 files changed, 947 insertions(+), 638 deletions(-) create mode 100644 dist/amd/get-target-dom-element.d.ts create mode 100644 dist/amd/get-target-dom-element.js create mode 100644 dist/commonjs/get-target-dom-element.d.ts create mode 100644 dist/commonjs/get-target-dom-element.js create mode 100644 dist/es2015/get-target-dom-element.d.ts create mode 100644 dist/es2015/get-target-dom-element.js create mode 100644 dist/native-modules/get-target-dom-element.d.ts create mode 100644 dist/native-modules/get-target-dom-element.js create mode 100644 dist/system/get-target-dom-element.d.ts create mode 100644 dist/system/get-target-dom-element.js diff --git a/bower.json b/bower.json index daa16fa7..93aade5e 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-validation", - "version": "1.0.0-beta.1.0.1", + "version": "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 9897cc10..be93a23a 100644 --- a/dist/amd/aurelia-validation.d.ts +++ b/dist/amd/aurelia-validation.d.ts @@ -1,4 +1,5 @@ export * from './controller-validate-result'; +export * from './get-target-dom-element'; export * from './property-info'; export * from './validate-binding-behavior'; export * from './validate-instruction'; @@ -39,5 +40,5 @@ export declare class AureliaValidationConfiguration { */ export declare function configure(frameworkConfig: { container: Container; - globalResources: (...resources: string[]) => any; + globalResources?: (...resources: string[]) => any; }, callback?: (config: AureliaValidationConfiguration) => void): void; diff --git a/dist/amd/aurelia-validation.js b/dist/amd/aurelia-validation.js index 4e07f5a6..516ed080 100644 --- a/dist/amd/aurelia-validation.js +++ b/dist/amd/aurelia-validation.js @@ -1,9 +1,11 @@ // Exports -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) { +define(["require", "exports", "./get-target-dom-element", "./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", "aurelia-pal", "./validator", "./implementation/standard-validator", "./implementation/validation-parser", "./implementation/validation-rules"], function (require, exports, get_target_dom_element_1, 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, aurelia_pal_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]; } + Object.defineProperty(exports, "__esModule", { value: true }); + __export(get_target_dom_element_1); __export(property_info_1); __export(validate_binding_behavior_1); __export(validate_result_1); @@ -46,7 +48,7 @@ define(["require", "exports", "./property-info", "./validate-binding-behavior", */ function configure(frameworkConfig, callback) { // the fluent rule definition API needs the parser to translate messages - // to interpolation expressions. + // to interpolation expressions. var parser = frameworkConfig.container.get(validation_parser_2.ValidationParser); validation_rules_2.ValidationRules.initialize(parser); // configure... @@ -56,7 +58,9 @@ define(["require", "exports", "./property-info", "./validate-binding-behavior", } config.apply(frameworkConfig.container); // globalize the behaviors. - frameworkConfig.globalResources('./validate-binding-behavior', './validation-errors-custom-attribute', './validation-renderer-custom-attribute'); + if (frameworkConfig.globalResources) { + frameworkConfig.globalResources(aurelia_pal_1.PLATFORM.moduleName('./validate-binding-behavior'), aurelia_pal_1.PLATFORM.moduleName('./validation-errors-custom-attribute'), aurelia_pal_1.PLATFORM.moduleName('./validation-renderer-custom-attribute')); + } } exports.configure = configure; }); diff --git a/dist/amd/controller-validate-result.js b/dist/amd/controller-validate-result.js index d4db9673..2ae92b6a 100644 --- a/dist/amd/controller-validate-result.js +++ b/dist/amd/controller-validate-result.js @@ -1,3 +1,4 @@ define(["require", "exports"], function (require, exports) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); }); diff --git a/dist/amd/get-target-dom-element.d.ts b/dist/amd/get-target-dom-element.d.ts new file mode 100644 index 00000000..314fc952 --- /dev/null +++ b/dist/amd/get-target-dom-element.d.ts @@ -0,0 +1,7 @@ +/** + * 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. + */ +export declare function getTargetDOMElement(binding: any, view: any): Element; diff --git a/dist/amd/get-target-dom-element.js b/dist/amd/get-target-dom-element.js new file mode 100644 index 00000000..7a17663b --- /dev/null +++ b/dist/amd/get-target-dom-element.js @@ -0,0 +1,31 @@ +define(["require", "exports", "aurelia-pal"], function (require, exports, aurelia_pal_1) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + /** + * 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. + */ + function getTargetDOMElement(binding, view) { + var target = binding.target; + // DOM element + if (target instanceof Element) { + return target; + } + // custom element or custom attribute + // tslint:disable-next-line:prefer-const + 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(aurelia_pal_1.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 + "\"."); + } + exports.getTargetDOMElement = getTargetDOMElement; +}); diff --git a/dist/amd/implementation/rule.d.ts b/dist/amd/implementation/rule.d.ts index 8bba9d76..eec3b823 100644 --- a/dist/amd/implementation/rule.d.ts +++ b/dist/amd/implementation/rule.d.ts @@ -1,4 +1,5 @@ import { Expression } from 'aurelia-binding'; +export declare type ValidationDisplayNameAccessor = () => string; /** * Information related to a property that is the subject of validation. */ @@ -10,7 +11,7 @@ export interface RuleProperty { /** * The displayName of the property (or object). */ - displayName: string | null; + displayName: string | ValidationDisplayNameAccessor | null; } /** * A rule definition. Associations a rule with a property or object. @@ -19,9 +20,7 @@ export interface Rule { property: RuleProperty; condition: (value: TValue, object?: TObject) => boolean | Promise; config: Object; - when: { - (object: TObject): boolean; - } | null; + when: ((object: TObject) => boolean) | null; messageKey: string; message: Expression | null; sequence: number; diff --git a/dist/amd/implementation/rule.js b/dist/amd/implementation/rule.js index d4db9673..2ae92b6a 100644 --- a/dist/amd/implementation/rule.js +++ b/dist/amd/implementation/rule.js @@ -1,3 +1,4 @@ define(["require", "exports"], function (require, exports) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); }); diff --git a/dist/amd/implementation/rules.js b/dist/amd/implementation/rules.js index ed9f8590..f1f01c7d 100644 --- a/dist/amd/implementation/rules.js +++ b/dist/amd/implementation/rules.js @@ -1,5 +1,6 @@ define(["require", "exports"], function (require, exports) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); /** * Sets, unsets and retrieves rules on an object or constructor function. */ diff --git a/dist/amd/implementation/standard-validator.js b/dist/amd/implementation/standard-validator.js index 6300b16a..3556a555 100644 --- a/dist/amd/implementation/standard-validator.js +++ b/dist/amd/implementation/standard-validator.js @@ -1,10 +1,16 @@ -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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); 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"; + Object.defineProperty(exports, "__esModule", { value: true }); /** * Validates. * Responsible for validating objects and properties. @@ -53,6 +59,7 @@ define(["require", "exports", "aurelia-templating", "../validator", "../validate }; StandardValidator.prototype.getMessage = function (rule, object, value) { var expression = rule.message || this.messageProvider.getMessage(rule.messageKey); + // tslint:disable-next-line:prefer-const var _a = rule.property, propertyName = _a.name, displayName = _a.displayName; if (propertyName !== null) { displayName = this.messageProvider.getDisplayName(propertyName, displayName); @@ -63,6 +70,8 @@ define(["require", "exports", "aurelia-templating", "../validator", "../validate $value: value, $object: object, $config: rule.config, + // returns the name of a given property, given just the property name (irrespective of the property's displayName) + // split on capital letters, first letter ensured to be capitalized $getDisplayName: this.getDisplayName }; return expression.evaluate({ bindingContext: object, overrideContext: overrideContext }, this.lookupFunctions); diff --git a/dist/amd/implementation/util.js b/dist/amd/implementation/util.js index 291b2f8b..3efc2d5d 100644 --- a/dist/amd/implementation/util.js +++ b/dist/amd/implementation/util.js @@ -1,5 +1,6 @@ define(["require", "exports"], function (require, exports) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); function isString(value) { return Object.prototype.toString.call(value) === '[object String]'; } diff --git a/dist/amd/implementation/validation-messages.d.ts b/dist/amd/implementation/validation-messages.d.ts index 7a0978d7..6226bd15 100644 --- a/dist/amd/implementation/validation-messages.d.ts +++ b/dist/amd/implementation/validation-messages.d.ts @@ -25,5 +25,5 @@ export declare class ValidationMessageProvider { * Override this with your own custom logic. * @param propertyName The property name. */ - getDisplayName(propertyName: string, displayName: string | null | undefined): string; + getDisplayName(propertyName: string, displayName?: string | null | Function): string; } diff --git a/dist/amd/implementation/validation-messages.js b/dist/amd/implementation/validation-messages.js index 51eb2587..e21bfdfe 100644 --- a/dist/amd/implementation/validation-messages.js +++ b/dist/amd/implementation/validation-messages.js @@ -1,5 +1,6 @@ define(["require", "exports", "./validation-parser"], function (require, exports, validation_parser_1) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); /** * Dictionary of validation messages. [messageKey]: messageExpression */ @@ -46,7 +47,7 @@ define(["require", "exports", "./validation-parser"], function (require, exports */ ValidationMessageProvider.prototype.getDisplayName = function (propertyName, displayName) { if (displayName !== null && displayName !== undefined) { - return displayName; + return (displayName instanceof Function) ? displayName() : displayName; } // split on upper-case letters. var words = propertyName.split(/(?=[A-Z])/).join(' '); diff --git a/dist/amd/implementation/validation-parser.d.ts b/dist/amd/implementation/validation-parser.d.ts index 75b2c7af..255414a6 100644 --- a/dist/amd/implementation/validation-parser.d.ts +++ b/dist/amd/implementation/validation-parser.d.ts @@ -1,9 +1,7 @@ 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 type PropertyAccessor = (object: TObject) => TValue; export declare class ValidationParser { private parser; private bindinqLanguage; diff --git a/dist/amd/implementation/validation-parser.js b/dist/amd/implementation/validation-parser.js index fef4a064..32abe93c 100644 --- a/dist/amd/implementation/validation-parser.js +++ b/dist/amd/implementation/validation-parser.js @@ -1,10 +1,16 @@ -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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(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) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); var ValidationParser = (function () { function ValidationParser(parser, bindinqLanguage) { this.parser = parser; @@ -49,7 +55,9 @@ define(["require", "exports", "aurelia-binding", "aurelia-templating", "./util", return new aurelia_binding_1.Conditional(new aurelia_binding_1.Binary('||', new aurelia_binding_1.Binary('===', part, this.nullExpression), new aurelia_binding_1.Binary('===', part, this.undefinedExpression)), this.emptyStringExpression, new aurelia_binding_1.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*\}$/; + /* tslint:disable:max-line-length */ + var classic = /^function\s*\([$_\w\d]+\)\s*\{(?:\s*"use strict";)?\s*(?:[$_\w\d.['"\]+;]+)?\s*return\s+[$_\w\d]+\.([$_\w\d]+)\s*;?\s*\}$/; + /* tslint:enable:max-line-length */ var arrow = /^\(?[$_\w\d]+\)?\s*=>\s*[$_\w\d]+\.([$_\w\d]+)$/; var match = classic.exec(fn) || arrow.exec(fn); if (match === null) { diff --git a/dist/amd/implementation/validation-rules.d.ts b/dist/amd/implementation/validation-rules.d.ts index 13251d4d..67ea1021 100644 --- a/dist/amd/implementation/validation-rules.d.ts +++ b/dist/amd/implementation/validation-rules.d.ts @@ -1,5 +1,6 @@ import { Rule, RuleProperty } from './rule'; import { ValidationParser, PropertyAccessor } from './validation-parser'; +import { ValidationDisplayNameAccessor } from './rule'; /** * Part of the fluent rule API. Enables customizing property rules. */ @@ -8,7 +9,7 @@ export declare class FluentRuleCustomizer { private fluentRules; private parser; private rule; - constructor(property: RuleProperty, condition: (value: TValue, object?: TObject) => boolean | Promise, config: Object, fluentEnsure: FluentEnsure, fluentRules: FluentRules, parser: ValidationParser); + constructor(property: RuleProperty, condition: (value: TValue, object?: TObject) => boolean | Promise, config: Object | undefined, fluentEnsure: FluentEnsure, fluentRules: FluentRules, parser: ValidationParser); /** * Validate subsequent rules after previously declared rules have * been validated successfully. Use to postpone validation of costly @@ -38,9 +39,7 @@ export declare class FluentRuleCustomizer { * 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; + ensure(subject: string | ((model: TObject) => TValue2)): FluentRules; /** * Targets an object with validation rules. */ @@ -66,7 +65,7 @@ export declare class FluentRuleCustomizer { * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; + satisfiesRule(name: string, ...args: any[]): any; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. @@ -132,7 +131,7 @@ export declare class FluentRules { /** * Sets the display name of the ensured property. */ - displayName(name: string): this; + displayName(name: string | ValidationDisplayNameAccessor | null): this; /** * Applies an ad-hoc rule function to the ensured property or object. * @param condition The function to validate the rule. @@ -145,7 +144,7 @@ export declare class FluentRules { * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; + satisfiesRule(name: string, ...args: any[]): any; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. @@ -213,10 +212,6 @@ export declare class FluentEnsure { * @param target A class or object. */ on(target: any): this; - /** - * Adds a rule definition to the sequenced ruleset. - */ - _addRule(rule: Rule): void; private assertInitialized(); } /** diff --git a/dist/amd/implementation/validation-rules.js b/dist/amd/implementation/validation-rules.js index 033f494d..ad97254c 100644 --- a/dist/amd/implementation/validation-rules.js +++ b/dist/amd/implementation/validation-rules.js @@ -1,5 +1,6 @@ define(["require", "exports", "./util", "./rules", "./validation-messages"], function (require, exports, util_1, rules_1, validation_messages_1) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); /** * Part of the fluent rule API. Enables customizing property rules. */ @@ -345,6 +346,7 @@ define(["require", "exports", "./util", "./rules", "./validation-messages"], fun }; /** * Adds a rule definition to the sequenced ruleset. + * @internal */ FluentEnsure.prototype._addRule = function (rule) { while (this.rules.length < rule.sequence + 1) { @@ -356,7 +358,7 @@ define(["require", "exports", "./util", "./rules", "./validation-messages"], fun 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; }()); diff --git a/dist/amd/property-info.js b/dist/amd/property-info.js index a58a00fd..759c93ee 100644 --- a/dist/amd/property-info.js +++ b/dist/amd/property-info.js @@ -1,13 +1,13 @@ define(["require", "exports", "aurelia-binding"], function (require, exports, aurelia_binding_1) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); function getObject(expression, objectExpression, source) { var value = objectExpression.evaluate(source, null); if (value === null || value === undefined || value instanceof Object) { return value; } - /* tslint:disable */ + // tslint:disable-next-line:max-line-length 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. diff --git a/dist/amd/validate-binding-behavior-base.d.ts b/dist/amd/validate-binding-behavior-base.d.ts index 09c18430..971c8e83 100644 --- a/dist/amd/validate-binding-behavior-base.d.ts +++ b/dist/amd/validate-binding-behavior-base.d.ts @@ -1,19 +1,13 @@ import { TaskQueue } from 'aurelia-task-queue'; import { ValidationController } from './validation-controller'; +import { validateTrigger } from './validate-trigger'; /** * 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; + protected abstract getValidateTrigger(controller: ValidationController): validateTrigger; bind(binding: any, source: any, rulesOrController?: ValidationController | any, rules?: any): void; unbind(binding: any): void; } diff --git a/dist/amd/validate-binding-behavior-base.js b/dist/amd/validate-binding-behavior-base.js index 440a5b56..1a98b259 100644 --- a/dist/amd/validate-binding-behavior-base.js +++ b/dist/amd/validate-binding-behavior-base.js @@ -1,5 +1,6 @@ -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", "./validation-controller", "./validate-trigger", "./get-target-dom-element"], function (require, exports, aurelia_dependency_injection_1, validation_controller_1, validate_trigger_1, get_target_dom_element_1) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); /** * Binding behavior. Indicates the bound property should be validated. */ @@ -7,35 +8,10 @@ define(["require", "exports", "aurelia-dependency-injection", "aurelia-pal", "./ 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(aurelia_pal_1.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); + var target = get_target_dom_element_1.getTargetDOMElement(binding, source); // locate the controller. var controller; if (rulesOrController instanceof validation_controller_1.ValidationController) { @@ -51,20 +27,17 @@ define(["require", "exports", "aurelia-dependency-injection", "aurelia-pal", "./ controller.registerBinding(binding, target, rules); binding.validationController = controller; var trigger = this.getValidateTrigger(controller); - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise if (trigger & validate_trigger_1.validateTrigger.change) { - /* tslint:enable:no-bitwise */ binding.standardUpdateSource = binding.updateSource; - /* tslint:disable:only-arrow-functions */ + // tslint:disable-next-line:only-arrow-functions binding.updateSource = function (value) { - /* tslint:enable:only-arrow-functions */ this.standardUpdateSource(value); this.validationController.validateBinding(this); }; } - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise if (trigger & validate_trigger_1.validateTrigger.blur) { - /* tslint:enable:no-bitwise */ binding.validateBlurHandler = function () { _this.taskQueue.queueMicroTask(function () { return controller.validateBinding(binding); }); }; @@ -73,9 +46,8 @@ define(["require", "exports", "aurelia-dependency-injection", "aurelia-pal", "./ } if (trigger !== validate_trigger_1.validateTrigger.manual) { binding.standardUpdateTarget = binding.updateTarget; - /* tslint:disable:only-arrow-functions */ + // tslint:disable-next-line:only-arrow-functions binding.updateTarget = function (value) { - /* tslint:enable:only-arrow-functions */ this.standardUpdateTarget(value); this.validationController.resetBinding(this); }; diff --git a/dist/amd/validate-binding-behavior.d.ts b/dist/amd/validate-binding-behavior.d.ts index 2d55c7ec..518186be 100644 --- a/dist/amd/validate-binding-behavior.d.ts +++ b/dist/amd/validate-binding-behavior.d.ts @@ -1,5 +1,6 @@ import { TaskQueue } from 'aurelia-task-queue'; import { ValidationController } from './validation-controller'; +import { validateTrigger } from './validate-trigger'; import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; /** * Binding behavior. Indicates the bound property should be validated @@ -8,7 +9,7 @@ import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; */ export declare class ValidateBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(controller: ValidationController): number; + getValidateTrigger(controller: ValidationController): validateTrigger; } /** * Binding behavior. Indicates the bound property will be validated @@ -17,7 +18,7 @@ export declare class ValidateBindingBehavior extends ValidateBindingBehaviorBase */ export declare class ValidateManuallyBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -25,7 +26,7 @@ export declare class ValidateManuallyBindingBehavior extends ValidateBindingBeha */ export declare class ValidateOnBlurBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -34,7 +35,7 @@ export declare class ValidateOnBlurBindingBehavior extends ValidateBindingBehavi */ export declare class ValidateOnChangeBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -43,5 +44,5 @@ export declare class ValidateOnChangeBindingBehavior extends ValidateBindingBeha */ export declare class ValidateOnChangeOrBlurBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } diff --git a/dist/amd/validate-binding-behavior.js b/dist/amd/validate-binding-behavior.js index dec7911b..eb856cc7 100644 --- a/dist/amd/validate-binding-behavior.js +++ b/dist/amd/validate-binding-behavior.js @@ -1,10 +1,16 @@ -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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(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) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); /** * Binding behavior. Indicates the bound property should be validated * when the validate trigger specified by the associated controller's @@ -13,7 +19,7 @@ define(["require", "exports", "aurelia-task-queue", "./validate-trigger", "./val var ValidateBindingBehavior = (function (_super) { __extends(ValidateBindingBehavior, _super); function ValidateBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateBindingBehavior.prototype.getValidateTrigger = function (controller) { return controller.validateTrigger; @@ -30,7 +36,7 @@ define(["require", "exports", "aurelia-task-queue", "./validate-trigger", "./val var ValidateManuallyBindingBehavior = (function (_super) { __extends(ValidateManuallyBindingBehavior, _super); function ValidateManuallyBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateManuallyBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.manual; @@ -46,7 +52,7 @@ define(["require", "exports", "aurelia-task-queue", "./validate-trigger", "./val var ValidateOnBlurBindingBehavior = (function (_super) { __extends(ValidateOnBlurBindingBehavior, _super); function ValidateOnBlurBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.blur; @@ -63,7 +69,7 @@ define(["require", "exports", "aurelia-task-queue", "./validate-trigger", "./val var ValidateOnChangeBindingBehavior = (function (_super) { __extends(ValidateOnChangeBindingBehavior, _super); function ValidateOnChangeBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnChangeBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.change; @@ -80,7 +86,7 @@ define(["require", "exports", "aurelia-task-queue", "./validate-trigger", "./val var ValidateOnChangeOrBlurBindingBehavior = (function (_super) { __extends(ValidateOnChangeOrBlurBindingBehavior, _super); function ValidateOnChangeOrBlurBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnChangeOrBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.changeOrBlur; diff --git a/dist/amd/validate-instruction.js b/dist/amd/validate-instruction.js index d4db9673..2ae92b6a 100644 --- a/dist/amd/validate-instruction.js +++ b/dist/amd/validate-instruction.js @@ -1,3 +1,4 @@ define(["require", "exports"], function (require, exports) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); }); diff --git a/dist/amd/validate-result.js b/dist/amd/validate-result.js index 12480ffc..791f085b 100644 --- a/dist/amd/validate-result.js +++ b/dist/amd/validate-result.js @@ -1,5 +1,6 @@ define(["require", "exports"], function (require, exports) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); /** * The result of validating an individual validation rule. */ diff --git a/dist/amd/validate-trigger.d.ts b/dist/amd/validate-trigger.d.ts index 82c60096..43e76851 100644 --- a/dist/amd/validate-trigger.d.ts +++ b/dist/amd/validate-trigger.d.ts @@ -1,9 +1,23 @@ /** * Validation triggers. */ -export declare const validateTrigger: { - manual: number; - blur: number; - change: number; - changeOrBlur: number; -}; +export declare enum 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/amd/validate-trigger.js b/dist/amd/validate-trigger.js index c14d4ea7..71dc05f1 100644 --- a/dist/amd/validate-trigger.js +++ b/dist/amd/validate-trigger.js @@ -1,26 +1,29 @@ define(["require", "exports"], function (require, exports) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); /** * Validation triggers. */ - exports.validateTrigger = { + var validateTrigger; + (function (validateTrigger) { /** * Manual validation. Use the controller's `validate()` and `reset()` methods * to validate all bindings. */ - manual: 0, + validateTrigger[validateTrigger["manual"] = 0] = "manual"; /** * Validate the binding when the binding's target element fires a DOM "blur" event. */ - blur: 1, + validateTrigger[validateTrigger["blur"] = 1] = "blur"; /** * Validate the binding when it updates the model due to a change in the view. */ - change: 2, + validateTrigger[validateTrigger["change"] = 2] = "change"; /** * 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 - }; + validateTrigger[validateTrigger["changeOrBlur"] = 3] = "changeOrBlur"; + })(validateTrigger = exports.validateTrigger || (exports.validateTrigger = {})); + ; }); diff --git a/dist/amd/validation-controller-factory.js b/dist/amd/validation-controller-factory.js index 4cd9219e..7b0a04be 100644 --- a/dist/amd/validation-controller-factory.js +++ b/dist/amd/validation-controller-factory.js @@ -1,5 +1,6 @@ define(["require", "exports", "./validation-controller", "./validator"], function (require, exports, validation_controller_1, validator_1) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); /** * Creates ValidationController instances. */ diff --git a/dist/amd/validation-controller.d.ts b/dist/amd/validation-controller.d.ts index d88935e5..86dccc2c 100644 --- a/dist/amd/validation-controller.d.ts +++ b/dist/amd/validation-controller.d.ts @@ -1,5 +1,6 @@ import { Binding } from 'aurelia-binding'; import { Validator } from './validator'; +import { validateTrigger } from './validate-trigger'; import { ValidationRenderer } from './validation-renderer'; import { ValidateResult } from './validate-result'; import { ValidateInstruction } from './validate-instruction'; @@ -31,7 +32,7 @@ export declare class ValidationController { /** * The trigger that will invoke automatic validation of a property used in a binding. */ - validateTrigger: number; + validateTrigger: validateTrigger; private finishValidating; constructor(validator: Validator); /** diff --git a/dist/amd/validation-controller.js b/dist/amd/validation-controller.js index 15037a66..5a2e9883 100644 --- a/dist/amd/validation-controller.js +++ b/dist/amd/validation-controller.js @@ -1,5 +1,6 @@ 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"; + Object.defineProperty(exports, "__esModule", { value: true }); /** * Orchestrates validation. * Manages a set of bindings, renderers and objects. @@ -145,6 +146,7 @@ define(["require", "exports", "./validator", "./validate-trigger", "./property-i // Get a function that will process the validation instruction. var execute; if (instruction) { + // tslint:disable-next-line:prefer-const 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); @@ -255,7 +257,7 @@ define(["require", "exports", "./validator", "./validate-trigger", "./property-i } } else { - // there is a corresponding new result... + // 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); @@ -307,7 +309,7 @@ define(["require", "exports", "./validator", "./validate-trigger", "./property-i return; } var propertyInfo = property_info_1.getPropertyInfo(binding.sourceExpression, binding.source); - var rules = undefined; + var rules; var registeredBinding = this.bindings.get(binding); if (registeredBinding) { rules = registeredBinding.rules; diff --git a/dist/amd/validation-errors-custom-attribute.d.ts b/dist/amd/validation-errors-custom-attribute.d.ts index 73340e73..57c020a0 100644 --- a/dist/amd/validation-errors-custom-attribute.d.ts +++ b/dist/amd/validation-errors-custom-attribute.d.ts @@ -13,11 +13,10 @@ export declare class ValidationErrorsCustomAttribute implements ValidationRender new (): Element; prototype: Element; } | Lazy)[]; - value: RenderedError[]; + controller: ValidationController | null; errors: RenderedError[]; - constructor(boundaryElement: Element, controllerAccessor: { - (): ValidationController; - }); + private errorsInternal; + constructor(boundaryElement: Element, controllerAccessor: () => ValidationController); sort(): void; interestingElements(elements: Element[]): Element[]; render(instruction: RenderInstruction): void; diff --git a/dist/amd/validation-errors-custom-attribute.js b/dist/amd/validation-errors-custom-attribute.js index 77fe1bd4..67343be2 100644 --- a/dist/amd/validation-errors-custom-attribute.js +++ b/dist/amd/validation-errors-custom-attribute.js @@ -4,22 +4,24 @@ 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", "aurelia-pal"], function (require, exports, aurelia_binding_1, aurelia_dependency_injection_1, aurelia_templating_1, validation_controller_1, aurelia_pal_1) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); var ValidationErrorsCustomAttribute = (function () { function ValidationErrorsCustomAttribute(boundaryElement, controllerAccessor) { this.boundaryElement = boundaryElement; this.controllerAccessor = controllerAccessor; + this.controller = null; this.errors = []; + this.errorsInternal = []; } ValidationErrorsCustomAttribute.prototype.sort = function () { - this.errors.sort(function (a, b) { + this.errorsInternal.sort(function (a, b) { if (a.targets[0] === b.targets[0]) { return 0; } - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise return a.targets[0].compareDocumentPosition(b.targets[0]) & 2 ? 1 : -1; - /* tslint:enable:no-bitwise */ }); }; ValidationErrorsCustomAttribute.prototype.interestingElements = function (elements) { @@ -28,9 +30,9 @@ define(["require", "exports", "aurelia-binding", "aurelia-dependency-injection", }; ValidationErrorsCustomAttribute.prototype.render = function (instruction) { var _loop_1 = function (result) { - var index = this_1.errors.findIndex(function (x) { return x.error === result; }); + var index = this_1.errorsInternal.findIndex(function (x) { return x.error === result; }); if (index !== -1) { - this_1.errors.splice(index, 1); + this_1.errorsInternal.splice(index, 1); } }; var this_1 = this; @@ -45,24 +47,35 @@ define(["require", "exports", "aurelia-binding", "aurelia-dependency-injection", } var targets = this.interestingElements(elements); if (targets.length) { - this.errors.push({ error: result, targets: targets }); + this.errorsInternal.push({ error: result, targets: targets }); } } this.sort(); - this.value = this.errors; + this.errors = this.errorsInternal; }; ValidationErrorsCustomAttribute.prototype.bind = function () { - this.controllerAccessor().addRenderer(this); - this.value = this.errors; + if (!this.controller) { + this.controller = this.controllerAccessor(); + } + // this will call render() with the side-effect of updating this.errors + this.controller.addRenderer(this); }; ValidationErrorsCustomAttribute.prototype.unbind = function () { - this.controllerAccessor().removeRenderer(this); + if (this.controller) { + this.controller.removeRenderer(this); + } }; return ValidationErrorsCustomAttribute; }()); - ValidationErrorsCustomAttribute.inject = [Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; + ValidationErrorsCustomAttribute.inject = [aurelia_pal_1.DOM.Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; + __decorate([ + aurelia_templating_1.bindable({ defaultBindingMode: aurelia_binding_1.bindingMode.oneWay }) + ], ValidationErrorsCustomAttribute.prototype, "controller", void 0); + __decorate([ + aurelia_templating_1.bindable({ primaryProperty: true, defaultBindingMode: aurelia_binding_1.bindingMode.twoWay }) + ], ValidationErrorsCustomAttribute.prototype, "errors", void 0); ValidationErrorsCustomAttribute = __decorate([ - aurelia_templating_1.customAttribute('validation-errors', aurelia_binding_1.bindingMode.twoWay) + aurelia_templating_1.customAttribute('validation-errors') ], ValidationErrorsCustomAttribute); exports.ValidationErrorsCustomAttribute = ValidationErrorsCustomAttribute; }); diff --git a/dist/amd/validation-renderer-custom-attribute.js b/dist/amd/validation-renderer-custom-attribute.js index 6d526d6f..22da57b9 100644 --- a/dist/amd/validation-renderer-custom-attribute.js +++ b/dist/amd/validation-renderer-custom-attribute.js @@ -1,5 +1,6 @@ define(["require", "exports", "./validation-controller"], function (require, exports, validation_controller_1) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); var ValidationRendererCustomAttribute = (function () { function ValidationRendererCustomAttribute() { } diff --git a/dist/amd/validation-renderer.js b/dist/amd/validation-renderer.js index d4db9673..2ae92b6a 100644 --- a/dist/amd/validation-renderer.js +++ b/dist/amd/validation-renderer.js @@ -1,3 +1,4 @@ define(["require", "exports"], function (require, exports) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); }); diff --git a/dist/amd/validator.js b/dist/amd/validator.js index 14961fa5..fa3d0c6e 100644 --- a/dist/amd/validator.js +++ b/dist/amd/validator.js @@ -1,5 +1,6 @@ define(["require", "exports"], function (require, exports) { "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); /** * Validates objects and properties. */ diff --git a/dist/commonjs/aurelia-validation.d.ts b/dist/commonjs/aurelia-validation.d.ts index 9897cc10..be93a23a 100644 --- a/dist/commonjs/aurelia-validation.d.ts +++ b/dist/commonjs/aurelia-validation.d.ts @@ -1,4 +1,5 @@ export * from './controller-validate-result'; +export * from './get-target-dom-element'; export * from './property-info'; export * from './validate-binding-behavior'; export * from './validate-instruction'; @@ -39,5 +40,5 @@ export declare class AureliaValidationConfiguration { */ export declare function configure(frameworkConfig: { container: Container; - globalResources: (...resources: string[]) => any; + globalResources?: (...resources: string[]) => any; }, callback?: (config: AureliaValidationConfiguration) => void): void; diff --git a/dist/commonjs/aurelia-validation.js b/dist/commonjs/aurelia-validation.js index 1b69a7eb..cf2b4154 100644 --- a/dist/commonjs/aurelia-validation.js +++ b/dist/commonjs/aurelia-validation.js @@ -3,6 +3,8 @@ function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } +Object.defineProperty(exports, "__esModule", { value: true }); +__export(require("./get-target-dom-element")); __export(require("./property-info")); __export(require("./validate-binding-behavior")); __export(require("./validate-result")); @@ -17,6 +19,8 @@ __export(require("./implementation/standard-validator")); __export(require("./implementation/validation-messages")); __export(require("./implementation/validation-parser")); __export(require("./implementation/validation-rules")); +// Configuration +var aurelia_pal_1 = require("aurelia-pal"); var validator_1 = require("./validator"); var standard_validator_1 = require("./implementation/standard-validator"); var validation_parser_1 = require("./implementation/validation-parser"); @@ -49,7 +53,7 @@ exports.AureliaValidationConfiguration = AureliaValidationConfiguration; */ function configure(frameworkConfig, callback) { // the fluent rule definition API needs the parser to translate messages - // to interpolation expressions. + // to interpolation expressions. var parser = frameworkConfig.container.get(validation_parser_1.ValidationParser); validation_rules_1.ValidationRules.initialize(parser); // configure... @@ -59,6 +63,8 @@ function configure(frameworkConfig, callback) { } config.apply(frameworkConfig.container); // globalize the behaviors. - frameworkConfig.globalResources('./validate-binding-behavior', './validation-errors-custom-attribute', './validation-renderer-custom-attribute'); + if (frameworkConfig.globalResources) { + frameworkConfig.globalResources(aurelia_pal_1.PLATFORM.moduleName('./validate-binding-behavior'), aurelia_pal_1.PLATFORM.moduleName('./validation-errors-custom-attribute'), aurelia_pal_1.PLATFORM.moduleName('./validation-renderer-custom-attribute')); + } } exports.configure = configure; diff --git a/dist/commonjs/controller-validate-result.js b/dist/commonjs/controller-validate-result.js index 3918c74e..c8ad2e54 100644 --- a/dist/commonjs/controller-validate-result.js +++ b/dist/commonjs/controller-validate-result.js @@ -1 +1,2 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/commonjs/get-target-dom-element.d.ts b/dist/commonjs/get-target-dom-element.d.ts new file mode 100644 index 00000000..314fc952 --- /dev/null +++ b/dist/commonjs/get-target-dom-element.d.ts @@ -0,0 +1,7 @@ +/** + * 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. + */ +export declare function getTargetDOMElement(binding: any, view: any): Element; diff --git a/dist/commonjs/get-target-dom-element.js b/dist/commonjs/get-target-dom-element.js new file mode 100644 index 00000000..c6a2d7a9 --- /dev/null +++ b/dist/commonjs/get-target-dom-element.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var aurelia_pal_1 = require("aurelia-pal"); +/** + * 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. + */ +function getTargetDOMElement(binding, view) { + var target = binding.target; + // DOM element + if (target instanceof Element) { + return target; + } + // custom element or custom attribute + // tslint:disable-next-line:prefer-const + 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(aurelia_pal_1.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 + "\"."); +} +exports.getTargetDOMElement = getTargetDOMElement; diff --git a/dist/commonjs/implementation/rule.d.ts b/dist/commonjs/implementation/rule.d.ts index 8bba9d76..eec3b823 100644 --- a/dist/commonjs/implementation/rule.d.ts +++ b/dist/commonjs/implementation/rule.d.ts @@ -1,4 +1,5 @@ import { Expression } from 'aurelia-binding'; +export declare type ValidationDisplayNameAccessor = () => string; /** * Information related to a property that is the subject of validation. */ @@ -10,7 +11,7 @@ export interface RuleProperty { /** * The displayName of the property (or object). */ - displayName: string | null; + displayName: string | ValidationDisplayNameAccessor | null; } /** * A rule definition. Associations a rule with a property or object. @@ -19,9 +20,7 @@ export interface Rule { property: RuleProperty; condition: (value: TValue, object?: TObject) => boolean | Promise; config: Object; - when: { - (object: TObject): boolean; - } | null; + when: ((object: TObject) => boolean) | null; messageKey: string; message: Expression | null; sequence: number; diff --git a/dist/commonjs/implementation/rule.js b/dist/commonjs/implementation/rule.js index 3918c74e..c8ad2e54 100644 --- a/dist/commonjs/implementation/rule.js +++ b/dist/commonjs/implementation/rule.js @@ -1 +1,2 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/commonjs/implementation/rules.js b/dist/commonjs/implementation/rules.js index 561b7f30..583fab6a 100644 --- a/dist/commonjs/implementation/rules.js +++ b/dist/commonjs/implementation/rules.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); /** * Sets, unsets and retrieves rules on an object or constructor function. */ diff --git a/dist/commonjs/implementation/standard-validator.js b/dist/commonjs/implementation/standard-validator.js index 7924b6fc..89d01ada 100644 --- a/dist/commonjs/implementation/standard-validator.js +++ b/dist/commonjs/implementation/standard-validator.js @@ -1,9 +1,15 @@ "use strict"; -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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); var aurelia_templating_1 = require("aurelia-templating"); var validator_1 = require("../validator"); var validate_result_1 = require("../validate-result"); @@ -57,6 +63,7 @@ var StandardValidator = (function (_super) { }; StandardValidator.prototype.getMessage = function (rule, object, value) { var expression = rule.message || this.messageProvider.getMessage(rule.messageKey); + // tslint:disable-next-line:prefer-const var _a = rule.property, propertyName = _a.name, displayName = _a.displayName; if (propertyName !== null) { displayName = this.messageProvider.getDisplayName(propertyName, displayName); @@ -67,6 +74,8 @@ var StandardValidator = (function (_super) { $value: value, $object: object, $config: rule.config, + // returns the name of a given property, given just the property name (irrespective of the property's displayName) + // split on capital letters, first letter ensured to be capitalized $getDisplayName: this.getDisplayName }; return expression.evaluate({ bindingContext: object, overrideContext: overrideContext }, this.lookupFunctions); diff --git a/dist/commonjs/implementation/util.js b/dist/commonjs/implementation/util.js index c55e00bc..fcdbe9e6 100644 --- a/dist/commonjs/implementation/util.js +++ b/dist/commonjs/implementation/util.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); function isString(value) { return Object.prototype.toString.call(value) === '[object String]'; } diff --git a/dist/commonjs/implementation/validation-messages.d.ts b/dist/commonjs/implementation/validation-messages.d.ts index 7a0978d7..6226bd15 100644 --- a/dist/commonjs/implementation/validation-messages.d.ts +++ b/dist/commonjs/implementation/validation-messages.d.ts @@ -25,5 +25,5 @@ export declare class ValidationMessageProvider { * Override this with your own custom logic. * @param propertyName The property name. */ - getDisplayName(propertyName: string, displayName: string | null | undefined): string; + getDisplayName(propertyName: string, displayName?: string | null | Function): string; } diff --git a/dist/commonjs/implementation/validation-messages.js b/dist/commonjs/implementation/validation-messages.js index c231310e..0370fcd1 100644 --- a/dist/commonjs/implementation/validation-messages.js +++ b/dist/commonjs/implementation/validation-messages.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); var validation_parser_1 = require("./validation-parser"); /** * Dictionary of validation messages. [messageKey]: messageExpression @@ -46,7 +47,7 @@ var ValidationMessageProvider = (function () { */ ValidationMessageProvider.prototype.getDisplayName = function (propertyName, displayName) { if (displayName !== null && displayName !== undefined) { - return displayName; + return (displayName instanceof Function) ? displayName() : displayName; } // split on upper-case letters. var words = propertyName.split(/(?=[A-Z])/).join(' '); diff --git a/dist/commonjs/implementation/validation-parser.d.ts b/dist/commonjs/implementation/validation-parser.d.ts index 75b2c7af..255414a6 100644 --- a/dist/commonjs/implementation/validation-parser.d.ts +++ b/dist/commonjs/implementation/validation-parser.d.ts @@ -1,9 +1,7 @@ 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 type PropertyAccessor = (object: TObject) => TValue; export declare class ValidationParser { private parser; private bindinqLanguage; diff --git a/dist/commonjs/implementation/validation-parser.js b/dist/commonjs/implementation/validation-parser.js index c3a6f2f1..1d8269e6 100644 --- a/dist/commonjs/implementation/validation-parser.js +++ b/dist/commonjs/implementation/validation-parser.js @@ -1,9 +1,15 @@ "use strict"; -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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); var aurelia_binding_1 = require("aurelia-binding"); var aurelia_templating_1 = require("aurelia-templating"); var util_1 = require("./util"); @@ -52,7 +58,9 @@ var ValidationParser = (function () { return new aurelia_binding_1.Conditional(new aurelia_binding_1.Binary('||', new aurelia_binding_1.Binary('===', part, this.nullExpression), new aurelia_binding_1.Binary('===', part, this.undefinedExpression)), this.emptyStringExpression, new aurelia_binding_1.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*\}$/; + /* tslint:disable:max-line-length */ + var classic = /^function\s*\([$_\w\d]+\)\s*\{(?:\s*"use strict";)?\s*(?:[$_\w\d.['"\]+;]+)?\s*return\s+[$_\w\d]+\.([$_\w\d]+)\s*;?\s*\}$/; + /* tslint:enable:max-line-length */ var arrow = /^\(?[$_\w\d]+\)?\s*=>\s*[$_\w\d]+\.([$_\w\d]+)$/; var match = classic.exec(fn) || arrow.exec(fn); if (match === null) { diff --git a/dist/commonjs/implementation/validation-rules.d.ts b/dist/commonjs/implementation/validation-rules.d.ts index 13251d4d..67ea1021 100644 --- a/dist/commonjs/implementation/validation-rules.d.ts +++ b/dist/commonjs/implementation/validation-rules.d.ts @@ -1,5 +1,6 @@ import { Rule, RuleProperty } from './rule'; import { ValidationParser, PropertyAccessor } from './validation-parser'; +import { ValidationDisplayNameAccessor } from './rule'; /** * Part of the fluent rule API. Enables customizing property rules. */ @@ -8,7 +9,7 @@ export declare class FluentRuleCustomizer { private fluentRules; private parser; private rule; - constructor(property: RuleProperty, condition: (value: TValue, object?: TObject) => boolean | Promise, config: Object, fluentEnsure: FluentEnsure, fluentRules: FluentRules, parser: ValidationParser); + constructor(property: RuleProperty, condition: (value: TValue, object?: TObject) => boolean | Promise, config: Object | undefined, fluentEnsure: FluentEnsure, fluentRules: FluentRules, parser: ValidationParser); /** * Validate subsequent rules after previously declared rules have * been validated successfully. Use to postpone validation of costly @@ -38,9 +39,7 @@ export declare class FluentRuleCustomizer { * 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; + ensure(subject: string | ((model: TObject) => TValue2)): FluentRules; /** * Targets an object with validation rules. */ @@ -66,7 +65,7 @@ export declare class FluentRuleCustomizer { * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; + satisfiesRule(name: string, ...args: any[]): any; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. @@ -132,7 +131,7 @@ export declare class FluentRules { /** * Sets the display name of the ensured property. */ - displayName(name: string): this; + displayName(name: string | ValidationDisplayNameAccessor | null): this; /** * Applies an ad-hoc rule function to the ensured property or object. * @param condition The function to validate the rule. @@ -145,7 +144,7 @@ export declare class FluentRules { * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; + satisfiesRule(name: string, ...args: any[]): any; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. @@ -213,10 +212,6 @@ export declare class FluentEnsure { * @param target A class or object. */ on(target: any): this; - /** - * Adds a rule definition to the sequenced ruleset. - */ - _addRule(rule: Rule): void; private assertInitialized(); } /** diff --git a/dist/commonjs/implementation/validation-rules.js b/dist/commonjs/implementation/validation-rules.js index 5e0ce156..7be62116 100644 --- a/dist/commonjs/implementation/validation-rules.js +++ b/dist/commonjs/implementation/validation-rules.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = require("./util"); var rules_1 = require("./rules"); var validation_messages_1 = require("./validation-messages"); @@ -347,6 +348,7 @@ var FluentEnsure = (function () { }; /** * Adds a rule definition to the sequenced ruleset. + * @internal */ FluentEnsure.prototype._addRule = function (rule) { while (this.rules.length < rule.sequence + 1) { @@ -358,7 +360,7 @@ var FluentEnsure = (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; }()); diff --git a/dist/commonjs/property-info.js b/dist/commonjs/property-info.js index adf83ce6..f5780e63 100644 --- a/dist/commonjs/property-info.js +++ b/dist/commonjs/property-info.js @@ -1,13 +1,13 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); 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) { return value; } - /* tslint:disable */ + // tslint:disable-next-line:max-line-length 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. diff --git a/dist/commonjs/validate-binding-behavior-base.d.ts b/dist/commonjs/validate-binding-behavior-base.d.ts index 09c18430..971c8e83 100644 --- a/dist/commonjs/validate-binding-behavior-base.d.ts +++ b/dist/commonjs/validate-binding-behavior-base.d.ts @@ -1,19 +1,13 @@ import { TaskQueue } from 'aurelia-task-queue'; import { ValidationController } from './validation-controller'; +import { validateTrigger } from './validate-trigger'; /** * 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; + protected abstract getValidateTrigger(controller: ValidationController): validateTrigger; bind(binding: any, source: any, rulesOrController?: ValidationController | any, rules?: any): void; unbind(binding: any): void; } diff --git a/dist/commonjs/validate-binding-behavior-base.js b/dist/commonjs/validate-binding-behavior-base.js index 8efc5786..a386f875 100644 --- a/dist/commonjs/validate-binding-behavior-base.js +++ b/dist/commonjs/validate-binding-behavior-base.js @@ -1,8 +1,9 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); 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 get_target_dom_element_1 = require("./get-target-dom-element"); /** * Binding behavior. Indicates the bound property should be validated. */ @@ -10,35 +11,10 @@ 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(aurelia_pal_1.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); + var target = get_target_dom_element_1.getTargetDOMElement(binding, source); // locate the controller. var controller; if (rulesOrController instanceof validation_controller_1.ValidationController) { @@ -54,20 +30,17 @@ var ValidateBindingBehaviorBase = (function () { controller.registerBinding(binding, target, rules); binding.validationController = controller; var trigger = this.getValidateTrigger(controller); - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise if (trigger & validate_trigger_1.validateTrigger.change) { - /* tslint:enable:no-bitwise */ binding.standardUpdateSource = binding.updateSource; - /* tslint:disable:only-arrow-functions */ + // tslint:disable-next-line:only-arrow-functions binding.updateSource = function (value) { - /* tslint:enable:only-arrow-functions */ this.standardUpdateSource(value); this.validationController.validateBinding(this); }; } - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise if (trigger & validate_trigger_1.validateTrigger.blur) { - /* tslint:enable:no-bitwise */ binding.validateBlurHandler = function () { _this.taskQueue.queueMicroTask(function () { return controller.validateBinding(binding); }); }; @@ -76,9 +49,8 @@ var ValidateBindingBehaviorBase = (function () { } if (trigger !== validate_trigger_1.validateTrigger.manual) { binding.standardUpdateTarget = binding.updateTarget; - /* tslint:disable:only-arrow-functions */ + // tslint:disable-next-line:only-arrow-functions binding.updateTarget = function (value) { - /* tslint:enable:only-arrow-functions */ this.standardUpdateTarget(value); this.validationController.resetBinding(this); }; diff --git a/dist/commonjs/validate-binding-behavior.d.ts b/dist/commonjs/validate-binding-behavior.d.ts index 2d55c7ec..518186be 100644 --- a/dist/commonjs/validate-binding-behavior.d.ts +++ b/dist/commonjs/validate-binding-behavior.d.ts @@ -1,5 +1,6 @@ import { TaskQueue } from 'aurelia-task-queue'; import { ValidationController } from './validation-controller'; +import { validateTrigger } from './validate-trigger'; import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; /** * Binding behavior. Indicates the bound property should be validated @@ -8,7 +9,7 @@ import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; */ export declare class ValidateBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(controller: ValidationController): number; + getValidateTrigger(controller: ValidationController): validateTrigger; } /** * Binding behavior. Indicates the bound property will be validated @@ -17,7 +18,7 @@ export declare class ValidateBindingBehavior extends ValidateBindingBehaviorBase */ export declare class ValidateManuallyBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -25,7 +26,7 @@ export declare class ValidateManuallyBindingBehavior extends ValidateBindingBeha */ export declare class ValidateOnBlurBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -34,7 +35,7 @@ export declare class ValidateOnBlurBindingBehavior extends ValidateBindingBehavi */ export declare class ValidateOnChangeBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -43,5 +44,5 @@ export declare class ValidateOnChangeBindingBehavior extends ValidateBindingBeha */ export declare class ValidateOnChangeOrBlurBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } diff --git a/dist/commonjs/validate-binding-behavior.js b/dist/commonjs/validate-binding-behavior.js index 0f5aa1ff..de758966 100644 --- a/dist/commonjs/validate-binding-behavior.js +++ b/dist/commonjs/validate-binding-behavior.js @@ -1,9 +1,15 @@ "use strict"; -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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); 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"); @@ -15,7 +21,7 @@ var validate_binding_behavior_base_1 = require("./validate-binding-behavior-base var ValidateBindingBehavior = (function (_super) { __extends(ValidateBindingBehavior, _super); function ValidateBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateBindingBehavior.prototype.getValidateTrigger = function (controller) { return controller.validateTrigger; @@ -32,7 +38,7 @@ exports.ValidateBindingBehavior = ValidateBindingBehavior; var ValidateManuallyBindingBehavior = (function (_super) { __extends(ValidateManuallyBindingBehavior, _super); function ValidateManuallyBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateManuallyBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.manual; @@ -48,7 +54,7 @@ exports.ValidateManuallyBindingBehavior = ValidateManuallyBindingBehavior; var ValidateOnBlurBindingBehavior = (function (_super) { __extends(ValidateOnBlurBindingBehavior, _super); function ValidateOnBlurBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.blur; @@ -65,7 +71,7 @@ exports.ValidateOnBlurBindingBehavior = ValidateOnBlurBindingBehavior; var ValidateOnChangeBindingBehavior = (function (_super) { __extends(ValidateOnChangeBindingBehavior, _super); function ValidateOnChangeBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnChangeBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.change; @@ -82,7 +88,7 @@ exports.ValidateOnChangeBindingBehavior = ValidateOnChangeBindingBehavior; var ValidateOnChangeOrBlurBindingBehavior = (function (_super) { __extends(ValidateOnChangeOrBlurBindingBehavior, _super); function ValidateOnChangeOrBlurBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnChangeOrBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.changeOrBlur; diff --git a/dist/commonjs/validate-instruction.js b/dist/commonjs/validate-instruction.js index 3918c74e..c8ad2e54 100644 --- a/dist/commonjs/validate-instruction.js +++ b/dist/commonjs/validate-instruction.js @@ -1 +1,2 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/commonjs/validate-result.js b/dist/commonjs/validate-result.js index 82031a67..aa4b9e4f 100644 --- a/dist/commonjs/validate-result.js +++ b/dist/commonjs/validate-result.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); /** * The result of validating an individual validation rule. */ diff --git a/dist/commonjs/validate-trigger.d.ts b/dist/commonjs/validate-trigger.d.ts index 82c60096..43e76851 100644 --- a/dist/commonjs/validate-trigger.d.ts +++ b/dist/commonjs/validate-trigger.d.ts @@ -1,9 +1,23 @@ /** * Validation triggers. */ -export declare const validateTrigger: { - manual: number; - blur: number; - change: number; - changeOrBlur: number; -}; +export declare enum 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/commonjs/validate-trigger.js b/dist/commonjs/validate-trigger.js index 1d18fc8f..daf18282 100644 --- a/dist/commonjs/validate-trigger.js +++ b/dist/commonjs/validate-trigger.js @@ -1,24 +1,27 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); /** * Validation triggers. */ -exports.validateTrigger = { +var validateTrigger; +(function (validateTrigger) { /** * Manual validation. Use the controller's `validate()` and `reset()` methods * to validate all bindings. */ - manual: 0, + validateTrigger[validateTrigger["manual"] = 0] = "manual"; /** * Validate the binding when the binding's target element fires a DOM "blur" event. */ - blur: 1, + validateTrigger[validateTrigger["blur"] = 1] = "blur"; /** * Validate the binding when it updates the model due to a change in the view. */ - change: 2, + validateTrigger[validateTrigger["change"] = 2] = "change"; /** * 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 -}; + validateTrigger[validateTrigger["changeOrBlur"] = 3] = "changeOrBlur"; +})(validateTrigger = exports.validateTrigger || (exports.validateTrigger = {})); +; diff --git a/dist/commonjs/validation-controller-factory.js b/dist/commonjs/validation-controller-factory.js index c2ca0172..40b0533a 100644 --- a/dist/commonjs/validation-controller-factory.js +++ b/dist/commonjs/validation-controller-factory.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); var validation_controller_1 = require("./validation-controller"); var validator_1 = require("./validator"); /** diff --git a/dist/commonjs/validation-controller.d.ts b/dist/commonjs/validation-controller.d.ts index d88935e5..86dccc2c 100644 --- a/dist/commonjs/validation-controller.d.ts +++ b/dist/commonjs/validation-controller.d.ts @@ -1,5 +1,6 @@ import { Binding } from 'aurelia-binding'; import { Validator } from './validator'; +import { validateTrigger } from './validate-trigger'; import { ValidationRenderer } from './validation-renderer'; import { ValidateResult } from './validate-result'; import { ValidateInstruction } from './validate-instruction'; @@ -31,7 +32,7 @@ export declare class ValidationController { /** * The trigger that will invoke automatic validation of a property used in a binding. */ - validateTrigger: number; + validateTrigger: validateTrigger; private finishValidating; constructor(validator: Validator); /** diff --git a/dist/commonjs/validation-controller.js b/dist/commonjs/validation-controller.js index cca70ccb..1689a005 100644 --- a/dist/commonjs/validation-controller.js +++ b/dist/commonjs/validation-controller.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); var validator_1 = require("./validator"); var validate_trigger_1 = require("./validate-trigger"); var property_info_1 = require("./property-info"); @@ -148,6 +149,7 @@ var ValidationController = (function () { // Get a function that will process the validation instruction. var execute; if (instruction) { + // tslint:disable-next-line:prefer-const 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); @@ -258,7 +260,7 @@ var ValidationController = (function () { } } else { - // there is a corresponding new result... + // 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); @@ -310,7 +312,7 @@ var ValidationController = (function () { return; } var propertyInfo = property_info_1.getPropertyInfo(binding.sourceExpression, binding.source); - var rules = undefined; + var rules; var registeredBinding = this.bindings.get(binding); if (registeredBinding) { rules = registeredBinding.rules; diff --git a/dist/commonjs/validation-errors-custom-attribute.d.ts b/dist/commonjs/validation-errors-custom-attribute.d.ts index 73340e73..57c020a0 100644 --- a/dist/commonjs/validation-errors-custom-attribute.d.ts +++ b/dist/commonjs/validation-errors-custom-attribute.d.ts @@ -13,11 +13,10 @@ export declare class ValidationErrorsCustomAttribute implements ValidationRender new (): Element; prototype: Element; } | Lazy)[]; - value: RenderedError[]; + controller: ValidationController | null; errors: RenderedError[]; - constructor(boundaryElement: Element, controllerAccessor: { - (): ValidationController; - }); + private errorsInternal; + constructor(boundaryElement: Element, controllerAccessor: () => ValidationController); sort(): void; interestingElements(elements: Element[]): Element[]; render(instruction: RenderInstruction): void; diff --git a/dist/commonjs/validation-errors-custom-attribute.js b/dist/commonjs/validation-errors-custom-attribute.js index 55a54a29..241481d2 100644 --- a/dist/commonjs/validation-errors-custom-attribute.js +++ b/dist/commonjs/validation-errors-custom-attribute.js @@ -5,24 +5,27 @@ 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; }; +Object.defineProperty(exports, "__esModule", { value: true }); 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_pal_1 = require("aurelia-pal"); var ValidationErrorsCustomAttribute = (function () { function ValidationErrorsCustomAttribute(boundaryElement, controllerAccessor) { this.boundaryElement = boundaryElement; this.controllerAccessor = controllerAccessor; + this.controller = null; this.errors = []; + this.errorsInternal = []; } ValidationErrorsCustomAttribute.prototype.sort = function () { - this.errors.sort(function (a, b) { + this.errorsInternal.sort(function (a, b) { if (a.targets[0] === b.targets[0]) { return 0; } - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise return a.targets[0].compareDocumentPosition(b.targets[0]) & 2 ? 1 : -1; - /* tslint:enable:no-bitwise */ }); }; ValidationErrorsCustomAttribute.prototype.interestingElements = function (elements) { @@ -31,9 +34,9 @@ var ValidationErrorsCustomAttribute = (function () { }; ValidationErrorsCustomAttribute.prototype.render = function (instruction) { var _loop_1 = function (result) { - var index = this_1.errors.findIndex(function (x) { return x.error === result; }); + var index = this_1.errorsInternal.findIndex(function (x) { return x.error === result; }); if (index !== -1) { - this_1.errors.splice(index, 1); + this_1.errorsInternal.splice(index, 1); } }; var this_1 = this; @@ -48,23 +51,34 @@ var ValidationErrorsCustomAttribute = (function () { } var targets = this.interestingElements(elements); if (targets.length) { - this.errors.push({ error: result, targets: targets }); + this.errorsInternal.push({ error: result, targets: targets }); } } this.sort(); - this.value = this.errors; + this.errors = this.errorsInternal; }; ValidationErrorsCustomAttribute.prototype.bind = function () { - this.controllerAccessor().addRenderer(this); - this.value = this.errors; + if (!this.controller) { + this.controller = this.controllerAccessor(); + } + // this will call render() with the side-effect of updating this.errors + this.controller.addRenderer(this); }; ValidationErrorsCustomAttribute.prototype.unbind = function () { - this.controllerAccessor().removeRenderer(this); + if (this.controller) { + this.controller.removeRenderer(this); + } }; return ValidationErrorsCustomAttribute; }()); -ValidationErrorsCustomAttribute.inject = [Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; +ValidationErrorsCustomAttribute.inject = [aurelia_pal_1.DOM.Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; +__decorate([ + aurelia_templating_1.bindable({ defaultBindingMode: aurelia_binding_1.bindingMode.oneWay }) +], ValidationErrorsCustomAttribute.prototype, "controller", void 0); +__decorate([ + aurelia_templating_1.bindable({ primaryProperty: true, defaultBindingMode: aurelia_binding_1.bindingMode.twoWay }) +], ValidationErrorsCustomAttribute.prototype, "errors", void 0); ValidationErrorsCustomAttribute = __decorate([ - aurelia_templating_1.customAttribute('validation-errors', aurelia_binding_1.bindingMode.twoWay) + aurelia_templating_1.customAttribute('validation-errors') ], ValidationErrorsCustomAttribute); exports.ValidationErrorsCustomAttribute = ValidationErrorsCustomAttribute; diff --git a/dist/commonjs/validation-renderer-custom-attribute.js b/dist/commonjs/validation-renderer-custom-attribute.js index b9b45e61..e86d851d 100644 --- a/dist/commonjs/validation-renderer-custom-attribute.js +++ b/dist/commonjs/validation-renderer-custom-attribute.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); var validation_controller_1 = require("./validation-controller"); var ValidationRendererCustomAttribute = (function () { function ValidationRendererCustomAttribute() { diff --git a/dist/commonjs/validation-renderer.js b/dist/commonjs/validation-renderer.js index 3918c74e..c8ad2e54 100644 --- a/dist/commonjs/validation-renderer.js +++ b/dist/commonjs/validation-renderer.js @@ -1 +1,2 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/commonjs/validator.js b/dist/commonjs/validator.js index 2aa10d90..c9e81447 100644 --- a/dist/commonjs/validator.js +++ b/dist/commonjs/validator.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); /** * Validates objects and properties. */ diff --git a/dist/es2015/aurelia-validation.d.ts b/dist/es2015/aurelia-validation.d.ts index 9897cc10..be93a23a 100644 --- a/dist/es2015/aurelia-validation.d.ts +++ b/dist/es2015/aurelia-validation.d.ts @@ -1,4 +1,5 @@ export * from './controller-validate-result'; +export * from './get-target-dom-element'; export * from './property-info'; export * from './validate-binding-behavior'; export * from './validate-instruction'; @@ -39,5 +40,5 @@ export declare class AureliaValidationConfiguration { */ export declare function configure(frameworkConfig: { container: Container; - globalResources: (...resources: string[]) => any; + globalResources?: (...resources: string[]) => any; }, callback?: (config: AureliaValidationConfiguration) => void): void; diff --git a/dist/es2015/aurelia-validation.js b/dist/es2015/aurelia-validation.js index 82b3b9be..94c4b184 100644 --- a/dist/es2015/aurelia-validation.js +++ b/dist/es2015/aurelia-validation.js @@ -1,4 +1,5 @@ // Exports +export * from './get-target-dom-element'; export * from './property-info'; export * from './validate-binding-behavior'; export * from './validate-result'; @@ -13,6 +14,8 @@ export * from './implementation/standard-validator'; export * from './implementation/validation-messages'; export * from './implementation/validation-parser'; export * from './implementation/validation-rules'; +// Configuration +import { PLATFORM } from 'aurelia-pal'; import { Validator } from './validator'; import { StandardValidator } from './implementation/standard-validator'; import { ValidationParser } from './implementation/validation-parser'; @@ -43,7 +46,7 @@ export class AureliaValidationConfiguration { */ export function configure(frameworkConfig, callback) { // the fluent rule definition API needs the parser to translate messages - // to interpolation expressions. + // to interpolation expressions. const parser = frameworkConfig.container.get(ValidationParser); ValidationRules.initialize(parser); // configure... @@ -53,5 +56,7 @@ export function configure(frameworkConfig, callback) { } config.apply(frameworkConfig.container); // globalize the behaviors. - frameworkConfig.globalResources('./validate-binding-behavior', './validation-errors-custom-attribute', './validation-renderer-custom-attribute'); + if (frameworkConfig.globalResources) { + frameworkConfig.globalResources(PLATFORM.moduleName('./validate-binding-behavior'), PLATFORM.moduleName('./validation-errors-custom-attribute'), PLATFORM.moduleName('./validation-renderer-custom-attribute')); + } } diff --git a/dist/es2015/get-target-dom-element.d.ts b/dist/es2015/get-target-dom-element.d.ts new file mode 100644 index 00000000..314fc952 --- /dev/null +++ b/dist/es2015/get-target-dom-element.d.ts @@ -0,0 +1,7 @@ +/** + * 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. + */ +export declare function getTargetDOMElement(binding: any, view: any): Element; diff --git a/dist/es2015/get-target-dom-element.js b/dist/es2015/get-target-dom-element.js new file mode 100644 index 00000000..2b976f87 --- /dev/null +++ b/dist/es2015/get-target-dom-element.js @@ -0,0 +1,27 @@ +import { DOM } from 'aurelia-pal'; +/** + * 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. + */ +export function getTargetDOMElement(binding, view) { + const target = binding.target; + // DOM element + if (target instanceof Element) { + return target; + } + // custom element or custom attribute + // tslint:disable-next-line:prefer-const + for (let i = 0, ii = view.controllers.length; i < ii; i++) { + const controller = view.controllers[i]; + if (controller.viewModel === target) { + const 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}".`); +} diff --git a/dist/es2015/implementation/rule.d.ts b/dist/es2015/implementation/rule.d.ts index 8bba9d76..eec3b823 100644 --- a/dist/es2015/implementation/rule.d.ts +++ b/dist/es2015/implementation/rule.d.ts @@ -1,4 +1,5 @@ import { Expression } from 'aurelia-binding'; +export declare type ValidationDisplayNameAccessor = () => string; /** * Information related to a property that is the subject of validation. */ @@ -10,7 +11,7 @@ export interface RuleProperty { /** * The displayName of the property (or object). */ - displayName: string | null; + displayName: string | ValidationDisplayNameAccessor | null; } /** * A rule definition. Associations a rule with a property or object. @@ -19,9 +20,7 @@ export interface Rule { property: RuleProperty; condition: (value: TValue, object?: TObject) => boolean | Promise; config: Object; - when: { - (object: TObject): boolean; - } | null; + when: ((object: TObject) => boolean) | null; messageKey: string; message: Expression | null; sequence: number; diff --git a/dist/es2015/implementation/standard-validator.js b/dist/es2015/implementation/standard-validator.js index 933e59a4..4a86be1c 100644 --- a/dist/es2015/implementation/standard-validator.js +++ b/dist/es2015/implementation/standard-validator.js @@ -49,6 +49,7 @@ export class StandardValidator extends Validator { } getMessage(rule, object, value) { const expression = rule.message || this.messageProvider.getMessage(rule.messageKey); + // tslint:disable-next-line:prefer-const let { name: propertyName, displayName } = rule.property; if (propertyName !== null) { displayName = this.messageProvider.getDisplayName(propertyName, displayName); @@ -59,6 +60,8 @@ export class StandardValidator extends Validator { $value: value, $object: object, $config: rule.config, + // returns the name of a given property, given just the property name (irrespective of the property's displayName) + // split on capital letters, first letter ensured to be capitalized $getDisplayName: this.getDisplayName }; return expression.evaluate({ bindingContext: object, overrideContext }, this.lookupFunctions); diff --git a/dist/es2015/implementation/validation-messages.d.ts b/dist/es2015/implementation/validation-messages.d.ts index 7a0978d7..6226bd15 100644 --- a/dist/es2015/implementation/validation-messages.d.ts +++ b/dist/es2015/implementation/validation-messages.d.ts @@ -25,5 +25,5 @@ export declare class ValidationMessageProvider { * Override this with your own custom logic. * @param propertyName The property name. */ - getDisplayName(propertyName: string, displayName: string | null | undefined): string; + getDisplayName(propertyName: string, displayName?: string | null | Function): string; } diff --git a/dist/es2015/implementation/validation-messages.js b/dist/es2015/implementation/validation-messages.js index a1dda6ea..b8fb3f25 100644 --- a/dist/es2015/implementation/validation-messages.js +++ b/dist/es2015/implementation/validation-messages.js @@ -45,7 +45,7 @@ export class ValidationMessageProvider { */ getDisplayName(propertyName, displayName) { if (displayName !== null && displayName !== undefined) { - return displayName; + return (displayName instanceof Function) ? displayName() : displayName; } // split on upper-case letters. const words = propertyName.split(/(?=[A-Z])/).join(' '); diff --git a/dist/es2015/implementation/validation-parser.d.ts b/dist/es2015/implementation/validation-parser.d.ts index 75b2c7af..255414a6 100644 --- a/dist/es2015/implementation/validation-parser.d.ts +++ b/dist/es2015/implementation/validation-parser.d.ts @@ -1,9 +1,7 @@ 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 type PropertyAccessor = (object: TObject) => TValue; export declare class ValidationParser { private parser; private bindinqLanguage; diff --git a/dist/es2015/implementation/validation-parser.js b/dist/es2015/implementation/validation-parser.js index 48666130..7f22e500 100644 --- a/dist/es2015/implementation/validation-parser.js +++ b/dist/es2015/implementation/validation-parser.js @@ -46,7 +46,9 @@ export class ValidationParser { 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*\}$/; + /* tslint:disable:max-line-length */ + const classic = /^function\s*\([$_\w\d]+\)\s*\{(?:\s*"use strict";)?\s*(?:[$_\w\d.['"\]+;]+)?\s*return\s+[$_\w\d]+\.([$_\w\d]+)\s*;?\s*\}$/; + /* tslint:enable:max-line-length */ const arrow = /^\(?[$_\w\d]+\)?\s*=>\s*[$_\w\d]+\.([$_\w\d]+)$/; const match = classic.exec(fn) || arrow.exec(fn); if (match === null) { diff --git a/dist/es2015/implementation/validation-rules.d.ts b/dist/es2015/implementation/validation-rules.d.ts index 13251d4d..67ea1021 100644 --- a/dist/es2015/implementation/validation-rules.d.ts +++ b/dist/es2015/implementation/validation-rules.d.ts @@ -1,5 +1,6 @@ import { Rule, RuleProperty } from './rule'; import { ValidationParser, PropertyAccessor } from './validation-parser'; +import { ValidationDisplayNameAccessor } from './rule'; /** * Part of the fluent rule API. Enables customizing property rules. */ @@ -8,7 +9,7 @@ export declare class FluentRuleCustomizer { private fluentRules; private parser; private rule; - constructor(property: RuleProperty, condition: (value: TValue, object?: TObject) => boolean | Promise, config: Object, fluentEnsure: FluentEnsure, fluentRules: FluentRules, parser: ValidationParser); + constructor(property: RuleProperty, condition: (value: TValue, object?: TObject) => boolean | Promise, config: Object | undefined, fluentEnsure: FluentEnsure, fluentRules: FluentRules, parser: ValidationParser); /** * Validate subsequent rules after previously declared rules have * been validated successfully. Use to postpone validation of costly @@ -38,9 +39,7 @@ export declare class FluentRuleCustomizer { * 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; + ensure(subject: string | ((model: TObject) => TValue2)): FluentRules; /** * Targets an object with validation rules. */ @@ -66,7 +65,7 @@ export declare class FluentRuleCustomizer { * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; + satisfiesRule(name: string, ...args: any[]): any; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. @@ -132,7 +131,7 @@ export declare class FluentRules { /** * Sets the display name of the ensured property. */ - displayName(name: string): this; + displayName(name: string | ValidationDisplayNameAccessor | null): this; /** * Applies an ad-hoc rule function to the ensured property or object. * @param condition The function to validate the rule. @@ -145,7 +144,7 @@ export declare class FluentRules { * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; + satisfiesRule(name: string, ...args: any[]): any; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. @@ -213,10 +212,6 @@ export declare class FluentEnsure { * @param target A class or object. */ on(target: any): this; - /** - * Adds a rule definition to the sequenced ruleset. - */ - _addRule(rule: Rule): void; private assertInitialized(); } /** diff --git a/dist/es2015/implementation/validation-rules.js b/dist/es2015/implementation/validation-rules.js index 99481e5f..041b1bfb 100644 --- a/dist/es2015/implementation/validation-rules.js +++ b/dist/es2015/implementation/validation-rules.js @@ -322,6 +322,7 @@ export class FluentEnsure { } /** * Adds a rule definition to the sequenced ruleset. + * @internal */ _addRule(rule) { while (this.rules.length < rule.sequence + 1) { @@ -333,7 +334,7 @@ export class FluentEnsure { 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?`); } } /** diff --git a/dist/es2015/property-info.js b/dist/es2015/property-info.js index 60963a5f..fc90014e 100644 --- a/dist/es2015/property-info.js +++ b/dist/es2015/property-info.js @@ -1,12 +1,11 @@ import { AccessMember, AccessScope, AccessKeyed, BindingBehavior, ValueConverter } from 'aurelia-binding'; function getObject(expression, objectExpression, source) { - let value = objectExpression.evaluate(source, null); + const value = objectExpression.evaluate(source, null); if (value === null || value === undefined || value instanceof Object) { return value; } - /* tslint:disable */ + // tslint:disable-next-line:max-line-length 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. diff --git a/dist/es2015/validate-binding-behavior-base.d.ts b/dist/es2015/validate-binding-behavior-base.d.ts index 09c18430..971c8e83 100644 --- a/dist/es2015/validate-binding-behavior-base.d.ts +++ b/dist/es2015/validate-binding-behavior-base.d.ts @@ -1,19 +1,13 @@ import { TaskQueue } from 'aurelia-task-queue'; import { ValidationController } from './validation-controller'; +import { validateTrigger } from './validate-trigger'; /** * 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; + protected abstract getValidateTrigger(controller: ValidationController): validateTrigger; bind(binding: any, source: any, rulesOrController?: ValidationController | any, rules?: any): void; unbind(binding: any): void; } diff --git a/dist/es2015/validate-binding-behavior-base.js b/dist/es2015/validate-binding-behavior-base.js index 991f7c52..ab4fc5f8 100644 --- a/dist/es2015/validate-binding-behavior-base.js +++ b/dist/es2015/validate-binding-behavior-base.js @@ -1,7 +1,7 @@ import { Optional } from 'aurelia-dependency-injection'; -import { DOM } from 'aurelia-pal'; import { ValidationController } from './validation-controller'; import { validateTrigger } from './validate-trigger'; +import { getTargetDOMElement } from './get-target-dom-element'; /** * Binding behavior. Indicates the bound property should be validated. */ @@ -9,34 +9,9 @@ export class ValidateBindingBehaviorBase { constructor(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. - */ - getTarget(binding, view) { - const 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]; - if (controller.viewModel === target) { - const 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}".`); - } bind(binding, source, rulesOrController, rules) { // identify the target element. - const target = this.getTarget(binding, source); + const target = getTargetDOMElement(binding, source); // locate the controller. let controller; if (rulesOrController instanceof ValidationController) { @@ -52,20 +27,17 @@ export class ValidateBindingBehaviorBase { controller.registerBinding(binding, target, rules); binding.validationController = controller; const trigger = this.getValidateTrigger(controller); - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise if (trigger & validateTrigger.change) { - /* tslint:enable:no-bitwise */ binding.standardUpdateSource = binding.updateSource; - /* tslint:disable:only-arrow-functions */ + // tslint:disable-next-line:only-arrow-functions binding.updateSource = function (value) { - /* tslint:enable:only-arrow-functions */ this.standardUpdateSource(value); this.validationController.validateBinding(this); }; } - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise if (trigger & validateTrigger.blur) { - /* tslint:enable:no-bitwise */ binding.validateBlurHandler = () => { this.taskQueue.queueMicroTask(() => controller.validateBinding(binding)); }; @@ -74,9 +46,8 @@ export class ValidateBindingBehaviorBase { } if (trigger !== validateTrigger.manual) { binding.standardUpdateTarget = binding.updateTarget; - /* tslint:disable:only-arrow-functions */ + // tslint:disable-next-line:only-arrow-functions binding.updateTarget = function (value) { - /* tslint:enable:only-arrow-functions */ this.standardUpdateTarget(value); this.validationController.resetBinding(this); }; diff --git a/dist/es2015/validate-binding-behavior.d.ts b/dist/es2015/validate-binding-behavior.d.ts index 2d55c7ec..518186be 100644 --- a/dist/es2015/validate-binding-behavior.d.ts +++ b/dist/es2015/validate-binding-behavior.d.ts @@ -1,5 +1,6 @@ import { TaskQueue } from 'aurelia-task-queue'; import { ValidationController } from './validation-controller'; +import { validateTrigger } from './validate-trigger'; import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; /** * Binding behavior. Indicates the bound property should be validated @@ -8,7 +9,7 @@ import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; */ export declare class ValidateBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(controller: ValidationController): number; + getValidateTrigger(controller: ValidationController): validateTrigger; } /** * Binding behavior. Indicates the bound property will be validated @@ -17,7 +18,7 @@ export declare class ValidateBindingBehavior extends ValidateBindingBehaviorBase */ export declare class ValidateManuallyBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -25,7 +26,7 @@ export declare class ValidateManuallyBindingBehavior extends ValidateBindingBeha */ export declare class ValidateOnBlurBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -34,7 +35,7 @@ export declare class ValidateOnBlurBindingBehavior extends ValidateBindingBehavi */ export declare class ValidateOnChangeBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -43,5 +44,5 @@ export declare class ValidateOnChangeBindingBehavior extends ValidateBindingBeha */ export declare class ValidateOnChangeOrBlurBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } diff --git a/dist/es2015/validate-trigger.d.ts b/dist/es2015/validate-trigger.d.ts index 82c60096..43e76851 100644 --- a/dist/es2015/validate-trigger.d.ts +++ b/dist/es2015/validate-trigger.d.ts @@ -1,9 +1,23 @@ /** * Validation triggers. */ -export declare const validateTrigger: { - manual: number; - blur: number; - change: number; - changeOrBlur: number; -}; +export declare enum 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/es2015/validate-trigger.js b/dist/es2015/validate-trigger.js index 5cc334cc..12b9b94f 100644 --- a/dist/es2015/validate-trigger.js +++ b/dist/es2015/validate-trigger.js @@ -3,23 +3,25 @@ */ /** * Validation triggers. - */ export const validateTrigger = { + */ export var validateTrigger; +(function (validateTrigger) { /** * Manual validation. Use the controller's `validate()` and `reset()` methods * to validate all bindings. */ - manual: 0, + validateTrigger[validateTrigger["manual"] = 0] = "manual"; /** * Validate the binding when the binding's target element fires a DOM "blur" event. */ - blur: 1, + validateTrigger[validateTrigger["blur"] = 1] = "blur"; /** * Validate the binding when it updates the model due to a change in the view. */ - change: 2, + validateTrigger[validateTrigger["change"] = 2] = "change"; /** * 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 -}; + validateTrigger[validateTrigger["changeOrBlur"] = 3] = "changeOrBlur"; +})(validateTrigger || (validateTrigger = {})); +; diff --git a/dist/es2015/validation-controller.d.ts b/dist/es2015/validation-controller.d.ts index d88935e5..86dccc2c 100644 --- a/dist/es2015/validation-controller.d.ts +++ b/dist/es2015/validation-controller.d.ts @@ -1,5 +1,6 @@ import { Binding } from 'aurelia-binding'; import { Validator } from './validator'; +import { validateTrigger } from './validate-trigger'; import { ValidationRenderer } from './validation-renderer'; import { ValidateResult } from './validate-result'; import { ValidateInstruction } from './validate-instruction'; @@ -31,7 +32,7 @@ export declare class ValidationController { /** * The trigger that will invoke automatic validation of a property used in a binding. */ - validateTrigger: number; + validateTrigger: validateTrigger; private finishValidating; constructor(validator: Validator); /** diff --git a/dist/es2015/validation-controller.js b/dist/es2015/validation-controller.js index e9191bf1..20033b97 100644 --- a/dist/es2015/validation-controller.js +++ b/dist/es2015/validation-controller.js @@ -142,6 +142,7 @@ export class ValidationController { // Get a function that will process the validation instruction. let execute; if (instruction) { + // tslint:disable-next-line:prefer-const let { object, propertyName, rules } = instruction; // if rules were not specified, check the object map. rules = rules || this.objects.get(object); @@ -159,10 +160,10 @@ export class ValidationController { // validate all objects and bindings. execute = () => { const promises = []; - for (let [object, rules] of Array.from(this.objects)) { + for (const [object, rules] of Array.from(this.objects)) { promises.push(this.validator.validateObject(object, rules)); } - for (let [binding, { rules }] of Array.from(this.bindings)) { + for (const [binding, { rules }] of Array.from(this.bindings)) { const propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); if (!propertyInfo || this.objects.has(propertyInfo.object)) { continue; @@ -174,7 +175,7 @@ export class ValidationController { } // Wait for any existing validation to finish, execute the instruction, render the results. this.validating = true; - let returnPromise = this.finishValidating + const returnPromise = this.finishValidating .then(execute) .then((newResults) => { const predicate = this.getInstructionPredicate(instruction); @@ -214,7 +215,7 @@ export class ValidationController { */ getAssociatedElements({ object, propertyName }) { const elements = []; - for (let [binding, { target }] of Array.from(this.bindings)) { + for (const [binding, { target }] of Array.from(this.bindings)) { const propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); if (propertyInfo && propertyInfo.object === object && propertyInfo.propertyName === propertyName) { elements.push(target); @@ -232,7 +233,7 @@ export class ValidationController { // create a shallow copy of newResults so we can mutate it without causing side-effects. newResults = newResults.slice(0); // create unrender instructions from the old results. - for (let oldResult of oldResults) { + for (const oldResult of oldResults) { // get the elements associated with the old result. const elements = this.elements.get(oldResult); // remove the old result from the element map. @@ -249,7 +250,7 @@ export class ValidationController { } } else { - // there is a corresponding new result... + // there is a corresponding new result... const newResult = newResults.splice(newResultIndex, 1)[0]; // get the elements that are associated with the new result. const elements = this.getAssociatedElements(newResult); @@ -271,7 +272,7 @@ export class ValidationController { } } // create render instructions from the remaining new results. - for (let result of newResults) { + for (const result of newResults) { const elements = this.getAssociatedElements(result); instruction.render.push({ result, elements }); this.elements.set(result, elements); @@ -281,7 +282,7 @@ export class ValidationController { } } // render. - for (let renderer of this.renderers) { + for (const renderer of this.renderers) { renderer.render(instruction); } } @@ -292,8 +293,8 @@ export class ValidationController { if (!binding.isBound) { return; } - let propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); - let rules = undefined; + const propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); + let rules; const registeredBinding = this.bindings.get(binding); if (registeredBinding) { rules = registeredBinding.rules; diff --git a/dist/es2015/validation-errors-custom-attribute.d.ts b/dist/es2015/validation-errors-custom-attribute.d.ts index 73340e73..57c020a0 100644 --- a/dist/es2015/validation-errors-custom-attribute.d.ts +++ b/dist/es2015/validation-errors-custom-attribute.d.ts @@ -13,11 +13,10 @@ export declare class ValidationErrorsCustomAttribute implements ValidationRender new (): Element; prototype: Element; } | Lazy)[]; - value: RenderedError[]; + controller: ValidationController | null; errors: RenderedError[]; - constructor(boundaryElement: Element, controllerAccessor: { - (): ValidationController; - }); + private errorsInternal; + constructor(boundaryElement: Element, controllerAccessor: () => ValidationController); sort(): void; interestingElements(elements: Element[]): Element[]; render(instruction: RenderInstruction): void; diff --git a/dist/es2015/validation-errors-custom-attribute.js b/dist/es2015/validation-errors-custom-attribute.js index 46765f57..ef8775ae 100644 --- a/dist/es2015/validation-errors-custom-attribute.js +++ b/dist/es2015/validation-errors-custom-attribute.js @@ -6,56 +6,69 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, }; import { bindingMode } from 'aurelia-binding'; import { Lazy } from 'aurelia-dependency-injection'; -import { customAttribute } from 'aurelia-templating'; +import { customAttribute, bindable } from 'aurelia-templating'; import { ValidationController } from './validation-controller'; +import { DOM } from 'aurelia-pal'; let ValidationErrorsCustomAttribute = class ValidationErrorsCustomAttribute { constructor(boundaryElement, controllerAccessor) { this.boundaryElement = boundaryElement; this.controllerAccessor = controllerAccessor; + this.controller = null; this.errors = []; + this.errorsInternal = []; } sort() { - this.errors.sort((a, b) => { + this.errorsInternal.sort((a, b) => { if (a.targets[0] === b.targets[0]) { return 0; } - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise 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 { result } of instruction.unrender) { - const index = this.errors.findIndex(x => x.error === result); + for (const { result } of instruction.unrender) { + const index = this.errorsInternal.findIndex(x => x.error === result); if (index !== -1) { - this.errors.splice(index, 1); + this.errorsInternal.splice(index, 1); } } - for (let { result, elements } of instruction.render) { + for (const { result, elements } of instruction.render) { if (result.valid) { continue; } const targets = this.interestingElements(elements); if (targets.length) { - this.errors.push({ error: result, targets }); + this.errorsInternal.push({ error: result, targets }); } } this.sort(); - this.value = this.errors; + this.errors = this.errorsInternal; } bind() { - this.controllerAccessor().addRenderer(this); - this.value = this.errors; + if (!this.controller) { + this.controller = this.controllerAccessor(); + } + // this will call render() with the side-effect of updating this.errors + this.controller.addRenderer(this); } unbind() { - this.controllerAccessor().removeRenderer(this); + if (this.controller) { + this.controller.removeRenderer(this); + } } }; -ValidationErrorsCustomAttribute.inject = [Element, Lazy.of(ValidationController)]; +ValidationErrorsCustomAttribute.inject = [DOM.Element, Lazy.of(ValidationController)]; +__decorate([ + bindable({ defaultBindingMode: bindingMode.oneWay }) +], ValidationErrorsCustomAttribute.prototype, "controller", void 0); +__decorate([ + bindable({ primaryProperty: true, defaultBindingMode: bindingMode.twoWay }) +], ValidationErrorsCustomAttribute.prototype, "errors", void 0); ValidationErrorsCustomAttribute = __decorate([ - customAttribute('validation-errors', bindingMode.twoWay) + customAttribute('validation-errors') ], ValidationErrorsCustomAttribute); export { ValidationErrorsCustomAttribute }; diff --git a/dist/native-modules/aurelia-validation.d.ts b/dist/native-modules/aurelia-validation.d.ts index 9897cc10..be93a23a 100644 --- a/dist/native-modules/aurelia-validation.d.ts +++ b/dist/native-modules/aurelia-validation.d.ts @@ -1,4 +1,5 @@ export * from './controller-validate-result'; +export * from './get-target-dom-element'; export * from './property-info'; export * from './validate-binding-behavior'; export * from './validate-instruction'; @@ -39,5 +40,5 @@ export declare class AureliaValidationConfiguration { */ export declare function configure(frameworkConfig: { container: Container; - globalResources: (...resources: string[]) => any; + 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 index 0e7313fd..e08d021d 100644 --- a/dist/native-modules/aurelia-validation.js +++ b/dist/native-modules/aurelia-validation.js @@ -1,4 +1,5 @@ // Exports +export * from './get-target-dom-element'; export * from './property-info'; export * from './validate-binding-behavior'; export * from './validate-result'; @@ -13,6 +14,8 @@ export * from './implementation/standard-validator'; export * from './implementation/validation-messages'; export * from './implementation/validation-parser'; export * from './implementation/validation-rules'; +// Configuration +import { PLATFORM } from 'aurelia-pal'; import { Validator } from './validator'; import { StandardValidator } from './implementation/standard-validator'; import { ValidationParser } from './implementation/validation-parser'; @@ -45,7 +48,7 @@ export { AureliaValidationConfiguration }; */ export function configure(frameworkConfig, callback) { // the fluent rule definition API needs the parser to translate messages - // to interpolation expressions. + // to interpolation expressions. var parser = frameworkConfig.container.get(ValidationParser); ValidationRules.initialize(parser); // configure... @@ -55,5 +58,7 @@ export function configure(frameworkConfig, callback) { } config.apply(frameworkConfig.container); // globalize the behaviors. - frameworkConfig.globalResources('./validate-binding-behavior', './validation-errors-custom-attribute', './validation-renderer-custom-attribute'); + if (frameworkConfig.globalResources) { + frameworkConfig.globalResources(PLATFORM.moduleName('./validate-binding-behavior'), PLATFORM.moduleName('./validation-errors-custom-attribute'), PLATFORM.moduleName('./validation-renderer-custom-attribute')); + } } diff --git a/dist/native-modules/get-target-dom-element.d.ts b/dist/native-modules/get-target-dom-element.d.ts new file mode 100644 index 00000000..314fc952 --- /dev/null +++ b/dist/native-modules/get-target-dom-element.d.ts @@ -0,0 +1,7 @@ +/** + * 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. + */ +export declare function getTargetDOMElement(binding: any, view: any): Element; diff --git a/dist/native-modules/get-target-dom-element.js b/dist/native-modules/get-target-dom-element.js new file mode 100644 index 00000000..6df9d16a --- /dev/null +++ b/dist/native-modules/get-target-dom-element.js @@ -0,0 +1,27 @@ +import { DOM } from 'aurelia-pal'; +/** + * 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. + */ +export function getTargetDOMElement(binding, view) { + var target = binding.target; + // DOM element + if (target instanceof Element) { + return target; + } + // custom element or custom attribute + // tslint:disable-next-line:prefer-const + 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 + "\"."); +} diff --git a/dist/native-modules/implementation/rule.d.ts b/dist/native-modules/implementation/rule.d.ts index 8bba9d76..eec3b823 100644 --- a/dist/native-modules/implementation/rule.d.ts +++ b/dist/native-modules/implementation/rule.d.ts @@ -1,4 +1,5 @@ import { Expression } from 'aurelia-binding'; +export declare type ValidationDisplayNameAccessor = () => string; /** * Information related to a property that is the subject of validation. */ @@ -10,7 +11,7 @@ export interface RuleProperty { /** * The displayName of the property (or object). */ - displayName: string | null; + displayName: string | ValidationDisplayNameAccessor | null; } /** * A rule definition. Associations a rule with a property or object. @@ -19,9 +20,7 @@ export interface Rule { property: RuleProperty; condition: (value: TValue, object?: TObject) => boolean | Promise; config: Object; - when: { - (object: TObject): boolean; - } | null; + when: ((object: TObject) => boolean) | null; messageKey: string; message: Expression | null; sequence: number; diff --git a/dist/native-modules/implementation/standard-validator.js b/dist/native-modules/implementation/standard-validator.js index e27592d6..71632457 100644 --- a/dist/native-modules/implementation/standard-validator.js +++ b/dist/native-modules/implementation/standard-validator.js @@ -1,8 +1,13 @@ -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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + 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 { ValidateResult } from '../validate-result'; @@ -56,6 +61,7 @@ var StandardValidator = (function (_super) { }; StandardValidator.prototype.getMessage = function (rule, object, value) { var expression = rule.message || this.messageProvider.getMessage(rule.messageKey); + // tslint:disable-next-line:prefer-const var _a = rule.property, propertyName = _a.name, displayName = _a.displayName; if (propertyName !== null) { displayName = this.messageProvider.getDisplayName(propertyName, displayName); @@ -66,6 +72,8 @@ var StandardValidator = (function (_super) { $value: value, $object: object, $config: rule.config, + // returns the name of a given property, given just the property name (irrespective of the property's displayName) + // split on capital letters, first letter ensured to be capitalized $getDisplayName: this.getDisplayName }; return expression.evaluate({ bindingContext: object, overrideContext: overrideContext }, this.lookupFunctions); diff --git a/dist/native-modules/implementation/validation-messages.d.ts b/dist/native-modules/implementation/validation-messages.d.ts index 7a0978d7..6226bd15 100644 --- a/dist/native-modules/implementation/validation-messages.d.ts +++ b/dist/native-modules/implementation/validation-messages.d.ts @@ -25,5 +25,5 @@ export declare class ValidationMessageProvider { * Override this with your own custom logic. * @param propertyName The property name. */ - getDisplayName(propertyName: string, displayName: string | null | undefined): string; + getDisplayName(propertyName: string, displayName?: string | null | Function): string; } diff --git a/dist/native-modules/implementation/validation-messages.js b/dist/native-modules/implementation/validation-messages.js index c1c31601..cffcde12 100644 --- a/dist/native-modules/implementation/validation-messages.js +++ b/dist/native-modules/implementation/validation-messages.js @@ -45,7 +45,7 @@ var ValidationMessageProvider = (function () { */ ValidationMessageProvider.prototype.getDisplayName = function (propertyName, displayName) { if (displayName !== null && displayName !== undefined) { - return displayName; + return (displayName instanceof Function) ? displayName() : displayName; } // split on upper-case letters. var words = propertyName.split(/(?=[A-Z])/).join(' '); diff --git a/dist/native-modules/implementation/validation-parser.d.ts b/dist/native-modules/implementation/validation-parser.d.ts index 75b2c7af..255414a6 100644 --- a/dist/native-modules/implementation/validation-parser.d.ts +++ b/dist/native-modules/implementation/validation-parser.d.ts @@ -1,9 +1,7 @@ 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 type PropertyAccessor = (object: TObject) => TValue; export declare class ValidationParser { private parser; private bindinqLanguage; diff --git a/dist/native-modules/implementation/validation-parser.js b/dist/native-modules/implementation/validation-parser.js index ca1024aa..1c7cc05f 100644 --- a/dist/native-modules/implementation/validation-parser.js +++ b/dist/native-modules/implementation/validation-parser.js @@ -1,8 +1,13 @@ -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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + 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'; @@ -51,7 +56,9 @@ var ValidationParser = (function () { 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*\}$/; + /* tslint:disable:max-line-length */ + var classic = /^function\s*\([$_\w\d]+\)\s*\{(?:\s*"use strict";)?\s*(?:[$_\w\d.['"\]+;]+)?\s*return\s+[$_\w\d]+\.([$_\w\d]+)\s*;?\s*\}$/; + /* tslint:enable:max-line-length */ var arrow = /^\(?[$_\w\d]+\)?\s*=>\s*[$_\w\d]+\.([$_\w\d]+)$/; var match = classic.exec(fn) || arrow.exec(fn); if (match === null) { diff --git a/dist/native-modules/implementation/validation-rules.d.ts b/dist/native-modules/implementation/validation-rules.d.ts index 13251d4d..67ea1021 100644 --- a/dist/native-modules/implementation/validation-rules.d.ts +++ b/dist/native-modules/implementation/validation-rules.d.ts @@ -1,5 +1,6 @@ import { Rule, RuleProperty } from './rule'; import { ValidationParser, PropertyAccessor } from './validation-parser'; +import { ValidationDisplayNameAccessor } from './rule'; /** * Part of the fluent rule API. Enables customizing property rules. */ @@ -8,7 +9,7 @@ export declare class FluentRuleCustomizer { private fluentRules; private parser; private rule; - constructor(property: RuleProperty, condition: (value: TValue, object?: TObject) => boolean | Promise, config: Object, fluentEnsure: FluentEnsure, fluentRules: FluentRules, parser: ValidationParser); + constructor(property: RuleProperty, condition: (value: TValue, object?: TObject) => boolean | Promise, config: Object | undefined, fluentEnsure: FluentEnsure, fluentRules: FluentRules, parser: ValidationParser); /** * Validate subsequent rules after previously declared rules have * been validated successfully. Use to postpone validation of costly @@ -38,9 +39,7 @@ export declare class FluentRuleCustomizer { * 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; + ensure(subject: string | ((model: TObject) => TValue2)): FluentRules; /** * Targets an object with validation rules. */ @@ -66,7 +65,7 @@ export declare class FluentRuleCustomizer { * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; + satisfiesRule(name: string, ...args: any[]): any; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. @@ -132,7 +131,7 @@ export declare class FluentRules { /** * Sets the display name of the ensured property. */ - displayName(name: string): this; + displayName(name: string | ValidationDisplayNameAccessor | null): this; /** * Applies an ad-hoc rule function to the ensured property or object. * @param condition The function to validate the rule. @@ -145,7 +144,7 @@ export declare class FluentRules { * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; + satisfiesRule(name: string, ...args: any[]): any; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. @@ -213,10 +212,6 @@ export declare class FluentEnsure { * @param target A class or object. */ on(target: any): this; - /** - * Adds a rule definition to the sequenced ruleset. - */ - _addRule(rule: Rule): void; private assertInitialized(); } /** diff --git a/dist/native-modules/implementation/validation-rules.js b/dist/native-modules/implementation/validation-rules.js index 3882f661..fc0007f8 100644 --- a/dist/native-modules/implementation/validation-rules.js +++ b/dist/native-modules/implementation/validation-rules.js @@ -346,6 +346,7 @@ var FluentEnsure = (function () { }; /** * Adds a rule definition to the sequenced ruleset. + * @internal */ FluentEnsure.prototype._addRule = function (rule) { while (this.rules.length < rule.sequence + 1) { @@ -357,7 +358,7 @@ var FluentEnsure = (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; }()); diff --git a/dist/native-modules/property-info.js b/dist/native-modules/property-info.js index 75edf715..053e6ff0 100644 --- a/dist/native-modules/property-info.js +++ b/dist/native-modules/property-info.js @@ -4,9 +4,8 @@ function getObject(expression, objectExpression, source) { if (value === null || value === undefined || value instanceof Object) { return value; } - /* tslint:disable */ + // tslint:disable-next-line:max-line-length 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. diff --git a/dist/native-modules/validate-binding-behavior-base.d.ts b/dist/native-modules/validate-binding-behavior-base.d.ts index 09c18430..971c8e83 100644 --- a/dist/native-modules/validate-binding-behavior-base.d.ts +++ b/dist/native-modules/validate-binding-behavior-base.d.ts @@ -1,19 +1,13 @@ import { TaskQueue } from 'aurelia-task-queue'; import { ValidationController } from './validation-controller'; +import { validateTrigger } from './validate-trigger'; /** * 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; + protected abstract getValidateTrigger(controller: ValidationController): validateTrigger; 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 index 72af199f..48f72051 100644 --- a/dist/native-modules/validate-binding-behavior-base.js +++ b/dist/native-modules/validate-binding-behavior-base.js @@ -1,7 +1,7 @@ import { Optional } from 'aurelia-dependency-injection'; -import { DOM } from 'aurelia-pal'; import { ValidationController } from './validation-controller'; import { validateTrigger } from './validate-trigger'; +import { getTargetDOMElement } from './get-target-dom-element'; /** * Binding behavior. Indicates the bound property should be validated. */ @@ -9,35 +9,10 @@ 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); + var target = getTargetDOMElement(binding, source); // locate the controller. var controller; if (rulesOrController instanceof ValidationController) { @@ -53,20 +28,17 @@ var ValidateBindingBehaviorBase = (function () { controller.registerBinding(binding, target, rules); binding.validationController = controller; var trigger = this.getValidateTrigger(controller); - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise if (trigger & validateTrigger.change) { - /* tslint:enable:no-bitwise */ binding.standardUpdateSource = binding.updateSource; - /* tslint:disable:only-arrow-functions */ + // tslint:disable-next-line:only-arrow-functions binding.updateSource = function (value) { - /* tslint:enable:only-arrow-functions */ this.standardUpdateSource(value); this.validationController.validateBinding(this); }; } - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise if (trigger & validateTrigger.blur) { - /* tslint:enable:no-bitwise */ binding.validateBlurHandler = function () { _this.taskQueue.queueMicroTask(function () { return controller.validateBinding(binding); }); }; @@ -75,9 +47,8 @@ var ValidateBindingBehaviorBase = (function () { } if (trigger !== validateTrigger.manual) { binding.standardUpdateTarget = binding.updateTarget; - /* tslint:disable:only-arrow-functions */ + // tslint:disable-next-line:only-arrow-functions binding.updateTarget = function (value) { - /* tslint:enable:only-arrow-functions */ this.standardUpdateTarget(value); this.validationController.resetBinding(this); }; diff --git a/dist/native-modules/validate-binding-behavior.d.ts b/dist/native-modules/validate-binding-behavior.d.ts index 2d55c7ec..518186be 100644 --- a/dist/native-modules/validate-binding-behavior.d.ts +++ b/dist/native-modules/validate-binding-behavior.d.ts @@ -1,5 +1,6 @@ import { TaskQueue } from 'aurelia-task-queue'; import { ValidationController } from './validation-controller'; +import { validateTrigger } from './validate-trigger'; import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; /** * Binding behavior. Indicates the bound property should be validated @@ -8,7 +9,7 @@ import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; */ export declare class ValidateBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(controller: ValidationController): number; + getValidateTrigger(controller: ValidationController): validateTrigger; } /** * Binding behavior. Indicates the bound property will be validated @@ -17,7 +18,7 @@ export declare class ValidateBindingBehavior extends ValidateBindingBehaviorBase */ export declare class ValidateManuallyBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -25,7 +26,7 @@ export declare class ValidateManuallyBindingBehavior extends ValidateBindingBeha */ export declare class ValidateOnBlurBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -34,7 +35,7 @@ export declare class ValidateOnBlurBindingBehavior extends ValidateBindingBehavi */ export declare class ValidateOnChangeBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -43,5 +44,5 @@ export declare class ValidateOnChangeBindingBehavior extends ValidateBindingBeha */ export declare class ValidateOnChangeOrBlurBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } diff --git a/dist/native-modules/validate-binding-behavior.js b/dist/native-modules/validate-binding-behavior.js index 0ecbd5a9..37347ece 100644 --- a/dist/native-modules/validate-binding-behavior.js +++ b/dist/native-modules/validate-binding-behavior.js @@ -1,8 +1,13 @@ -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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + 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'; @@ -14,7 +19,7 @@ import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; var ValidateBindingBehavior = (function (_super) { __extends(ValidateBindingBehavior, _super); function ValidateBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateBindingBehavior.prototype.getValidateTrigger = function (controller) { return controller.validateTrigger; @@ -31,7 +36,7 @@ ValidateBindingBehavior.inject = [TaskQueue]; var ValidateManuallyBindingBehavior = (function (_super) { __extends(ValidateManuallyBindingBehavior, _super); function ValidateManuallyBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateManuallyBindingBehavior.prototype.getValidateTrigger = function () { return validateTrigger.manual; @@ -47,7 +52,7 @@ ValidateManuallyBindingBehavior.inject = [TaskQueue]; var ValidateOnBlurBindingBehavior = (function (_super) { __extends(ValidateOnBlurBindingBehavior, _super); function ValidateOnBlurBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnBlurBindingBehavior.prototype.getValidateTrigger = function () { return validateTrigger.blur; @@ -64,7 +69,7 @@ ValidateOnBlurBindingBehavior.inject = [TaskQueue]; var ValidateOnChangeBindingBehavior = (function (_super) { __extends(ValidateOnChangeBindingBehavior, _super); function ValidateOnChangeBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnChangeBindingBehavior.prototype.getValidateTrigger = function () { return validateTrigger.change; @@ -81,7 +86,7 @@ ValidateOnChangeBindingBehavior.inject = [TaskQueue]; var ValidateOnChangeOrBlurBindingBehavior = (function (_super) { __extends(ValidateOnChangeOrBlurBindingBehavior, _super); function ValidateOnChangeOrBlurBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnChangeOrBlurBindingBehavior.prototype.getValidateTrigger = function () { return validateTrigger.changeOrBlur; diff --git a/dist/native-modules/validate-trigger.d.ts b/dist/native-modules/validate-trigger.d.ts index 82c60096..43e76851 100644 --- a/dist/native-modules/validate-trigger.d.ts +++ b/dist/native-modules/validate-trigger.d.ts @@ -1,9 +1,23 @@ /** * Validation triggers. */ -export declare const validateTrigger: { - manual: number; - blur: number; - change: number; - changeOrBlur: number; -}; +export declare enum 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/validate-trigger.js b/dist/native-modules/validate-trigger.js index 1ccec739..12b9b94f 100644 --- a/dist/native-modules/validate-trigger.js +++ b/dist/native-modules/validate-trigger.js @@ -3,23 +3,25 @@ */ /** * Validation triggers. - */ export var validateTrigger = { + */ export var validateTrigger; +(function (validateTrigger) { /** * Manual validation. Use the controller's `validate()` and `reset()` methods * to validate all bindings. */ - manual: 0, + validateTrigger[validateTrigger["manual"] = 0] = "manual"; /** * Validate the binding when the binding's target element fires a DOM "blur" event. */ - blur: 1, + validateTrigger[validateTrigger["blur"] = 1] = "blur"; /** * Validate the binding when it updates the model due to a change in the view. */ - change: 2, + validateTrigger[validateTrigger["change"] = 2] = "change"; /** * 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 -}; + validateTrigger[validateTrigger["changeOrBlur"] = 3] = "changeOrBlur"; +})(validateTrigger || (validateTrigger = {})); +; diff --git a/dist/native-modules/validation-controller.d.ts b/dist/native-modules/validation-controller.d.ts index d88935e5..86dccc2c 100644 --- a/dist/native-modules/validation-controller.d.ts +++ b/dist/native-modules/validation-controller.d.ts @@ -1,5 +1,6 @@ import { Binding } from 'aurelia-binding'; import { Validator } from './validator'; +import { validateTrigger } from './validate-trigger'; import { ValidationRenderer } from './validation-renderer'; import { ValidateResult } from './validate-result'; import { ValidateInstruction } from './validate-instruction'; @@ -31,7 +32,7 @@ export declare class ValidationController { /** * The trigger that will invoke automatic validation of a property used in a binding. */ - validateTrigger: number; + validateTrigger: validateTrigger; private finishValidating; constructor(validator: Validator); /** diff --git a/dist/native-modules/validation-controller.js b/dist/native-modules/validation-controller.js index d936e85e..d9d8d53f 100644 --- a/dist/native-modules/validation-controller.js +++ b/dist/native-modules/validation-controller.js @@ -147,6 +147,7 @@ var ValidationController = (function () { // Get a function that will process the validation instruction. var execute; if (instruction) { + // tslint:disable-next-line:prefer-const 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); @@ -257,7 +258,7 @@ var ValidationController = (function () { } } else { - // there is a corresponding new result... + // 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); @@ -309,7 +310,7 @@ var ValidationController = (function () { return; } var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source); - var rules = undefined; + var rules; var registeredBinding = this.bindings.get(binding); if (registeredBinding) { rules = registeredBinding.rules; diff --git a/dist/native-modules/validation-errors-custom-attribute.d.ts b/dist/native-modules/validation-errors-custom-attribute.d.ts index 73340e73..57c020a0 100644 --- a/dist/native-modules/validation-errors-custom-attribute.d.ts +++ b/dist/native-modules/validation-errors-custom-attribute.d.ts @@ -13,11 +13,10 @@ export declare class ValidationErrorsCustomAttribute implements ValidationRender new (): Element; prototype: Element; } | Lazy)[]; - value: RenderedError[]; + controller: ValidationController | null; errors: RenderedError[]; - constructor(boundaryElement: Element, controllerAccessor: { - (): ValidationController; - }); + private errorsInternal; + constructor(boundaryElement: Element, controllerAccessor: () => ValidationController); sort(): void; interestingElements(elements: Element[]): Element[]; render(instruction: RenderInstruction): void; diff --git a/dist/native-modules/validation-errors-custom-attribute.js b/dist/native-modules/validation-errors-custom-attribute.js index afd76aad..bd9423b5 100644 --- a/dist/native-modules/validation-errors-custom-attribute.js +++ b/dist/native-modules/validation-errors-custom-attribute.js @@ -6,22 +6,24 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, }; import { bindingMode } from 'aurelia-binding'; import { Lazy } from 'aurelia-dependency-injection'; -import { customAttribute } from 'aurelia-templating'; +import { customAttribute, bindable } from 'aurelia-templating'; import { ValidationController } from './validation-controller'; +import { DOM } from 'aurelia-pal'; var ValidationErrorsCustomAttribute = (function () { function ValidationErrorsCustomAttribute(boundaryElement, controllerAccessor) { this.boundaryElement = boundaryElement; this.controllerAccessor = controllerAccessor; + this.controller = null; this.errors = []; + this.errorsInternal = []; } ValidationErrorsCustomAttribute.prototype.sort = function () { - this.errors.sort(function (a, b) { + this.errorsInternal.sort(function (a, b) { if (a.targets[0] === b.targets[0]) { return 0; } - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise return a.targets[0].compareDocumentPosition(b.targets[0]) & 2 ? 1 : -1; - /* tslint:enable:no-bitwise */ }); }; ValidationErrorsCustomAttribute.prototype.interestingElements = function (elements) { @@ -30,9 +32,9 @@ var ValidationErrorsCustomAttribute = (function () { }; ValidationErrorsCustomAttribute.prototype.render = function (instruction) { var _loop_1 = function (result) { - var index = this_1.errors.findIndex(function (x) { return x.error === result; }); + var index = this_1.errorsInternal.findIndex(function (x) { return x.error === result; }); if (index !== -1) { - this_1.errors.splice(index, 1); + this_1.errorsInternal.splice(index, 1); } }; var this_1 = this; @@ -47,23 +49,34 @@ var ValidationErrorsCustomAttribute = (function () { } var targets = this.interestingElements(elements); if (targets.length) { - this.errors.push({ error: result, targets: targets }); + this.errorsInternal.push({ error: result, targets: targets }); } } this.sort(); - this.value = this.errors; + this.errors = this.errorsInternal; }; ValidationErrorsCustomAttribute.prototype.bind = function () { - this.controllerAccessor().addRenderer(this); - this.value = this.errors; + if (!this.controller) { + this.controller = this.controllerAccessor(); + } + // this will call render() with the side-effect of updating this.errors + this.controller.addRenderer(this); }; ValidationErrorsCustomAttribute.prototype.unbind = function () { - this.controllerAccessor().removeRenderer(this); + if (this.controller) { + this.controller.removeRenderer(this); + } }; return ValidationErrorsCustomAttribute; }()); -ValidationErrorsCustomAttribute.inject = [Element, Lazy.of(ValidationController)]; +ValidationErrorsCustomAttribute.inject = [DOM.Element, Lazy.of(ValidationController)]; +__decorate([ + bindable({ defaultBindingMode: bindingMode.oneWay }) +], ValidationErrorsCustomAttribute.prototype, "controller", void 0); +__decorate([ + bindable({ primaryProperty: true, defaultBindingMode: bindingMode.twoWay }) +], ValidationErrorsCustomAttribute.prototype, "errors", void 0); ValidationErrorsCustomAttribute = __decorate([ - customAttribute('validation-errors', bindingMode.twoWay) + customAttribute('validation-errors') ], ValidationErrorsCustomAttribute); export { ValidationErrorsCustomAttribute }; diff --git a/dist/system/aurelia-validation.d.ts b/dist/system/aurelia-validation.d.ts index 9897cc10..be93a23a 100644 --- a/dist/system/aurelia-validation.d.ts +++ b/dist/system/aurelia-validation.d.ts @@ -1,4 +1,5 @@ export * from './controller-validate-result'; +export * from './get-target-dom-element'; export * from './property-info'; export * from './validate-binding-behavior'; export * from './validate-instruction'; @@ -39,5 +40,5 @@ export declare class AureliaValidationConfiguration { */ export declare function configure(frameworkConfig: { container: Container; - globalResources: (...resources: string[]) => any; + globalResources?: (...resources: string[]) => any; }, callback?: (config: AureliaValidationConfiguration) => void): void; diff --git a/dist/system/aurelia-validation.js b/dist/system/aurelia-validation.js index 9384f366..5583c673 100644 --- a/dist/system/aurelia-validation.js +++ b/dist/system/aurelia-validation.js @@ -1,5 +1,5 @@ // Exports -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) { +System.register(["./get-target-dom-element", "./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", "aurelia-pal"], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; /** @@ -7,7 +7,7 @@ System.register(["./property-info", "./validate-binding-behavior", "./validate-r */ function configure(frameworkConfig, callback) { // the fluent rule definition API needs the parser to translate messages - // to interpolation expressions. + // to interpolation expressions. var parser = frameworkConfig.container.get(validation_parser_1.ValidationParser); validation_rules_1.ValidationRules.initialize(parser); // configure... @@ -17,10 +17,12 @@ System.register(["./property-info", "./validate-binding-behavior", "./validate-r } config.apply(frameworkConfig.container); // globalize the behaviors. - frameworkConfig.globalResources('./validate-binding-behavior', './validation-errors-custom-attribute', './validation-renderer-custom-attribute'); + if (frameworkConfig.globalResources) { + frameworkConfig.globalResources(aurelia_pal_1.PLATFORM.moduleName('./validate-binding-behavior'), aurelia_pal_1.PLATFORM.moduleName('./validation-errors-custom-attribute'), aurelia_pal_1.PLATFORM.moduleName('./validation-renderer-custom-attribute')); + } } exports_1("configure", configure); - var validator_1, standard_validator_1, validation_parser_1, validation_rules_1, AureliaValidationConfiguration; + var aurelia_pal_1, validator_1, standard_validator_1, validation_parser_1, validation_rules_1, AureliaValidationConfiguration; var exportedNames_1 = { "AureliaValidationConfiguration": true, "configure": true @@ -28,13 +30,15 @@ System.register(["./property-info", "./validate-binding-behavior", "./validate-r function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) - exports[n] = m[n]; + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; } exports_1(exports); } return { setters: [ + function (get_target_dom_element_1_1) { + exportStar_1(get_target_dom_element_1_1); + }, function (property_info_1_1) { exportStar_1(property_info_1_1); }, @@ -80,6 +84,9 @@ System.register(["./property-info", "./validate-binding-behavior", "./validate-r function (validation_rules_2_1) { exportStar_1(validation_rules_2_1); validation_rules_1 = validation_rules_2_1; + }, + function (aurelia_pal_1_1) { + aurelia_pal_1 = aurelia_pal_1_1; } ], execute: function () {// Exports diff --git a/dist/system/get-target-dom-element.d.ts b/dist/system/get-target-dom-element.d.ts new file mode 100644 index 00000000..314fc952 --- /dev/null +++ b/dist/system/get-target-dom-element.d.ts @@ -0,0 +1,7 @@ +/** + * 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. + */ +export declare function getTargetDOMElement(binding: any, view: any): Element; diff --git a/dist/system/get-target-dom-element.js b/dist/system/get-target-dom-element.js new file mode 100644 index 00000000..28ec0a2e --- /dev/null +++ b/dist/system/get-target-dom-element.js @@ -0,0 +1,41 @@ +System.register(["aurelia-pal"], function (exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + /** + * 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. + */ + function getTargetDOMElement(binding, view) { + var target = binding.target; + // DOM element + if (target instanceof Element) { + return target; + } + // custom element or custom attribute + // tslint:disable-next-line:prefer-const + 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(aurelia_pal_1.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 + "\"."); + } + exports_1("getTargetDOMElement", getTargetDOMElement); + var aurelia_pal_1; + return { + setters: [ + function (aurelia_pal_1_1) { + aurelia_pal_1 = aurelia_pal_1_1; + } + ], + execute: function () { + } + }; +}); diff --git a/dist/system/implementation/rule.d.ts b/dist/system/implementation/rule.d.ts index 8bba9d76..eec3b823 100644 --- a/dist/system/implementation/rule.d.ts +++ b/dist/system/implementation/rule.d.ts @@ -1,4 +1,5 @@ import { Expression } from 'aurelia-binding'; +export declare type ValidationDisplayNameAccessor = () => string; /** * Information related to a property that is the subject of validation. */ @@ -10,7 +11,7 @@ export interface RuleProperty { /** * The displayName of the property (or object). */ - displayName: string | null; + displayName: string | ValidationDisplayNameAccessor | null; } /** * A rule definition. Associations a rule with a property or object. @@ -19,9 +20,7 @@ export interface Rule { property: RuleProperty; condition: (value: TValue, object?: TObject) => boolean | Promise; config: Object; - when: { - (object: TObject): boolean; - } | null; + when: ((object: TObject) => boolean) | null; messageKey: string; message: Expression | null; sequence: number; diff --git a/dist/system/implementation/standard-validator.js b/dist/system/implementation/standard-validator.js index 4a203589..ffa7e53c 100644 --- a/dist/system/implementation/standard-validator.js +++ b/dist/system/implementation/standard-validator.js @@ -1,10 +1,15 @@ System.register(["aurelia-templating", "../validator", "../validate-result", "./rules", "./validation-messages"], function (exports_1, context_1) { "use strict"; - 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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); var __moduleName = context_1 && context_1.id; var aurelia_templating_1, validator_1, validate_result_1, rules_1, validation_messages_1, StandardValidator; return { @@ -74,6 +79,7 @@ System.register(["aurelia-templating", "../validator", "../validate-result", "./ }; StandardValidator.prototype.getMessage = function (rule, object, value) { var expression = rule.message || this.messageProvider.getMessage(rule.messageKey); + // tslint:disable-next-line:prefer-const var _a = rule.property, propertyName = _a.name, displayName = _a.displayName; if (propertyName !== null) { displayName = this.messageProvider.getDisplayName(propertyName, displayName); @@ -84,6 +90,8 @@ System.register(["aurelia-templating", "../validator", "../validate-result", "./ $value: value, $object: object, $config: rule.config, + // returns the name of a given property, given just the property name (irrespective of the property's displayName) + // split on capital letters, first letter ensured to be capitalized $getDisplayName: this.getDisplayName }; return expression.evaluate({ bindingContext: object, overrideContext: overrideContext }, this.lookupFunctions); diff --git a/dist/system/implementation/validation-messages.d.ts b/dist/system/implementation/validation-messages.d.ts index 7a0978d7..6226bd15 100644 --- a/dist/system/implementation/validation-messages.d.ts +++ b/dist/system/implementation/validation-messages.d.ts @@ -25,5 +25,5 @@ export declare class ValidationMessageProvider { * Override this with your own custom logic. * @param propertyName The property name. */ - getDisplayName(propertyName: string, displayName: string | null | undefined): string; + getDisplayName(propertyName: string, displayName?: string | null | Function): string; } diff --git a/dist/system/implementation/validation-messages.js b/dist/system/implementation/validation-messages.js index 99b5b3ef..1c4c7359 100644 --- a/dist/system/implementation/validation-messages.js +++ b/dist/system/implementation/validation-messages.js @@ -55,7 +55,7 @@ System.register(["./validation-parser"], function (exports_1, context_1) { */ ValidationMessageProvider.prototype.getDisplayName = function (propertyName, displayName) { if (displayName !== null && displayName !== undefined) { - return displayName; + return (displayName instanceof Function) ? displayName() : displayName; } // split on upper-case letters. var words = propertyName.split(/(?=[A-Z])/).join(' '); diff --git a/dist/system/implementation/validation-parser.d.ts b/dist/system/implementation/validation-parser.d.ts index 75b2c7af..255414a6 100644 --- a/dist/system/implementation/validation-parser.d.ts +++ b/dist/system/implementation/validation-parser.d.ts @@ -1,9 +1,7 @@ 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 type PropertyAccessor = (object: TObject) => TValue; export declare class ValidationParser { private parser; private bindinqLanguage; diff --git a/dist/system/implementation/validation-parser.js b/dist/system/implementation/validation-parser.js index c2721ec6..50c9b751 100644 --- a/dist/system/implementation/validation-parser.js +++ b/dist/system/implementation/validation-parser.js @@ -1,10 +1,15 @@ System.register(["aurelia-binding", "aurelia-templating", "./util", "aurelia-logging"], function (exports_1, context_1) { "use strict"; - 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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); var __moduleName = context_1 && context_1.id; var aurelia_binding_1, aurelia_templating_1, util_1, LogManager, ValidationParser, MessageExpressionValidator; return { @@ -67,7 +72,9 @@ System.register(["aurelia-binding", "aurelia-templating", "./util", "aurelia-log return new aurelia_binding_1.Conditional(new aurelia_binding_1.Binary('||', new aurelia_binding_1.Binary('===', part, this.nullExpression), new aurelia_binding_1.Binary('===', part, this.undefinedExpression)), this.emptyStringExpression, new aurelia_binding_1.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*\}$/; + /* tslint:disable:max-line-length */ + var classic = /^function\s*\([$_\w\d]+\)\s*\{(?:\s*"use strict";)?\s*(?:[$_\w\d.['"\]+;]+)?\s*return\s+[$_\w\d]+\.([$_\w\d]+)\s*;?\s*\}$/; + /* tslint:enable:max-line-length */ var arrow = /^\(?[$_\w\d]+\)?\s*=>\s*[$_\w\d]+\.([$_\w\d]+)$/; var match = classic.exec(fn) || arrow.exec(fn); if (match === null) { diff --git a/dist/system/implementation/validation-rules.d.ts b/dist/system/implementation/validation-rules.d.ts index 13251d4d..67ea1021 100644 --- a/dist/system/implementation/validation-rules.d.ts +++ b/dist/system/implementation/validation-rules.d.ts @@ -1,5 +1,6 @@ import { Rule, RuleProperty } from './rule'; import { ValidationParser, PropertyAccessor } from './validation-parser'; +import { ValidationDisplayNameAccessor } from './rule'; /** * Part of the fluent rule API. Enables customizing property rules. */ @@ -8,7 +9,7 @@ export declare class FluentRuleCustomizer { private fluentRules; private parser; private rule; - constructor(property: RuleProperty, condition: (value: TValue, object?: TObject) => boolean | Promise, config: Object, fluentEnsure: FluentEnsure, fluentRules: FluentRules, parser: ValidationParser); + constructor(property: RuleProperty, condition: (value: TValue, object?: TObject) => boolean | Promise, config: Object | undefined, fluentEnsure: FluentEnsure, fluentRules: FluentRules, parser: ValidationParser); /** * Validate subsequent rules after previously declared rules have * been validated successfully. Use to postpone validation of costly @@ -38,9 +39,7 @@ export declare class FluentRuleCustomizer { * 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; + ensure(subject: string | ((model: TObject) => TValue2)): FluentRules; /** * Targets an object with validation rules. */ @@ -66,7 +65,7 @@ export declare class FluentRuleCustomizer { * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; + satisfiesRule(name: string, ...args: any[]): any; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. @@ -132,7 +131,7 @@ export declare class FluentRules { /** * Sets the display name of the ensured property. */ - displayName(name: string): this; + displayName(name: string | ValidationDisplayNameAccessor | null): this; /** * Applies an ad-hoc rule function to the ensured property or object. * @param condition The function to validate the rule. @@ -145,7 +144,7 @@ export declare class FluentRules { * @param name The name of the custom or standard rule. * @param args The rule's arguments. */ - satisfiesRule(name: string, ...args: any[]): FluentRuleCustomizer; + satisfiesRule(name: string, ...args: any[]): any; /** * Applies the "required" rule to the property. * The value cannot be null, undefined or whitespace. @@ -213,10 +212,6 @@ export declare class FluentEnsure { * @param target A class or object. */ on(target: any): this; - /** - * Adds a rule definition to the sequenced ruleset. - */ - _addRule(rule: Rule): void; private assertInitialized(); } /** diff --git a/dist/system/implementation/validation-rules.js b/dist/system/implementation/validation-rules.js index f61fc35b..184a1f1b 100644 --- a/dist/system/implementation/validation-rules.js +++ b/dist/system/implementation/validation-rules.js @@ -360,6 +360,7 @@ System.register(["./util", "./rules", "./validation-messages"], function (export }; /** * Adds a rule definition to the sequenced ruleset. + * @internal */ FluentEnsure.prototype._addRule = function (rule) { while (this.rules.length < rule.sequence + 1) { @@ -371,7 +372,7 @@ System.register(["./util", "./rules", "./validation-messages"], function (export 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; }()); diff --git a/dist/system/property-info.js b/dist/system/property-info.js index dd793e73..6a638305 100644 --- a/dist/system/property-info.js +++ b/dist/system/property-info.js @@ -6,9 +6,8 @@ System.register(["aurelia-binding"], function (exports_1, context_1) { if (value === null || value === undefined || value instanceof Object) { return value; } - /* tslint:disable */ + // tslint:disable-next-line:max-line-length 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. diff --git a/dist/system/validate-binding-behavior-base.d.ts b/dist/system/validate-binding-behavior-base.d.ts index 09c18430..971c8e83 100644 --- a/dist/system/validate-binding-behavior-base.d.ts +++ b/dist/system/validate-binding-behavior-base.d.ts @@ -1,19 +1,13 @@ import { TaskQueue } from 'aurelia-task-queue'; import { ValidationController } from './validation-controller'; +import { validateTrigger } from './validate-trigger'; /** * 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; + protected abstract getValidateTrigger(controller: ValidationController): validateTrigger; bind(binding: any, source: any, rulesOrController?: ValidationController | any, rules?: any): void; unbind(binding: any): void; } diff --git a/dist/system/validate-binding-behavior-base.js b/dist/system/validate-binding-behavior-base.js index 5dc6e123..6c25e5b5 100644 --- a/dist/system/validate-binding-behavior-base.js +++ b/dist/system/validate-binding-behavior-base.js @@ -1,20 +1,20 @@ -System.register(["aurelia-dependency-injection", "aurelia-pal", "./validation-controller", "./validate-trigger"], function (exports_1, context_1) { +System.register(["aurelia-dependency-injection", "./validation-controller", "./validate-trigger", "./get-target-dom-element"], 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, ValidateBindingBehaviorBase; + var aurelia_dependency_injection_1, validation_controller_1, validate_trigger_1, get_target_dom_element_1, ValidateBindingBehaviorBase; return { setters: [ function (aurelia_dependency_injection_1_1) { aurelia_dependency_injection_1 = aurelia_dependency_injection_1_1; }, - function (aurelia_pal_1_1) { - aurelia_pal_1 = aurelia_pal_1_1; - }, function (validation_controller_1_1) { validation_controller_1 = validation_controller_1_1; }, function (validate_trigger_1_1) { validate_trigger_1 = validate_trigger_1_1; + }, + function (get_target_dom_element_1_1) { + get_target_dom_element_1 = get_target_dom_element_1_1; } ], execute: function () { @@ -25,35 +25,10 @@ System.register(["aurelia-dependency-injection", "aurelia-pal", "./validation-co 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(aurelia_pal_1.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); + var target = get_target_dom_element_1.getTargetDOMElement(binding, source); // locate the controller. var controller; if (rulesOrController instanceof validation_controller_1.ValidationController) { @@ -69,20 +44,17 @@ System.register(["aurelia-dependency-injection", "aurelia-pal", "./validation-co controller.registerBinding(binding, target, rules); binding.validationController = controller; var trigger = this.getValidateTrigger(controller); - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise if (trigger & validate_trigger_1.validateTrigger.change) { - /* tslint:enable:no-bitwise */ binding.standardUpdateSource = binding.updateSource; - /* tslint:disable:only-arrow-functions */ + // tslint:disable-next-line:only-arrow-functions binding.updateSource = function (value) { - /* tslint:enable:only-arrow-functions */ this.standardUpdateSource(value); this.validationController.validateBinding(this); }; } - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise if (trigger & validate_trigger_1.validateTrigger.blur) { - /* tslint:enable:no-bitwise */ binding.validateBlurHandler = function () { _this.taskQueue.queueMicroTask(function () { return controller.validateBinding(binding); }); }; @@ -91,9 +63,8 @@ System.register(["aurelia-dependency-injection", "aurelia-pal", "./validation-co } if (trigger !== validate_trigger_1.validateTrigger.manual) { binding.standardUpdateTarget = binding.updateTarget; - /* tslint:disable:only-arrow-functions */ + // tslint:disable-next-line:only-arrow-functions binding.updateTarget = function (value) { - /* tslint:enable:only-arrow-functions */ this.standardUpdateTarget(value); this.validationController.resetBinding(this); }; diff --git a/dist/system/validate-binding-behavior.d.ts b/dist/system/validate-binding-behavior.d.ts index 2d55c7ec..518186be 100644 --- a/dist/system/validate-binding-behavior.d.ts +++ b/dist/system/validate-binding-behavior.d.ts @@ -1,5 +1,6 @@ import { TaskQueue } from 'aurelia-task-queue'; import { ValidationController } from './validation-controller'; +import { validateTrigger } from './validate-trigger'; import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; /** * Binding behavior. Indicates the bound property should be validated @@ -8,7 +9,7 @@ import { ValidateBindingBehaviorBase } from './validate-binding-behavior-base'; */ export declare class ValidateBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(controller: ValidationController): number; + getValidateTrigger(controller: ValidationController): validateTrigger; } /** * Binding behavior. Indicates the bound property will be validated @@ -17,7 +18,7 @@ export declare class ValidateBindingBehavior extends ValidateBindingBehaviorBase */ export declare class ValidateManuallyBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -25,7 +26,7 @@ export declare class ValidateManuallyBindingBehavior extends ValidateBindingBeha */ export declare class ValidateOnBlurBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -34,7 +35,7 @@ export declare class ValidateOnBlurBindingBehavior extends ValidateBindingBehavi */ export declare class ValidateOnChangeBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } /** * Binding behavior. Indicates the bound property should be validated @@ -43,5 +44,5 @@ export declare class ValidateOnChangeBindingBehavior extends ValidateBindingBeha */ export declare class ValidateOnChangeOrBlurBindingBehavior extends ValidateBindingBehaviorBase { static inject: typeof TaskQueue[]; - getValidateTrigger(): number; + getValidateTrigger(): validateTrigger; } diff --git a/dist/system/validate-binding-behavior.js b/dist/system/validate-binding-behavior.js index b5158c1c..8923fe3b 100644 --- a/dist/system/validate-binding-behavior.js +++ b/dist/system/validate-binding-behavior.js @@ -1,10 +1,15 @@ System.register(["aurelia-task-queue", "./validate-trigger", "./validate-binding-behavior-base"], function (exports_1, context_1) { "use strict"; - 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 __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); 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 { @@ -28,7 +33,7 @@ System.register(["aurelia-task-queue", "./validate-trigger", "./validate-binding ValidateBindingBehavior = (function (_super) { __extends(ValidateBindingBehavior, _super); function ValidateBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateBindingBehavior.prototype.getValidateTrigger = function (controller) { return controller.validateTrigger; @@ -45,7 +50,7 @@ System.register(["aurelia-task-queue", "./validate-trigger", "./validate-binding ValidateManuallyBindingBehavior = (function (_super) { __extends(ValidateManuallyBindingBehavior, _super); function ValidateManuallyBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateManuallyBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.manual; @@ -61,7 +66,7 @@ System.register(["aurelia-task-queue", "./validate-trigger", "./validate-binding ValidateOnBlurBindingBehavior = (function (_super) { __extends(ValidateOnBlurBindingBehavior, _super); function ValidateOnBlurBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.blur; @@ -78,7 +83,7 @@ System.register(["aurelia-task-queue", "./validate-trigger", "./validate-binding ValidateOnChangeBindingBehavior = (function (_super) { __extends(ValidateOnChangeBindingBehavior, _super); function ValidateOnChangeBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnChangeBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.change; @@ -95,7 +100,7 @@ System.register(["aurelia-task-queue", "./validate-trigger", "./validate-binding ValidateOnChangeOrBlurBindingBehavior = (function (_super) { __extends(ValidateOnChangeOrBlurBindingBehavior, _super); function ValidateOnChangeOrBlurBindingBehavior() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ValidateOnChangeOrBlurBindingBehavior.prototype.getValidateTrigger = function () { return validate_trigger_1.validateTrigger.changeOrBlur; diff --git a/dist/system/validate-trigger.d.ts b/dist/system/validate-trigger.d.ts index 82c60096..43e76851 100644 --- a/dist/system/validate-trigger.d.ts +++ b/dist/system/validate-trigger.d.ts @@ -1,9 +1,23 @@ /** * Validation triggers. */ -export declare const validateTrigger: { - manual: number; - blur: number; - change: number; - changeOrBlur: number; -}; +export declare enum 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/system/validate-trigger.js b/dist/system/validate-trigger.js index a8e60158..91ec072a 100644 --- a/dist/system/validate-trigger.js +++ b/dist/system/validate-trigger.js @@ -8,26 +8,28 @@ System.register([], function (exports_1, context_1) { /** * Validation triggers. */ - exports_1("validateTrigger", validateTrigger = { + (function (validateTrigger) { /** * Manual validation. Use the controller's `validate()` and `reset()` methods * to validate all bindings. */ - manual: 0, + validateTrigger[validateTrigger["manual"] = 0] = "manual"; /** * Validate the binding when the binding's target element fires a DOM "blur" event. */ - blur: 1, + validateTrigger[validateTrigger["blur"] = 1] = "blur"; /** * Validate the binding when it updates the model due to a change in the view. */ - change: 2, + validateTrigger[validateTrigger["change"] = 2] = "change"; /** * 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 - }); + validateTrigger[validateTrigger["changeOrBlur"] = 3] = "changeOrBlur"; + })(validateTrigger || (validateTrigger = {})); + exports_1("validateTrigger", validateTrigger); + ; } }; }); diff --git a/dist/system/validation-controller.d.ts b/dist/system/validation-controller.d.ts index d88935e5..86dccc2c 100644 --- a/dist/system/validation-controller.d.ts +++ b/dist/system/validation-controller.d.ts @@ -1,5 +1,6 @@ import { Binding } from 'aurelia-binding'; import { Validator } from './validator'; +import { validateTrigger } from './validate-trigger'; import { ValidationRenderer } from './validation-renderer'; import { ValidateResult } from './validate-result'; import { ValidateInstruction } from './validate-instruction'; @@ -31,7 +32,7 @@ export declare class ValidationController { /** * The trigger that will invoke automatic validation of a property used in a binding. */ - validateTrigger: number; + validateTrigger: validateTrigger; private finishValidating; constructor(validator: Validator); /** diff --git a/dist/system/validation-controller.js b/dist/system/validation-controller.js index 5b54e24b..ae6a1610 100644 --- a/dist/system/validation-controller.js +++ b/dist/system/validation-controller.js @@ -163,6 +163,7 @@ System.register(["./validator", "./validate-trigger", "./property-info", "./vali // Get a function that will process the validation instruction. var execute; if (instruction) { + // tslint:disable-next-line:prefer-const 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); @@ -273,7 +274,7 @@ System.register(["./validator", "./validate-trigger", "./property-info", "./vali } } else { - // there is a corresponding new result... + // 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); @@ -325,7 +326,7 @@ System.register(["./validator", "./validate-trigger", "./property-info", "./vali return; } var propertyInfo = property_info_1.getPropertyInfo(binding.sourceExpression, binding.source); - var rules = undefined; + var rules; var registeredBinding = this.bindings.get(binding); if (registeredBinding) { rules = registeredBinding.rules; diff --git a/dist/system/validation-errors-custom-attribute.d.ts b/dist/system/validation-errors-custom-attribute.d.ts index 73340e73..57c020a0 100644 --- a/dist/system/validation-errors-custom-attribute.d.ts +++ b/dist/system/validation-errors-custom-attribute.d.ts @@ -13,11 +13,10 @@ export declare class ValidationErrorsCustomAttribute implements ValidationRender new (): Element; prototype: Element; } | Lazy)[]; - value: RenderedError[]; + controller: ValidationController | null; errors: RenderedError[]; - constructor(boundaryElement: Element, controllerAccessor: { - (): ValidationController; - }); + private errorsInternal; + constructor(boundaryElement: Element, controllerAccessor: () => ValidationController); sort(): void; interestingElements(elements: Element[]): Element[]; render(instruction: RenderInstruction): void; diff --git a/dist/system/validation-errors-custom-attribute.js b/dist/system/validation-errors-custom-attribute.js index a9cdc4db..c3758ad5 100644 --- a/dist/system/validation-errors-custom-attribute.js +++ b/dist/system/validation-errors-custom-attribute.js @@ -1,4 +1,4 @@ -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", "aurelia-pal"], function (exports_1, context_1) { "use strict"; 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; @@ -7,7 +7,7 @@ System.register(["aurelia-binding", "aurelia-dependency-injection", "aurelia-tem return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __moduleName = context_1 && context_1.id; - var aurelia_binding_1, aurelia_dependency_injection_1, aurelia_templating_1, validation_controller_1, ValidationErrorsCustomAttribute; + var aurelia_binding_1, aurelia_dependency_injection_1, aurelia_templating_1, validation_controller_1, aurelia_pal_1, ValidationErrorsCustomAttribute; return { setters: [ function (aurelia_binding_1_1) { @@ -21,6 +21,9 @@ System.register(["aurelia-binding", "aurelia-dependency-injection", "aurelia-tem }, function (validation_controller_1_1) { validation_controller_1 = validation_controller_1_1; + }, + function (aurelia_pal_1_1) { + aurelia_pal_1 = aurelia_pal_1_1; } ], execute: function () { @@ -28,16 +31,17 @@ System.register(["aurelia-binding", "aurelia-dependency-injection", "aurelia-tem function ValidationErrorsCustomAttribute(boundaryElement, controllerAccessor) { this.boundaryElement = boundaryElement; this.controllerAccessor = controllerAccessor; + this.controller = null; this.errors = []; + this.errorsInternal = []; } ValidationErrorsCustomAttribute.prototype.sort = function () { - this.errors.sort(function (a, b) { + this.errorsInternal.sort(function (a, b) { if (a.targets[0] === b.targets[0]) { return 0; } - /* tslint:disable:no-bitwise */ + // tslint:disable-next-line:no-bitwise return a.targets[0].compareDocumentPosition(b.targets[0]) & 2 ? 1 : -1; - /* tslint:enable:no-bitwise */ }); }; ValidationErrorsCustomAttribute.prototype.interestingElements = function (elements) { @@ -46,9 +50,9 @@ System.register(["aurelia-binding", "aurelia-dependency-injection", "aurelia-tem }; ValidationErrorsCustomAttribute.prototype.render = function (instruction) { var _loop_1 = function (result) { - var index = this_1.errors.findIndex(function (x) { return x.error === result; }); + var index = this_1.errorsInternal.findIndex(function (x) { return x.error === result; }); if (index !== -1) { - this_1.errors.splice(index, 1); + this_1.errorsInternal.splice(index, 1); } }; var this_1 = this; @@ -63,24 +67,35 @@ System.register(["aurelia-binding", "aurelia-dependency-injection", "aurelia-tem } var targets = this.interestingElements(elements); if (targets.length) { - this.errors.push({ error: result, targets: targets }); + this.errorsInternal.push({ error: result, targets: targets }); } } this.sort(); - this.value = this.errors; + this.errors = this.errorsInternal; }; ValidationErrorsCustomAttribute.prototype.bind = function () { - this.controllerAccessor().addRenderer(this); - this.value = this.errors; + if (!this.controller) { + this.controller = this.controllerAccessor(); + } + // this will call render() with the side-effect of updating this.errors + this.controller.addRenderer(this); }; ValidationErrorsCustomAttribute.prototype.unbind = function () { - this.controllerAccessor().removeRenderer(this); + if (this.controller) { + this.controller.removeRenderer(this); + } }; return ValidationErrorsCustomAttribute; }()); - ValidationErrorsCustomAttribute.inject = [Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; + ValidationErrorsCustomAttribute.inject = [aurelia_pal_1.DOM.Element, aurelia_dependency_injection_1.Lazy.of(validation_controller_1.ValidationController)]; + __decorate([ + aurelia_templating_1.bindable({ defaultBindingMode: aurelia_binding_1.bindingMode.oneWay }) + ], ValidationErrorsCustomAttribute.prototype, "controller", void 0); + __decorate([ + aurelia_templating_1.bindable({ primaryProperty: true, defaultBindingMode: aurelia_binding_1.bindingMode.twoWay }) + ], ValidationErrorsCustomAttribute.prototype, "errors", void 0); ValidationErrorsCustomAttribute = __decorate([ - aurelia_templating_1.customAttribute('validation-errors', aurelia_binding_1.bindingMode.twoWay) + aurelia_templating_1.customAttribute('validation-errors') ], ValidationErrorsCustomAttribute); exports_1("ValidationErrorsCustomAttribute", ValidationErrorsCustomAttribute); } diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 716b508a..7dcbfc20 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,23 @@ + +# [1.0.0](https://github.com/aurelia/validation/compare/1.0.0-beta.1.0.1...v1.0.0) (2017-03-01) + + +### Bug Fixes + +* **build:** add __esModule flag ([0f20d7c](https://github.com/aurelia/validation/commit/0f20d7c)), closes [#417](https://github.com/aurelia/validation/issues/417) +* **package:** delete unnecessary [@types](https://github.com/types) packages ([f9ec842](https://github.com/aurelia/validation/commit/f9ec842)) +* **package:** update to typescript 2.2 ([65759b4](https://github.com/aurelia/validation/commit/65759b4)), closes [#417](https://github.com/aurelia/validation/issues/417) +* **ValidationParser:** improve function regex ([5e32142](https://github.com/aurelia/validation/commit/5e32142)) + + +### Features + +* **validation-errors:** enable explicit controller binding ([4fbf24e](https://github.com/aurelia/validation/commit/4fbf24e)) +* **validation-messages:** displayName function ([233fbbc](https://github.com/aurelia/validation/commit/233fbbc)) +* **Validator:** server-side validation ([1b701ab](https://github.com/aurelia/validation/commit/1b701ab)), closes [#398](https://github.com/aurelia/validation/issues/398) + + + # [1.0.0-beta.1.0.1](https://github.com/aurelia/validation/compare/1.0.0-beta.1.0.0...v1.0.0-beta.1.0.1) (2016-12-24) diff --git a/doc/api.json b/doc/api.json index 01dd4094..9c0b255a 100644 --- a/doc/api.json +++ b/doc/api.json @@ -1 +1 @@ -{"name":"aurelia-validation","children":[{"id":634,"name":"AureliaValidationConfiguration","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Aurelia Validation Configuration API"},"children":[{"id":635,"name":"validatorType","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":814,"character":29}],"type":{"type":"instrinct","name":"any"}},{"id":643,"name":"apply","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":644,"name":"apply","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the configuration."},"parameters":[{"id":645,"name":"container","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Container"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":824,"character":13}]},{"id":636,"name":"customValidator","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":637,"name":"customValidator","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Use a custom Validator implementation."},"parameters":[{"id":638,"name":"type","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":639,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":640,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":641,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":642,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"reference","name":"__type","id":639}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":818,"character":31}]}],"groups":[{"title":"Constructors","kind":512,"children":[640]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":818,"character":29}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":818,"character":23}]}],"groups":[{"title":"Properties","kind":1024,"children":[635]},{"title":"Methods","kind":2048,"children":[643,636]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":813,"character":47}]},{"id":579,"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":580,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":583,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":584,"name":"new FluentEnsure","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":585,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":339}}],"type":{"type":"reference","name":"FluentEnsure","id":579}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":731,"character":38}]},{"id":581,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":727,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":582,"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":731,"character":13}],"type":{"type":"reference","isArray":true,"name":"Rule","id":304,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"instrinct","name":"any"}]}},{"id":595,"name":"_addRule","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":596,"name":"_addRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a rule definition to the sequenced ruleset."},"parameters":[{"id":597,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Rule","id":304,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"instrinct","name":"any"}]}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":751,"character":16}]},{"id":598,"name":"assertInitialized","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":599,"name":"assertInitialized","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":752,"character":33}]},{"id":586,"name":"ensure","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":587,"name":"ensure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Target a property with validation rules."},"typeParameter":[{"id":588,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":589,"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":334,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}]}}],"type":{"type":"reference","name":"FluentRules","id":515,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":738,"character":14}]},{"id":590,"name":"ensureObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":591,"name":"ensureObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Targets an object with validation rules."},"type":{"type":"reference","name":"FluentRules","id":515,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":742,"character":20}]},{"id":592,"name":"on","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":593,"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":594,"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":747,"character":10}]}],"groups":[{"title":"Constructors","kind":512,"children":[583]},{"title":"Properties","kind":1024,"children":[581,582]},{"title":"Methods","kind":2048,"children":[595,598,586,590,592]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":726,"character":29}]},{"id":432,"name":"FluentRuleCustomizer","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Part of the fluent rule API. Enables customizing property rules."},"typeParameter":[{"id":433,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":434,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":439,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":440,"name":"new FluentRuleCustomizer","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":441,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RuleProperty","id":301}},{"id":442,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":443,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":444,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":445,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":446,"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":543,"character":54}]}}},{"id":447,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Object"}},{"id":448,"name":"fluentEnsure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FluentEnsure","id":579,"typeArguments":[{"type":"typeParameter","name":"TObject"}]}},{"id":449,"name":"fluentRules","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FluentRules","id":515,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}},{"id":450,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":339}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":542,"character":21}]},{"id":435,"name":"fluentEnsure","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":539,"character":28}],"type":{"type":"instrinct","name":"any"}},{"id":436,"name":"fluentRules","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":540,"character":27}],"type":{"type":"instrinct","name":"any"}},{"id":437,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":541,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":438,"name":"rule","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":542,"character":20}],"type":{"type":"instrinct","name":"any"}},{"id":477,"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":583,"character":22}],"type":{"type":"reference","isArray":true,"name":"Rule","id":304,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"instrinct","name":"any"}]}},{"id":498,"name":"email","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":499,"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":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":617,"character":13}]},{"id":468,"name":"ensure","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":469,"name":"ensure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Target a property with validation rules."},"typeParameter":[{"id":470,"name":"TValue2","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":471,"name":"subject","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"reflection","declaration":{"id":472,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":473,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":474,"name":"model","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"typeParameter","name":"TValue2"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":573,"character":41}]}}]}}],"type":{"type":"reference","name":"FluentRules","id":515,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue2"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":573,"character":14}]},{"id":475,"name":"ensureObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":476,"name":"ensureObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Targets an object with validation rules."},"type":{"type":"reference","name":"FluentRules","id":515,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":579,"character":20}]},{"id":512,"name":"equals","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":513,"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":514,"name":"expectedValue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":642,"character":14}]},{"id":495,"name":"matches","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":496,"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":497,"name":"regex","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RegExp"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":612,"character":15}]},{"id":509,"name":"maxItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":510,"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":511,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":637,"character":16}]},{"id":503,"name":"maxLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":504,"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":505,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":627,"character":17}]},{"id":506,"name":"minItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":507,"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":508,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":632,"character":16}]},{"id":500,"name":"minLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":501,"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":502,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":622,"character":17}]},{"id":478,"name":"on","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":479,"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":480,"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":579,"typeArguments":[{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":588,"character":10}]},{"id":493,"name":"required","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":494,"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":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":606,"character":16}]},{"id":481,"name":"satisfies","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":482,"name":"satisfies","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies an ad-hoc rule function to the ensured property or object."},"parameters":[{"id":483,"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":484,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":485,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":486,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":487,"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":595,"character":28}]}}},{"id":488,"name":"config","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Object"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":595,"character":17}]},{"id":489,"name":"satisfiesRule","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":490,"name":"satisfiesRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies a rule by name."},"parameters":[{"id":491,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the custom or standard rule."},"type":{"type":"instrinct","name":"string"}},{"id":492,"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":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":601,"character":21}]},{"id":465,"name":"tag","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":466,"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":467,"name":"tag","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":568,"character":11}]},{"id":451,"name":"then","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":452,"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":549,"character":12}]},{"id":459,"name":"when","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":460,"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":461,"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":462,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":463,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":464,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":563,"character":23}]}}}]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":563,"character":12}]},{"id":456,"name":"withMessage","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":457,"name":"withMessage","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Specifies rule's validation message."},"parameters":[{"id":458,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":557,"character":19}]},{"id":453,"name":"withMessageKey","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":454,"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":455,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":553,"character":22}]}],"groups":[{"title":"Constructors","kind":512,"children":[439]},{"title":"Properties","kind":1024,"children":[435,436,437,438,477]},{"title":"Methods","kind":2048,"children":[498,468,475,512,495,509,503,506,500,478,493,481,489,465,451,459,456,453]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":538,"character":37}]},{"id":515,"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":516,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":517,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":537,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":538,"name":"new FluentRules","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":539,"name":"fluentEnsure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FluentEnsure","id":579,"typeArguments":[{"type":"typeParameter","name":"TObject"}]}},{"id":540,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":339}},{"id":541,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RuleProperty","id":301}}],"type":{"type":"reference","name":"FluentRules","id":515}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":662,"character":25}]},{"id":518,"name":"fluentEnsure","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":648,"character":28}],"type":{"type":"instrinct","name":"any"}},{"id":519,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":649,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":520,"name":"property","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":650,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":536,"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":"aurelia-validation.d.ts","line":662,"character":16}],"type":{"type":"instrinct","name":"number"}},{"id":521,"name":"customRules","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":651,"character":26}],"type":{"type":"reflection","declaration":{"id":522,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"indexSignature":[{"id":523,"name":"__index","kind":8192,"kindString":"Index signature","flags":{},"parameters":[{"id":524,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reflection","declaration":{"id":525,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":532,"name":"argsToConfig","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":654,"character":28}],"type":{"type":"reflection","declaration":{"id":533,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":534,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":535,"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":654,"character":30}]}}},{"id":526,"name":"condition","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":653,"character":25}],"type":{"type":"reflection","declaration":{"id":527,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":528,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":529,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":530,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}},{"id":531,"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":653,"character":26}]}}}],"groups":[{"title":"Variables","kind":32,"children":[532,526]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":652,"character":27}]}}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":651,"character":27}]}}},{"id":542,"name":"displayName","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":543,"name":"displayName","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets the display name of the ensured property."},"parameters":[{"id":544,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":667,"character":19}]},{"id":562,"name":"email","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":563,"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":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":696,"character":13}]},{"id":576,"name":"equals","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":577,"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":578,"name":"expectedValue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":721,"character":14}]},{"id":559,"name":"matches","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":560,"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":561,"name":"regex","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RegExp"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":691,"character":15}]},{"id":573,"name":"maxItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":574,"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":575,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":716,"character":16}]},{"id":567,"name":"maxLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":568,"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":569,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":706,"character":17}]},{"id":570,"name":"minItems","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":571,"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":572,"name":"count","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":711,"character":16}]},{"id":564,"name":"minLength","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":565,"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":566,"name":"length","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":701,"character":17}]},{"id":557,"name":"required","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":558,"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":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":685,"character":16}]},{"id":545,"name":"satisfies","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":546,"name":"satisfies","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies an ad-hoc rule function to the ensured property or object."},"parameters":[{"id":547,"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":548,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":549,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":550,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":551,"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":674,"character":28}]}}},{"id":552,"name":"config","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Object"}}],"type":{"type":"reference","name":"FluentRuleCustomizer","id":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":674,"character":17}]},{"id":553,"name":"satisfiesRule","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":554,"name":"satisfiesRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies a rule by name."},"parameters":[{"id":555,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the custom or standard rule."},"type":{"type":"instrinct","name":"string"}},{"id":556,"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":432,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":680,"character":21}]}],"groups":[{"title":"Constructors","kind":512,"children":[537]},{"title":"Properties","kind":1024,"children":[518,519,520,536,521]},{"title":"Methods","kind":2048,"children":[542,562,576,559,573,567,570,564,557,545,553]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":647,"character":28}]},{"id":365,"name":"MessageExpressionValidator","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":371,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":372,"name":"new MessageExpressionValidator","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":373,"name":"originalMessage","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"MessageExpressionValidator","id":365},"overwrites":{"type":"reference","name":"Unparser.__constructor"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":460,"character":79}],"overwrites":{"type":"reference","name":"Unparser.__constructor"}},{"id":366,"name":"originalMessage","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":459,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":374,"name":"visitAccessScope","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":375,"name":"visitAccessScope","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":376,"name":"access","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"AccessScope"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":462,"character":24}]},{"id":367,"name":"validate","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":368,"name":"validate","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":369,"name":"expression","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Expression"}},{"id":370,"name":"originalMessage","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":460,"character":23}]}],"groups":[{"title":"Constructors","kind":512,"children":[371]},{"title":"Properties","kind":1024,"children":[366]},{"title":"Methods","kind":2048,"children":[374,367]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":458,"character":43}],"extendedTypes":[{"type":"reference","name":"Unparser"}],"implementedTypes":[{"type":"reference","name":"ExpressionVisitor"}]},{"id":322,"name":"Rules","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Sets, unsets and retrieves rules on an object or constructor function."},"children":[{"id":323,"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":422,"character":26}],"type":{"type":"instrinct","name":"any"}},{"id":331,"name":"get","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":332,"name":"get","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Retrieves the target's rules."},"parameters":[{"id":333,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"union","types":[{"type":"reference","isArray":true,"name":"Rule","id":304,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]},{"type":"instrinct","name":"null"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":434,"character":18}]},{"id":324,"name":"set","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":325,"name":"set","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the rules to a target."},"parameters":[{"id":326,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":327,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","isArray":true,"name":"Rule","id":304,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":426,"character":18}]},{"id":328,"name":"unset","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":329,"name":"unset","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes rules from a target."},"parameters":[{"id":330,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":430,"character":20}]}],"groups":[{"title":"Properties","kind":1024,"children":[323]},{"title":"Methods","kind":2048,"children":[331,324,328]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":418,"character":22}]},{"id":393,"name":"StandardValidator","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Validates.\nResponsible for validating objects and properties."},"children":[{"id":398,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":399,"name":"new StandardValidator","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":400,"name":"messageProvider","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationMessageProvider","id":380}},{"id":401,"name":"resources","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ViewResources"}}],"type":{"type":"reference","name":"StandardValidator","id":393}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":506,"character":31}]},{"id":397,"name":"getDisplayName","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":506,"character":30}],"type":{"type":"instrinct","name":"any"}},{"id":396,"name":"lookupFunctions","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":505,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":395,"name":"messageProvider","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":504,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":394,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":503,"character":21}],"type":{"type":"union","isArray":true,"types":[{"type":"reference","name":"ViewResources"},{"type":"reference","name":"ValidationMessageProvider","id":380}]}},{"id":415,"name":"getMessage","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":416,"name":"getMessage","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":417,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":418,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":419,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":529,"character":26}]},{"id":411,"name":"ruleExists","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":412,"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":413,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rules to search."},"type":{"type":"reference","isArray":true,"name":"Rule","id":304,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}},{"id":414,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Rule","id":304,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}}],"type":{"type":"instrinct","name":"boolean"},"overwrites":{"type":"reference","name":"Validator.ruleExists","id":37}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":528,"character":18}],"overwrites":{"type":"reference","name":"Validator.ruleExists","id":37}},{"id":427,"name":"validate","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":428,"name":"validate","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":429,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":430,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":431,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":531,"character":24}]},{"id":407,"name":"validateObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":408,"name":"validateObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates all rules for specified object and it's properties."},"parameters":[{"id":409,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":410,"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":2}]},"overwrites":{"type":"reference","name":"Validator.validateObject","id":33}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":522,"character":22}],"overwrites":{"type":"reference","name":"Validator.validateObject","id":33}},{"id":402,"name":"validateProperty","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":403,"name":"validateProperty","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates the specified property."},"parameters":[{"id":404,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":405,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the property to validate."},"type":{"type":"instrinct","name":"string"}},{"id":406,"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":2}]},"overwrites":{"type":"reference","name":"Validator.validateProperty","id":28}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":515,"character":24}],"overwrites":{"type":"reference","name":"Validator.validateProperty","id":28}},{"id":420,"name":"validateRuleSequence","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":421,"name":"validateRuleSequence","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":422,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":423,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":424,"name":"ruleSequence","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":425,"name":"sequence","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":426,"name":"results","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":530,"character":36}]}],"groups":[{"title":"Constructors","kind":512,"children":[398]},{"title":"Properties","kind":1024,"children":[397,396,395,394]},{"title":"Methods","kind":2048,"children":[415,411,427,407,402,420]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":502,"character":34}],"extendedTypes":[{"type":"reference","name":"Validator","id":27}]},{"id":143,"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":148,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":149,"name":"new ValidateBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":150,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateBindingBehavior","id":143},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":124}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":269,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":124}},{"id":144,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":291,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":155,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":156,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":157,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":158,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":159,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":52},{"type":"instrinct","name":"any"}]}},{"id":160,"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":134}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":279,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":134}},{"id":151,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":152,"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":153,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":154,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":130}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":278,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":130}},{"id":145,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":146,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":147,"name":"controller","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationController","id":52}}],"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":127}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":292,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":127}},{"id":161,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":162,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":163,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":140}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":280,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":140}}],"groups":[{"title":"Constructors","kind":512,"children":[148]},{"title":"Properties","kind":1024,"children":[144]},{"title":"Methods","kind":2048,"children":[155,151,145,161]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":290,"character":40}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":122}]},{"id":122,"name":"ValidateBindingBehaviorBase","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Binding behavior. Indicates the bound property should be validated."},"children":[{"id":124,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":125,"name":"new ValidateBindingBehaviorBase","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":126,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateBindingBehaviorBase","id":122}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":269,"character":26}]},{"id":123,"name":"taskQueue","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":269,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":134,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":135,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":136,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":137,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":138,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":52},{"type":"instrinct","name":"any"}]}},{"id":139,"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":279,"character":12}]},{"id":130,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":131,"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":132,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":133,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":278,"character":17}]},{"id":127,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true,"isProtected":true},"signatures":[{"id":128,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":129,"name":"controller","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationController","id":52}}],"type":{"type":"instrinct","name":"number"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":271,"character":45}]},{"id":140,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":141,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":142,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":280,"character":14}]}],"groups":[{"title":"Constructors","kind":512,"children":[124]},{"title":"Properties","kind":1024,"children":[123]},{"title":"Methods","kind":2048,"children":[134,130,127,140]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":268,"character":53}],"extendedBy":[{"type":"reference","name":"ValidateBindingBehavior","id":143},{"type":"reference","name":"ValidateManuallyBindingBehavior","id":164},{"type":"reference","name":"ValidateOnBlurBindingBehavior","id":184},{"type":"reference","name":"ValidateOnChangeBindingBehavior","id":204},{"type":"reference","name":"ValidateOnChangeOrBlurBindingBehavior","id":224}]},{"id":164,"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":168,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":169,"name":"new ValidateManuallyBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":170,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateManuallyBindingBehavior","id":164},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":124}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":269,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":124}},{"id":165,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":300,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":175,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":176,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":177,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":178,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":179,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":52},{"type":"instrinct","name":"any"}]}},{"id":180,"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":134}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":279,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":134}},{"id":171,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":172,"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":173,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":174,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":130}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":278,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":130}},{"id":166,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":167,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":127}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":301,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":127}},{"id":181,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":182,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":183,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":140}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":280,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":140}}],"groups":[{"title":"Constructors","kind":512,"children":[168]},{"title":"Properties","kind":1024,"children":[165]},{"title":"Methods","kind":2048,"children":[175,171,166,181]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":299,"character":48}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":122}]},{"id":184,"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":188,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":189,"name":"new ValidateOnBlurBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":190,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateOnBlurBindingBehavior","id":184},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":124}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":269,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":124}},{"id":185,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":308,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":195,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":196,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":197,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":198,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":199,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":52},{"type":"instrinct","name":"any"}]}},{"id":200,"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":134}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":279,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":134}},{"id":191,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":192,"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":193,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":194,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":130}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":278,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":130}},{"id":186,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":187,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":127}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":309,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":127}},{"id":201,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":202,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":203,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":140}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":280,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":140}}],"groups":[{"title":"Constructors","kind":512,"children":[188]},{"title":"Properties","kind":1024,"children":[185]},{"title":"Methods","kind":2048,"children":[195,191,186,201]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":307,"character":46}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":122}]},{"id":204,"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":208,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":209,"name":"new ValidateOnChangeBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":210,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateOnChangeBindingBehavior","id":204},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":124}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":269,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":124}},{"id":205,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":317,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":215,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":216,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":217,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":218,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":219,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":52},{"type":"instrinct","name":"any"}]}},{"id":220,"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":134}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":279,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":134}},{"id":211,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":212,"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":213,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":214,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":130}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":278,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":130}},{"id":206,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":207,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":127}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":318,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":127}},{"id":221,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":222,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":223,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":140}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":280,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":140}}],"groups":[{"title":"Constructors","kind":512,"children":[208]},{"title":"Properties","kind":1024,"children":[205]},{"title":"Methods","kind":2048,"children":[215,211,206,221]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":316,"character":48}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":122}]},{"id":224,"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":228,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":229,"name":"new ValidateOnChangeOrBlurBindingBehavior","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":230,"name":"taskQueue","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"TaskQueue"}}],"type":{"type":"reference","name":"ValidateOnChangeOrBlurBindingBehavior","id":224},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":124}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":269,"character":26}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.__constructor","id":124}},{"id":225,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":326,"character":21}],"type":{"type":"reference","isArray":true,"name":"TaskQueue"}},{"id":235,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":236,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":237,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":238,"name":"source","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":239,"name":"rulesOrController","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"reference","name":"ValidationController","id":52},{"type":"instrinct","name":"any"}]}},{"id":240,"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":134}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":279,"character":12}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.bind","id":134}},{"id":231,"name":"getTarget","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":232,"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":233,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":234,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":130}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":278,"character":17}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.getTarget","id":130}},{"id":226,"name":"getValidateTrigger","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":227,"name":"getValidateTrigger","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"number"},"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":127}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":327,"character":26}],"overwrites":{"type":"reference","name":"ValidateBindingBehaviorBase.getValidateTrigger","id":127}},{"id":241,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":242,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":243,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"},"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":140}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":280,"character":14}],"inheritedFrom":{"type":"reference","name":"ValidateBindingBehaviorBase.unbind","id":140}}],"groups":[{"title":"Constructors","kind":512,"children":[228]},{"title":"Properties","kind":1024,"children":[225]},{"title":"Methods","kind":2048,"children":[235,231,226,241]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":325,"character":54}],"extendedTypes":[{"type":"reference","name":"ValidateBindingBehaviorBase","id":122}]},{"id":2,"name":"ValidateResult","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"The result of validating an individual validation rule."},"children":[{"id":10,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{},"signatures":[{"id":11,"name":"new ValidateResult","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{},"parameters":[{"id":12,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The rule associated with the result. Validator implementation specific."},"type":{"type":"instrinct","name":"any"}},{"id":13,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The object that was validated."},"type":{"type":"instrinct","name":"any"}},{"id":14,"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":15,"name":"valid","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"boolean"}},{"id":16,"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":2}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":19,"character":19}]},{"id":9,"name":"id","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"A number that uniquely identifies the result instance."},"sources":[{"fileName":"aurelia-validation.d.ts","line":19,"character":10}],"type":{"type":"instrinct","name":"number"}},{"id":7,"name":"message","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":14,"character":15}],"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}},{"id":4,"name":"object","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":11,"character":14}],"type":{"type":"instrinct","name":"any"}},{"id":5,"name":"propertyName","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":12,"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":6,"name":"valid","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":13,"character":13}],"type":{"type":"instrinct","name":"boolean"}},{"id":8,"name":"nextId","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":15,"character":29}],"type":{"type":"instrinct","name":"any"}},{"id":17,"name":"toString","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":18,"name":"toString","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":27,"character":16}]}],"groups":[{"title":"Constructors","kind":512,"children":[10]},{"title":"Properties","kind":1024,"children":[9,7,4,5,3,6,8]},{"title":"Methods","kind":2048,"children":[17]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":9,"character":31}]},{"id":52,"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":64,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":65,"name":"new ValidationController","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":66,"name":"validator","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Validator","id":27}}],"type":{"type":"reference","name":"ValidationController","id":52}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":189,"character":33}]},{"id":55,"name":"bindings","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":169,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":60,"name":"elements","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":183,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":58,"name":"errors","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Validation errors that have been rendered by the controller."},"sources":[{"fileName":"aurelia-validation.d.ts","line":178,"character":14}],"type":{"type":"reference","isArray":true,"name":"ValidateResult","id":2}},{"id":63,"name":"finishValidating","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":189,"character":32}],"type":{"type":"instrinct","name":"any"}},{"id":61,"name":"objects","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":184,"character":23}],"type":{"type":"instrinct","name":"any"}},{"id":56,"name":"renderers","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":170,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":57,"name":"results","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"comment":{"shortText":"Validation results that have been rendered by the controller."},"sources":[{"fileName":"aurelia-validation.d.ts","line":174,"character":23}],"type":{"type":"instrinct","name":"any"}},{"id":62,"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":188,"character":23}],"type":{"type":"instrinct","name":"number"}},{"id":59,"name":"validating","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":" Whether the controller is currently validating."},"sources":[{"fileName":"aurelia-validation.d.ts","line":182,"character":18}],"type":{"type":"instrinct","name":"boolean"}},{"id":53,"name":"validator","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":167,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":54,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":168,"character":21}],"type":{"type":"reference","isArray":true,"name":"Validator","id":27}},{"id":74,"name":"addError","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":75,"name":"addError","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds and renders an error."},"parameters":[{"id":76,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}},{"id":77,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":78,"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":2}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":205,"character":16}]},{"id":67,"name":"addObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":68,"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":69,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object."},"type":{"type":"instrinct","name":"any"}},{"id":70,"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":196,"character":17}]},{"id":82,"name":"addRenderer","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":83,"name":"addRenderer","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a renderer."},"parameters":[{"id":84,"name":"renderer","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The renderer.\n"},"type":{"type":"reference","name":"ValidationRenderer","id":48}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":214,"character":19}]},{"id":105,"name":"getAssociatedElements","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":106,"name":"getAssociatedElements","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the elements associated with an object and propertyName (if any)."},"parameters":[{"id":107,"name":"__namedParameters","kind":32768,"kindString":"Parameter","flags":{},"originalName":"__0","type":{"type":"reflection","declaration":{"id":108,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":109,"name":"object","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":252,"character":45}],"type":{"type":"instrinct","name":"any"}},{"id":110,"name":"propertyName","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":252,"character":59}],"type":{"type":"instrinct","name":"any"}}],"groups":[{"title":"Variables","kind":32,"children":[109,110]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":252,"character":38}]}}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":252,"character":37}]},{"id":96,"name":"getInstructionPredicate","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":97,"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":98,"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":236,"character":39}]},{"id":111,"name":"processResultDelta","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":112,"name":"processResultDelta","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":113,"name":"kind","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":114,"name":"oldResults","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":115,"name":"newResults","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":253,"character":34}]},{"id":88,"name":"registerBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":89,"name":"registerBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Registers a binding with the controller."},"parameters":[{"id":90,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The binding instance."},"type":{"type":"reference","name":"Binding"}},{"id":91,"name":"target","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The DOM element."},"type":{"type":"reference","name":"Element"}},{"id":92,"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":226,"character":23}]},{"id":79,"name":"removeError","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":80,"name":"removeError","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes and unrenders an error."},"parameters":[{"id":81,"name":"result","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidateResult","id":2}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":209,"character":19}]},{"id":71,"name":"removeObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":72,"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":73,"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":201,"character":20}]},{"id":85,"name":"removeRenderer","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":86,"name":"removeRenderer","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes a renderer."},"parameters":[{"id":87,"name":"renderer","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The renderer.\n"},"type":{"type":"reference","name":"ValidationRenderer","id":48}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":219,"character":22}]},{"id":102,"name":"reset","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":103,"name":"reset","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Resets any rendered validation results (unrenders)."},"parameters":[{"id":104,"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":19}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":248,"character":13}]},{"id":119,"name":"resetBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":120,"name":"resetBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Resets the results for a property associated with a binding."},"parameters":[{"id":121,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Binding"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":261,"character":20}]},{"id":93,"name":"unregisterBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":94,"name":"unregisterBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Unregisters a binding with the controller."},"parameters":[{"id":95,"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":231,"character":25}]},{"id":99,"name":"validate","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":100,"name":"validate","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates and renders results."},"parameters":[{"id":101,"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":19}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"ControllerValidateResult","id":23}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":242,"character":16}]},{"id":116,"name":"validateBinding","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":117,"name":"validateBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates the property associated with a binding."},"parameters":[{"id":118,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Binding"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":257,"character":23}]}],"groups":[{"title":"Constructors","kind":512,"children":[64]},{"title":"Properties","kind":1024,"children":[55,60,58,63,61,56,57,62,59,53,54]},{"title":"Methods","kind":2048,"children":[74,67,82,105,96,111,88,79,71,85,102,119,93,99,116]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":166,"character":37}]},{"id":244,"name":"ValidationControllerFactory","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Creates ValidationController instances."},"children":[{"id":249,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":250,"name":"new ValidationControllerFactory","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":251,"name":"container","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Container"}}],"type":{"type":"reference","name":"ValidationControllerFactory","id":244}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":337,"character":70}]},{"id":245,"name":"container","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":336,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":252,"name":"create","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":253,"name":"create","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Creates a new controller instance."},"parameters":[{"id":254,"name":"validator","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Validator","id":27}}],"type":{"type":"reference","name":"ValidationController","id":52}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":342,"character":14}]},{"id":255,"name":"createForCurrentScope","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":256,"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":257,"name":"validator","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"Validator","id":27}}],"type":{"type":"reference","name":"ValidationController","id":52}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":347,"character":29}]},{"id":246,"name":"get","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":247,"name":"get","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":248,"name":"container","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Container"}}],"type":{"type":"reference","name":"ValidationControllerFactory","id":244}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":337,"character":18}]}],"groups":[{"title":"Constructors","kind":512,"children":[249]},{"title":"Properties","kind":1024,"children":[245]},{"title":"Methods","kind":2048,"children":[252,255,246]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":335,"character":44}]},{"id":261,"name":"ValidationErrorsCustomAttribute","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":271,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":272,"name":"new ValidationErrorsCustomAttribute","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":273,"name":"boundaryElement","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Element"}},{"id":274,"name":"controllerAccessor","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":275,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":276,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"ValidationController","id":52}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":366,"character":65}]}}}],"type":{"type":"reference","name":"ValidationErrorsCustomAttribute","id":261}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":365,"character":32}]},{"id":262,"name":"boundaryElement","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":358,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":263,"name":"controllerAccessor","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":359,"character":34}],"type":{"type":"instrinct","name":"any"}},{"id":270,"name":"errors","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":365,"character":14}],"type":{"type":"reference","isArray":true,"name":"RenderedError","id":258}},{"id":269,"name":"value","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":364,"character":13}],"type":{"type":"reference","isArray":true,"name":"RenderedError","id":258}},{"id":264,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":360,"character":21}],"type":{"type":"union","isArray":true,"types":[{"type":"reflection","declaration":{"id":265,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":266,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":267,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"type":{"type":"reference","name":"__type","id":265}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":360,"character":25}]},{"id":268,"name":"prototype","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":362,"character":21}],"type":{"type":"reference","name":"Element"}}],"groups":[{"title":"Constructors","kind":512,"children":[266]},{"title":"Variables","kind":32,"children":[268]}]}},{"type":"reference","name":"Lazy"}]}},{"id":285,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":286,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":372,"character":12}]},{"id":279,"name":"interestingElements","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":280,"name":"interestingElements","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":281,"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":370,"character":27}]},{"id":282,"name":"render","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":283,"name":"render","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":284,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"RenderInstruction","id":44}}],"type":{"type":"instrinct","name":"void"},"implementationOf":{"type":"reference","name":"ValidationRenderer.render","id":50}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":371,"character":14}],"implementationOf":{"type":"reference","name":"ValidationRenderer.render","id":49}},{"id":277,"name":"sort","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":278,"name":"sort","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":369,"character":12}]},{"id":287,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":288,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":373,"character":14}]}],"groups":[{"title":"Constructors","kind":512,"children":[271]},{"title":"Properties","kind":1024,"children":[262,263,270,269,264]},{"title":"Methods","kind":2048,"children":[285,279,282,277,287]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":357,"character":48}],"implementedTypes":[{"type":"reference","name":"ValidationRenderer","id":48}]},{"id":380,"name":"ValidationMessageProvider","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Retrieves validation messages and property display names."},"children":[{"id":383,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":384,"name":"new ValidationMessageProvider","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":385,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":339}}],"type":{"type":"reference","name":"ValidationMessageProvider","id":380}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":478,"character":49}]},{"id":381,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":477,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":382,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":478,"character":21}],"type":{"type":"reference","isArray":true,"name":"ValidationParser","id":339}},{"id":389,"name":"getDisplayName","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":390,"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":391,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The property name.\n"},"type":{"type":"instrinct","name":"string"}},{"id":392,"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":"aurelia-validation.d.ts","line":491,"character":22}]},{"id":386,"name":"getMessage","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":387,"name":"getMessage","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Returns a message binding expression that corresponds to the key."},"parameters":[{"id":388,"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":484,"character":18}]}],"groups":[{"title":"Constructors","kind":512,"children":[383]},{"title":"Properties","kind":1024,"children":[381,382]},{"title":"Methods","kind":2048,"children":[389,386]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":476,"character":42}]},{"id":339,"name":"ValidationParser","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":347,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"signatures":[{"id":348,"name":"new ValidationParser","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":349,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Parser"}},{"id":350,"name":"bindinqLanguage","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"BindingLanguage"}}],"type":{"type":"reference","name":"ValidationParser","id":339}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":451,"character":22}]},{"id":341,"name":"bindinqLanguage","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":446,"character":31}],"type":{"type":"instrinct","name":"any"}},{"id":346,"name":"cache","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":451,"character":21}],"type":{"type":"instrinct","name":"any"}},{"id":343,"name":"emptyStringExpression","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":448,"character":37}],"type":{"type":"instrinct","name":"any"}},{"id":344,"name":"nullExpression","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":449,"character":30}],"type":{"type":"instrinct","name":"any"}},{"id":340,"name":"parser","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":445,"character":22}],"type":{"type":"instrinct","name":"any"}},{"id":345,"name":"undefinedExpression","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":450,"character":35}],"type":{"type":"instrinct","name":"any"}},{"id":342,"name":"inject","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":447,"character":21}],"type":{"type":"union","isArray":true,"types":[{"type":"reference","name":"Parser"},{"type":"reference","name":"BindingLanguage"}]}},{"id":359,"name":"coalesce","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":360,"name":"coalesce","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":361,"name":"part","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":455,"character":24}]},{"id":362,"name":"getAccessorExpression","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":363,"name":"getAccessorExpression","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":364,"name":"fn","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":456,"character":37}]},{"id":351,"name":"parseMessage","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":352,"name":"parseMessage","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":353,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Expression"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":453,"character":20}]},{"id":354,"name":"parseProperty","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":355,"name":"parseProperty","kind":4096,"kindString":"Call signature","flags":{},"typeParameter":[{"id":356,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":357,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":358,"name":"property","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"reference","name":"PropertyAccessor","id":334,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}]}}],"type":{"type":"reference","name":"RuleProperty","id":301}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":454,"character":21}]}],"groups":[{"title":"Constructors","kind":512,"children":[347]},{"title":"Properties","kind":1024,"children":[341,346,343,344,340,345,342]},{"title":"Methods","kind":2048,"children":[359,362,351,354]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":444,"character":33}]},{"id":289,"name":"ValidationRendererCustomAttribute","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":290,"name":"container","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":377,"character":25}],"type":{"type":"instrinct","name":"any"}},{"id":291,"name":"controller","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":378,"character":26}],"type":{"type":"instrinct","name":"any"}},{"id":293,"name":"renderer","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":380,"character":24}],"type":{"type":"instrinct","name":"any"}},{"id":292,"name":"value","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":379,"character":21}],"type":{"type":"instrinct","name":"any"}},{"id":297,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":298,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":382,"character":12}]},{"id":294,"name":"created","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":295,"name":"created","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":296,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":381,"character":15}]},{"id":299,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":300,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":383,"character":14}]}],"groups":[{"title":"Properties","kind":1024,"children":[290,291,293,292]},{"title":"Methods","kind":2048,"children":[297,294,299]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":376,"character":50}]},{"id":600,"name":"ValidationRules","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Fluent rule definition API."},"children":[{"id":601,"name":"parser","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isPrivate":true,"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":758,"character":29}],"type":{"type":"instrinct","name":"any"}},{"id":613,"name":"customRule","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":614,"name":"customRule","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Defines a custom rule."},"parameters":[{"id":615,"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":616,"name":"condition","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rule function."},"type":{"type":"reflection","declaration":{"id":617,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":618,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":619,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}},{"id":620,"name":"object","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"instrinct","name":"any"}},{"id":621,"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":777,"character":50}]}}},{"id":622,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message expression"},"type":{"type":"instrinct","name":"string"}},{"id":623,"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":624,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":625,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":626,"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":777,"character":156}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":777,"character":25}]},{"id":605,"name":"ensure","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":606,"name":"ensure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Target a property with validation rules."},"typeParameter":[{"id":607,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":608,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":609,"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":334,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}]}}],"type":{"type":"reference","name":"FluentRules","id":515,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TValue"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":764,"character":21}]},{"id":610,"name":"ensureObject","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":611,"name":"ensureObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Targets an object with validation rules."},"typeParameter":[{"id":612,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}}],"type":{"type":"reference","name":"FluentRules","id":515,"typeArguments":[{"type":"typeParameter","name":"TObject"},{"type":"typeParameter","name":"TObject"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":768,"character":27}]},{"id":602,"name":"initialize","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":603,"name":"initialize","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":604,"name":"parser","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ValidationParser","id":339}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":759,"character":25}]},{"id":631,"name":"off","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":632,"name":"off","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes the rules from a class or object."},"parameters":[{"id":633,"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":788,"character":18}]},{"id":627,"name":"taggedRules","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":628,"name":"taggedRules","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Returns rules with the matching tag."},"parameters":[{"id":629,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rules to search."},"type":{"type":"reference","isArray":true,"name":"Rule","id":304,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}},{"id":630,"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":304,"typeArguments":[{"type":"instrinct","name":"any"},{"type":"instrinct","name":"any"}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":783,"character":26}]}],"groups":[{"title":"Properties","kind":1024,"children":[601]},{"title":"Methods","kind":2048,"children":[613,605,610,602,631,627]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":757,"character":32}]},{"id":27,"name":"Validator","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Validates objects and properties."},"children":[{"id":37,"name":"ruleExists","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":38,"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":39,"name":"rules","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The rules to search."},"type":{"type":"instrinct","name":"any"}},{"id":40,"name":"rule","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":101,"character":27}]},{"id":33,"name":"validateObject","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":34,"name":"validateObject","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates all rules for specified object and it's properties."},"parameters":[{"id":35,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":36,"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":2}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":95,"character":31}]},{"id":28,"name":"validateProperty","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":29,"name":"validateProperty","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Validates the specified property."},"parameters":[{"id":30,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object to validate."},"type":{"type":"instrinct","name":"any"}},{"id":31,"name":"propertyName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of the property to validate."},"type":{"type":"instrinct","name":"string"}},{"id":32,"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":2}]}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":88,"character":33}]}],"groups":[{"title":"Methods","kind":2048,"children":[37,33,28]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":80,"character":35}],"extendedBy":[{"type":"reference","name":"StandardValidator","id":393}]},{"id":23,"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":26,"name":"instruction","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"comment":{"shortText":"The instruction passed to the controller's validate method."},"sources":[{"fileName":"aurelia-validation.d.ts","line":64,"character":19}],"type":{"type":"reference","name":"ValidateInstruction","id":19}},{"id":25,"name":"results","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The validation result of every rule that was evaluated."},"sources":[{"fileName":"aurelia-validation.d.ts","line":60,"character":15}],"type":{"type":"reference","isArray":true,"name":"ValidateResult","id":2}},{"id":24,"name":"valid","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Whether validation passed."},"sources":[{"fileName":"aurelia-validation.d.ts","line":56,"character":13}],"type":{"type":"instrinct","name":"boolean"}}],"groups":[{"title":"Properties","kind":1024,"children":[26,25,24]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":52,"character":45}]},{"id":334,"name":"PropertyAccessor","kind":256,"kindString":"Interface","flags":{"isExported":true},"typeParameter":[{"id":335,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":336,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"signatures":[{"id":337,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":338,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"typeParameter","name":"TValue"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":441,"character":37}]},{"id":44,"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":45,"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":134,"character":12}],"type":{"type":"union","types":[{"type":"stringLiteral","value":"validate"},{"type":"stringLiteral","value":"reset"}]}},{"id":46,"name":"render","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The results to render."},"sources":[{"fileName":"aurelia-validation.d.ts","line":138,"character":14}],"type":{"type":"reference","isArray":true,"name":"ResultInstruction","id":41}},{"id":47,"name":"unrender","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The results to unrender."},"sources":[{"fileName":"aurelia-validation.d.ts","line":142,"character":16}],"type":{"type":"reference","isArray":true,"name":"ResultInstruction","id":41}}],"groups":[{"title":"Properties","kind":1024,"children":[45,46,47]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":130,"character":38}]},{"id":258,"name":"RenderedError","kind":256,"kindString":"Interface","flags":{"isExported":true},"children":[{"id":259,"name":"error","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":354,"character":13}],"type":{"type":"reference","name":"ValidateResult","id":2}},{"id":260,"name":"targets","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":355,"character":15}],"type":{"type":"reference","isArray":true,"name":"Element"}}],"groups":[{"title":"Properties","kind":1024,"children":[259,260]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":353,"character":34}]},{"id":41,"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":43,"name":"elements","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The associated elements (if any)."},"sources":[{"fileName":"aurelia-validation.d.ts","line":125,"character":16}],"type":{"type":"reference","isArray":true,"name":"Element"}},{"id":42,"name":"result","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The validation result."},"sources":[{"fileName":"aurelia-validation.d.ts","line":121,"character":14}],"type":{"type":"reference","name":"ValidateResult","id":2}}],"groups":[{"title":"Properties","kind":1024,"children":[43,42]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":117,"character":38}]},{"id":304,"name":"Rule","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"A rule definition. Associations a rule with a property or object."},"typeParameter":[{"id":305,"name":"TObject","kind":131072,"kindString":"Type parameter","flags":{}},{"id":306,"name":"TValue","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":308,"name":"condition","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":404,"character":17}],"type":{"type":"reflection","declaration":{"id":309,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":310,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":311,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TValue"}},{"id":312,"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":404,"character":18}]}}},{"id":313,"name":"config","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":405,"character":14}],"type":{"type":"reference","name":"Object"}},{"id":319,"name":"message","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":410,"character":15}],"type":{"type":"union","types":[{"type":"reference","name":"Expression"},{"type":"instrinct","name":"null"}]}},{"id":318,"name":"messageKey","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":409,"character":18}],"type":{"type":"instrinct","name":"string"}},{"id":307,"name":"property","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":403,"character":16}],"type":{"type":"reference","name":"RuleProperty","id":301}},{"id":320,"name":"sequence","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":411,"character":16}],"type":{"type":"instrinct","name":"number"}},{"id":321,"name":"tag","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":412,"character":11}],"type":{"type":"instrinct","name":"string"}},{"id":314,"name":"when","kind":1024,"kindString":"Property","flags":{"isExported":true},"sources":[{"fileName":"aurelia-validation.d.ts","line":406,"character":12}],"type":{"type":"union","types":[{"type":"reflection","declaration":{"id":315,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":316,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":317,"name":"object","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeParameter","name":"TObject"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":406,"character":13}]}},{"type":"instrinct","name":"null"}]}}],"groups":[{"title":"Properties","kind":1024,"children":[308,313,319,318,307,320,321,314]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":402,"character":25}]},{"id":301,"name":"RuleProperty","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Information related to a property that is the subject of validation."},"children":[{"id":303,"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":397,"character":19}],"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}},{"id":302,"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":393,"character":12}],"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","name":"null"}]}}],"groups":[{"title":"Properties","kind":1024,"children":[303,302]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":389,"character":33}]},{"id":19,"name":"ValidateInstruction","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Instructions for the validation controller's validate method."},"children":[{"id":20,"name":"object","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The object to validate."},"sources":[{"fileName":"aurelia-validation.d.ts","line":37,"character":14}],"type":{"type":"instrinct","name":"any"}},{"id":21,"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":41,"character":20}],"type":{"type":"instrinct","name":"any"}},{"id":22,"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":45,"character":13}],"type":{"type":"instrinct","name":"any"}}],"groups":[{"title":"Properties","kind":1024,"children":[20,21,22]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":33,"character":40}]},{"id":377,"name":"ValidationMessages","kind":256,"kindString":"Interface","flags":{"isExported":true},"indexSignature":[{"id":378,"name":"__index","kind":8192,"kindString":"Index signature","flags":{},"parameters":[{"id":379,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"string"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":466,"character":39}]},{"id":48,"name":"ValidationRenderer","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Renders validation results."},"children":[{"id":49,"name":"render","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":50,"name":"render","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Render the validation results."},"parameters":[{"id":51,"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":44}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":153,"character":14}]}],"groups":[{"title":"Methods","kind":2048,"children":[49]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":147,"character":39}],"implementedBy":[{"type":"reference","name":"ValidationErrorsCustomAttribute","id":261}]},{"id":653,"name":"validateTrigger","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"Validation triggers."},"sources":[{"fileName":"aurelia-validation.d.ts","line":107,"character":32}],"type":{"type":"reflection","declaration":{"id":654,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":656,"name":"blur","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":109,"character":12}],"type":{"type":"instrinct","name":"number"}},{"id":657,"name":"change","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":110,"character":14}],"type":{"type":"instrinct","name":"number"}},{"id":658,"name":"changeOrBlur","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":111,"character":20}],"type":{"type":"instrinct","name":"number"}},{"id":655,"name":"manual","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":108,"character":14}],"type":{"type":"instrinct","name":"number"}}],"groups":[{"title":"Variables","kind":32,"children":[656,657,658,655]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":107,"character":33}]}}},{"id":662,"name":"validationMessages","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"Dictionary of validation messages. [messageKey]: messageExpression"},"sources":[{"fileName":"aurelia-validation.d.ts","line":472,"character":35}],"type":{"type":"reference","name":"ValidationMessages","id":377}},{"id":663,"name":"configure","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":664,"name":"configure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Configures the plugin."},"parameters":[{"id":665,"name":"frameworkConfig","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":666,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":667,"name":"container","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":830,"character":17}],"type":{"type":"reference","name":"Container"}},{"id":668,"name":"globalResources","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":831,"character":23}],"type":{"type":"reflection","declaration":{"id":669,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":670,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":671,"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":831,"character":24}]}}}],"groups":[{"title":"Variables","kind":32,"children":[667,668]}],"sources":[{"fileName":"aurelia-validation.d.ts","line":829,"character":46}]}}},{"id":672,"name":"callback","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":673,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":674,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":675,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"AureliaValidationConfiguration","id":634}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":832,"character":17}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":829,"character":29}]},{"id":646,"name":"getPropertyInfo","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":647,"name":"getPropertyInfo","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Retrieves the object and property name for the specified expression."},"parameters":[{"id":648,"name":"expression","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The expression"},"type":{"type":"reference","name":"Expression"}},{"id":649,"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":650,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":651,"name":"object","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"aurelia-validation.d.ts","line":73,"character":14}],"type":{"type":"reference","name":"Object"}},{"id":652,"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":[651,652]}],"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":659,"name":"isString","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":660,"name":"isString","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":661,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"boolean"}}],"sources":[{"fileName":"aurelia-validation.d.ts","line":437,"character":28}]}],"groups":[{"title":"Classes","kind":128,"children":[634,579,432,515,365,322,393,143,122,164,184,204,224,2,52,244,261,380,339,289,600,27]},{"title":"Interfaces","kind":256,"children":[23,334,44,258,41,304,301,19,377,48]},{"title":"Variables","kind":32,"children":[653,662]},{"title":"Functions","kind":64,"children":[663,646,659]}]} +{"name":"aurelia-validation","children":[{"id":687,"name":"AureliaValidationConfiguration","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Aurelia Validation Configuration API"},"children":[{"id":688,"name":"validatorType","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"src/aurelia-validation.ts","line":37,"character":23}],"type":{"type":"reflection","declaration":{"id":689,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":690,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":691,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":692,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"reference","name":"__type","id":689}}],"sources":[{"fileName":"src/aurelia-validation.ts","line":37,"character":26}]}],"groups":[{"title":"Constructors","kind":512,"children":[690]}],"sources":[{"fileName":"src/aurelia-validation.ts","line":37,"character":24}]}},"defaultValue":" StandardValidator"},{"id":700,"name":"apply","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":701,"name":"apply","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Applies the configuration."},"parameters":[{"id":702,"name":"container","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Container"}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"src/aurelia-validation.ts","line":49,"character":14}]},{"id":693,"name":"customValidator","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":694,"name":"customValidator","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Use a custom Validator implementation."},"parameters":[{"id":695,"name":"type","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":696,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":697,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"signatures":[{"id":698,"name":"new __type","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":699,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"reference","name":"__type","id":696}}],"sources":[{"fileName":"src/aurelia-validation.ts","line":42,"character":32}]}],"groups":[{"title":"Constructors","kind":512,"children":[697]}],"sources":[{"fileName":"src/aurelia-validation.ts","line":42,"character":30}]}}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"src/aurelia-validation.ts","line":42,"character":24}]}],"groups":[{"title":"Properties","kind":1024,"children":[688]},{"title":"Methods","kind":2048,"children":[700,693]}],"sources":[{"fileName":"src/aurelia-validation.ts","line":36,"character":43}]},{"id":703,"name":"configure","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":704,"name":"configure","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Configures the plugin."},"parameters":[{"id":705,"name":"frameworkConfig","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":706,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":707,"name":"container","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"src/aurelia-validation.ts","line":59,"character":30}],"type":{"type":"reference","name":"Container"}},{"id":708,"name":"globalResources","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/aurelia-validation.ts","line":59,"character":58}],"type":{"type":"union","types":[{"type":"instrinct","name":"undefined"},{"type":"reflection","declaration":{"id":709,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":710,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":711,"name":"resources","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"instrinct","isArray":true,"name":"string"}}],"type":{"type":"instrinct","name":"any"}}]}}]}}],"groups":[{"title":"Variables","kind":32,"children":[707,708]}],"sources":[{"fileName":"src/aurelia-validation.ts","line":59,"character":18}]}}},{"id":712,"name":"callback","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"instrinct","name":"undefined"},{"type":"reflection","declaration":{"id":713,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":714,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":715,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"AureliaValidationConfiguration","id":687}}],"type":{"type":"instrinct","name":"void"}}]}}]}}],"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"src/aurelia-validation.ts","line":58,"character":25}]}],"groups":[{"title":"Classes","kind":128,"children":[687]},{"title":"Functions","kind":64,"children":[703]}]} diff --git a/package.json b/package.json index 5728ce07..16cb82a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-validation", - "version": "1.0.0-beta.1.0.1", + "version": "1.0.0", "description": "Validation for Aurelia applications", "keywords": [ "aurelia",