aurelia-validation
Advanced tools
Comparing version 0.9.0 to 0.9.1
{ | ||
"name": "aurelia-validation", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "This is a validation interface for hooking in to Aurelia's binding and templating engines.", | ||
@@ -22,3 +22,3 @@ "keywords": [ | ||
"dependencies": { | ||
"aurelia-binding": "^1.0.0-beta.2.0.4", | ||
"aurelia-binding": "^1.0.0-beta.2.0.6", | ||
"aurelia-dependency-injection": "^1.0.0-beta.2.1.0", | ||
@@ -25,0 +25,0 @@ "aurelia-metadata": "^1.0.0-beta.2.0.0", |
@@ -16,3 +16,3 @@ System.config({ | ||
map: { | ||
"aurelia-binding": "npm:aurelia-binding@1.0.0-beta.2.0.4", | ||
"aurelia-binding": "npm:aurelia-binding@1.0.0-beta.2.0.6", | ||
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-beta.2.1.0", | ||
@@ -52,3 +52,3 @@ "aurelia-metadata": "npm:aurelia-metadata@1.0.0-beta.2.0.0", | ||
}, | ||
"npm:aurelia-binding@1.0.0-beta.2.0.4": { | ||
"npm:aurelia-binding@1.0.0-beta.2.0.6": { | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0-beta.2.0.0", | ||
@@ -80,3 +80,3 @@ "aurelia-metadata": "npm:aurelia-metadata@1.0.0-beta.2.0.0", | ||
"npm:aurelia-templating@1.0.0-beta.3.0.2": { | ||
"aurelia-binding": "npm:aurelia-binding@1.0.0-beta.2.0.4", | ||
"aurelia-binding": "npm:aurelia-binding@1.0.0-beta.2.0.6", | ||
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-beta.2.1.0", | ||
@@ -83,0 +83,0 @@ "aurelia-loader": "npm:aurelia-loader@1.0.0-beta.2.0.0", |
@@ -40,3 +40,3 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', './validation-controller', './validate-trigger'], function (exports, _aureliaDependencyInjection, _aureliaTaskQueue, _validationController, _validateTrigger) { | ||
var controller = source.container.get(_aureliaDependencyInjection.Optional.of(_validationController.ValidationController)); | ||
var controller = source.container.get(_aureliaDependencyInjection.Optional.of(_validationController.ValidationController, true)); | ||
if (controller === null) { | ||
@@ -43,0 +43,0 @@ throw new Error('A ValidationController has not been registered.'); |
@@ -25,3 +25,3 @@ define(['exports', 'aurelia-dependency-injection', './validator', './validate-trigger', './property-info'], function (exports, _aureliaDependencyInjection, _validator, _validateTrigger, _propertyInfo) { | ||
ValidationController.prototype.addRenderer = function addRenderer(renderer) { | ||
for (var _iterator = this.bindings, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
for (var _iterator = this.bindings.values(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
@@ -39,7 +39,4 @@ | ||
var _ref2 = _ref; | ||
var binding = _ref2[0]; | ||
var _ref2$ = _ref2[1]; | ||
var target = _ref2$.target; | ||
var rules = _ref2$.rules; | ||
var errors = _ref2$.errors; | ||
var target = _ref2.target; | ||
var errors = _ref2.errors; | ||
@@ -54,3 +51,3 @@ for (var i = 0, ii = errors.length; i < ii; i++) { | ||
ValidationController.prototype.removeRenderer = function removeRenderer(renderer) { | ||
for (var _iterator2 = this.bindings, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
for (var _iterator2 = this.bindings.values(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref3; | ||
@@ -68,7 +65,4 @@ | ||
var _ref4 = _ref3; | ||
var binding = _ref4[0]; | ||
var _ref4$ = _ref4[1]; | ||
var target = _ref4$.target; | ||
var rules = _ref4$.rules; | ||
var errors = _ref4$.errors; | ||
var target = _ref4.target; | ||
var errors = _ref4.errors; | ||
@@ -89,2 +83,7 @@ for (var i = 0, ii = errors.length; i < ii; i++) { | ||
ValidationController.prototype.unregisterBinding = function unregisterBinding(binding) { | ||
this._resetBinding(binding); | ||
this.bindings.delete(binding); | ||
}; | ||
ValidationController.prototype.validate = function validate() { | ||
@@ -200,3 +199,2 @@ var errors = []; | ||
var target = _bindings$get2.target; | ||
var rules = _bindings$get2.rules; | ||
var errors = _bindings$get2.errors; | ||
@@ -203,0 +201,0 @@ |
@@ -43,6 +43,2 @@ define(['exports', 'aurelia-binding', 'aurelia-dependency-injection', 'aurelia-templating', './validation-controller', './validation-renderer'], function (exports, _aureliaBinding, _aureliaDependencyInjection, _aureliaTemplating, _validationController, _validationRenderer) { | ||
ValidationErrorsCustomAttribute.prototype.unrender = function unrender(error, target) { | ||
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) { | ||
return; | ||
} | ||
var index = this.errors.findIndex(function (x) { | ||
@@ -49,0 +45,0 @@ return x.error === error; |
@@ -87,2 +87,3 @@ import { | ||
* @param binding The binding instance. | ||
* @param target The DOM element. | ||
* @param rules (optional) rules associated with the binding. Validator implementation specific. | ||
@@ -93,2 +94,8 @@ */ | ||
/** | ||
* Unregisters a binding with the controller. | ||
* @param binding The binding instance. | ||
*/ | ||
unregisterBinding(binding?: any): any; | ||
/** | ||
* Validates all bindings and renders any validation errors. | ||
@@ -95,0 +102,0 @@ */ |
@@ -141,3 +141,3 @@ import {AccessMember,AccessScope,AccessKeyed,BindingBehavior,ValueConverter,bindingMode} from 'aurelia-binding'; | ||
addRenderer(renderer: ValidationRenderer) { | ||
for (let [binding, { target, rules, errors }] of this.bindings) { | ||
for (let { target, errors } of this.bindings.values()) { | ||
for (let i = 0, ii = errors.length; i < ii; i++) { | ||
@@ -155,3 +155,3 @@ renderer.render(errors[i], target); | ||
removeRenderer(renderer: ValidationRenderer) { | ||
for (let [binding, { target, rules, errors }] of this.bindings) { | ||
for (let { target, errors } of this.bindings.values()) { | ||
for (let i = 0, ii = errors.length; i < ii; i++) { | ||
@@ -167,2 +167,3 @@ renderer.unrender(errors[i], target); | ||
* @param binding The binding instance. | ||
* @param target The DOM element. | ||
* @param rules (optional) rules associated with the binding. Validator implementation specific. | ||
@@ -176,2 +177,11 @@ */ | ||
/** | ||
* Unregisters a binding with the controller. | ||
* @param binding The binding instance. | ||
*/ | ||
unregisterBinding(binding) { | ||
this._resetBinding(binding); | ||
this.bindings.delete(binding); | ||
} | ||
/** | ||
* Validates all bindings and renders any validation errors. | ||
@@ -254,3 +264,3 @@ */ | ||
_resetBinding(binding) { | ||
const { target, rules, errors } = this.bindings.get(binding); | ||
const { target, errors } = this.bindings.get(binding); | ||
this._updateErrors(errors, [], target); | ||
@@ -286,3 +296,3 @@ } | ||
// locate the controller. | ||
const controller = source.container.get(Optional.of(ValidationController)); | ||
const controller = source.container.get(Optional.of(ValidationController, true)); | ||
if (controller === null) { | ||
@@ -368,6 +378,2 @@ throw new Error('A ValidationController has not been registered.'); | ||
unrender(error, target) { | ||
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) { | ||
return; | ||
} | ||
const index = this.errors.findIndex(x => x.error === error); | ||
@@ -374,0 +380,0 @@ if (index === -1) { |
@@ -47,3 +47,3 @@ 'use strict'; | ||
var controller = source.container.get(_aureliaDependencyInjection.Optional.of(_validationController.ValidationController)); | ||
var controller = source.container.get(_aureliaDependencyInjection.Optional.of(_validationController.ValidationController, true)); | ||
if (controller === null) { | ||
@@ -50,0 +50,0 @@ throw new Error('A ValidationController has not been registered.'); |
@@ -32,3 +32,3 @@ 'use strict'; | ||
ValidationController.prototype.addRenderer = function addRenderer(renderer) { | ||
for (var _iterator = this.bindings, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
for (var _iterator = this.bindings.values(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
@@ -46,7 +46,4 @@ | ||
var _ref2 = _ref; | ||
var binding = _ref2[0]; | ||
var _ref2$ = _ref2[1]; | ||
var target = _ref2$.target; | ||
var rules = _ref2$.rules; | ||
var errors = _ref2$.errors; | ||
var target = _ref2.target; | ||
var errors = _ref2.errors; | ||
@@ -61,3 +58,3 @@ for (var i = 0, ii = errors.length; i < ii; i++) { | ||
ValidationController.prototype.removeRenderer = function removeRenderer(renderer) { | ||
for (var _iterator2 = this.bindings, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
for (var _iterator2 = this.bindings.values(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref3; | ||
@@ -75,7 +72,4 @@ | ||
var _ref4 = _ref3; | ||
var binding = _ref4[0]; | ||
var _ref4$ = _ref4[1]; | ||
var target = _ref4$.target; | ||
var rules = _ref4$.rules; | ||
var errors = _ref4$.errors; | ||
var target = _ref4.target; | ||
var errors = _ref4.errors; | ||
@@ -96,2 +90,7 @@ for (var i = 0, ii = errors.length; i < ii; i++) { | ||
ValidationController.prototype.unregisterBinding = function unregisterBinding(binding) { | ||
this._resetBinding(binding); | ||
this.bindings.delete(binding); | ||
}; | ||
ValidationController.prototype.validate = function validate() { | ||
@@ -207,3 +206,2 @@ var errors = []; | ||
var target = _bindings$get2.target; | ||
var rules = _bindings$get2.rules; | ||
var errors = _bindings$get2.errors; | ||
@@ -210,0 +208,0 @@ |
@@ -52,6 +52,2 @@ 'use strict'; | ||
ValidationErrorsCustomAttribute.prototype.unrender = function unrender(error, target) { | ||
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) { | ||
return; | ||
} | ||
var index = this.errors.findIndex(function (x) { | ||
@@ -58,0 +54,0 @@ return x.error === error; |
@@ -31,3 +31,3 @@ var _dec, _class; | ||
const controller = source.container.get(Optional.of(ValidationController)); | ||
const controller = source.container.get(Optional.of(ValidationController, true)); | ||
if (controller === null) { | ||
@@ -34,0 +34,0 @@ throw new Error('A ValidationController has not been registered.'); |
@@ -19,3 +19,3 @@ var _dec, _class; | ||
addRenderer(renderer) { | ||
for (let [binding, { target, rules, errors }] of this.bindings) { | ||
for (let { target, errors } of this.bindings.values()) { | ||
for (let i = 0, ii = errors.length; i < ii; i++) { | ||
@@ -29,3 +29,3 @@ renderer.render(errors[i], target); | ||
removeRenderer(renderer) { | ||
for (let [binding, { target, rules, errors }] of this.bindings) { | ||
for (let { target, errors } of this.bindings.values()) { | ||
for (let i = 0, ii = errors.length; i < ii; i++) { | ||
@@ -43,2 +43,7 @@ renderer.unrender(errors[i], target); | ||
unregisterBinding(binding) { | ||
this._resetBinding(binding); | ||
this.bindings.delete(binding); | ||
} | ||
validate() { | ||
@@ -105,5 +110,5 @@ const errors = []; | ||
_resetBinding(binding) { | ||
const { target, rules, errors } = this.bindings.get(binding); | ||
const { target, errors } = this.bindings.get(binding); | ||
this._updateErrors(errors, [], target); | ||
} | ||
}) || _class); |
@@ -38,6 +38,2 @@ var _dec, _dec2, _class; | ||
unrender(error, target) { | ||
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) { | ||
return; | ||
} | ||
const index = this.errors.findIndex(x => x.error === error); | ||
@@ -44,0 +40,0 @@ if (index === -1) { |
@@ -37,3 +37,3 @@ var _dec, _class; | ||
var controller = source.container.get(Optional.of(ValidationController)); | ||
var controller = source.container.get(Optional.of(ValidationController, true)); | ||
if (controller === null) { | ||
@@ -40,0 +40,0 @@ throw new Error('A ValidationController has not been registered.'); |
@@ -22,3 +22,3 @@ var _dec, _class; | ||
ValidationController.prototype.addRenderer = function addRenderer(renderer) { | ||
for (var _iterator = this.bindings, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
for (var _iterator = this.bindings.values(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
@@ -36,7 +36,4 @@ | ||
var _ref2 = _ref; | ||
var binding = _ref2[0]; | ||
var _ref2$ = _ref2[1]; | ||
var target = _ref2$.target; | ||
var rules = _ref2$.rules; | ||
var errors = _ref2$.errors; | ||
var target = _ref2.target; | ||
var errors = _ref2.errors; | ||
@@ -51,3 +48,3 @@ for (var i = 0, ii = errors.length; i < ii; i++) { | ||
ValidationController.prototype.removeRenderer = function removeRenderer(renderer) { | ||
for (var _iterator2 = this.bindings, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
for (var _iterator2 = this.bindings.values(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref3; | ||
@@ -65,7 +62,4 @@ | ||
var _ref4 = _ref3; | ||
var binding = _ref4[0]; | ||
var _ref4$ = _ref4[1]; | ||
var target = _ref4$.target; | ||
var rules = _ref4$.rules; | ||
var errors = _ref4$.errors; | ||
var target = _ref4.target; | ||
var errors = _ref4.errors; | ||
@@ -86,2 +80,7 @@ for (var i = 0, ii = errors.length; i < ii; i++) { | ||
ValidationController.prototype.unregisterBinding = function unregisterBinding(binding) { | ||
this._resetBinding(binding); | ||
this.bindings.delete(binding); | ||
}; | ||
ValidationController.prototype.validate = function validate() { | ||
@@ -197,3 +196,2 @@ var errors = []; | ||
var target = _bindings$get2.target; | ||
var rules = _bindings$get2.rules; | ||
var errors = _bindings$get2.errors; | ||
@@ -200,0 +198,0 @@ |
@@ -41,6 +41,2 @@ var _dec, _dec2, _class; | ||
ValidationErrorsCustomAttribute.prototype.unrender = function unrender(error, target) { | ||
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) { | ||
return; | ||
} | ||
var index = this.errors.findIndex(function (x) { | ||
@@ -47,0 +43,0 @@ return x.error === error; |
@@ -49,3 +49,3 @@ 'use strict'; | ||
var controller = source.container.get(Optional.of(ValidationController)); | ||
var controller = source.container.get(Optional.of(ValidationController, true)); | ||
if (controller === null) { | ||
@@ -52,0 +52,0 @@ throw new Error('A ValidationController has not been registered.'); |
@@ -33,3 +33,3 @@ 'use strict'; | ||
ValidationController.prototype.addRenderer = function addRenderer(renderer) { | ||
for (var _iterator = this.bindings, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
for (var _iterator = this.bindings.values(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
@@ -47,7 +47,4 @@ | ||
var _ref2 = _ref; | ||
var binding = _ref2[0]; | ||
var _ref2$ = _ref2[1]; | ||
var target = _ref2$.target; | ||
var rules = _ref2$.rules; | ||
var errors = _ref2$.errors; | ||
var target = _ref2.target; | ||
var errors = _ref2.errors; | ||
@@ -62,3 +59,3 @@ for (var i = 0, ii = errors.length; i < ii; i++) { | ||
ValidationController.prototype.removeRenderer = function removeRenderer(renderer) { | ||
for (var _iterator2 = this.bindings, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
for (var _iterator2 = this.bindings.values(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref3; | ||
@@ -76,7 +73,4 @@ | ||
var _ref4 = _ref3; | ||
var binding = _ref4[0]; | ||
var _ref4$ = _ref4[1]; | ||
var target = _ref4$.target; | ||
var rules = _ref4$.rules; | ||
var errors = _ref4$.errors; | ||
var target = _ref4.target; | ||
var errors = _ref4.errors; | ||
@@ -97,2 +91,7 @@ for (var i = 0, ii = errors.length; i < ii; i++) { | ||
ValidationController.prototype.unregisterBinding = function unregisterBinding(binding) { | ||
this._resetBinding(binding); | ||
this.bindings.delete(binding); | ||
}; | ||
ValidationController.prototype.validate = function validate() { | ||
@@ -208,3 +207,2 @@ var errors = []; | ||
var target = _bindings$get2.target; | ||
var rules = _bindings$get2.rules; | ||
var errors = _bindings$get2.errors; | ||
@@ -211,0 +209,0 @@ |
@@ -54,6 +54,2 @@ 'use strict'; | ||
ValidationErrorsCustomAttribute.prototype.unrender = function unrender(error, target) { | ||
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) { | ||
return; | ||
} | ||
var index = this.errors.findIndex(function (x) { | ||
@@ -60,0 +56,0 @@ return x.error === error; |
@@ -126,3 +126,3 @@ 'use strict'; | ||
ValidationController.prototype.addRenderer = function addRenderer(renderer) { | ||
for (var _iterator = this.bindings, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
for (var _iterator = this.bindings.values(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
@@ -140,7 +140,4 @@ | ||
var _ref2 = _ref; | ||
var binding = _ref2[0]; | ||
var _ref2$ = _ref2[1]; | ||
var _target = _ref2$.target; | ||
var rules = _ref2$.rules; | ||
var errors = _ref2$.errors; | ||
var _target = _ref2.target; | ||
var errors = _ref2.errors; | ||
@@ -155,3 +152,3 @@ for (var i = 0, ii = errors.length; i < ii; i++) { | ||
ValidationController.prototype.removeRenderer = function removeRenderer(renderer) { | ||
for (var _iterator2 = this.bindings, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
for (var _iterator2 = this.bindings.values(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref3; | ||
@@ -169,7 +166,4 @@ | ||
var _ref4 = _ref3; | ||
var binding = _ref4[0]; | ||
var _ref4$ = _ref4[1]; | ||
var _target2 = _ref4$.target; | ||
var rules = _ref4$.rules; | ||
var errors = _ref4$.errors; | ||
var _target2 = _ref4.target; | ||
var errors = _ref4.errors; | ||
@@ -190,2 +184,7 @@ for (var i = 0, ii = errors.length; i < ii; i++) { | ||
ValidationController.prototype.unregisterBinding = function unregisterBinding(binding) { | ||
this._resetBinding(binding); | ||
this.bindings.delete(binding); | ||
}; | ||
ValidationController.prototype.validate = function validate() { | ||
@@ -301,3 +300,2 @@ var errors = []; | ||
var target = _bindings$get2.target; | ||
var rules = _bindings$get2.rules; | ||
var errors = _bindings$get2.errors; | ||
@@ -337,3 +335,3 @@ | ||
var controller = source.container.get(_aureliaDependencyInjection.Optional.of(ValidationController)); | ||
var controller = source.container.get(_aureliaDependencyInjection.Optional.of(ValidationController, true)); | ||
if (controller === null) { | ||
@@ -420,6 +418,2 @@ throw new Error('A ValidationController has not been registered.'); | ||
ValidationErrorsCustomAttribute.prototype.unrender = function unrender(error, target) { | ||
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) { | ||
return; | ||
} | ||
var index = this.errors.findIndex(function (x) { | ||
@@ -426,0 +420,0 @@ return x.error === error; |
{ | ||
"name": "aurelia-validation", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "This is a validation interface for hooking in to Aurelia's binding and templating engines.", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"aurelia-binding": "^1.0.0-beta.2.0.4", | ||
"aurelia-binding": "^1.0.0-beta.2.0.6", | ||
"aurelia-dependency-injection": "^1.0.0-beta.2.1.0", | ||
@@ -39,3 +39,3 @@ "aurelia-metadata": "^1.0.0-beta.2.0.0", | ||
"dependencies": { | ||
"aurelia-binding": "^1.0.0-beta.2.0.4", | ||
"aurelia-binding": "^1.0.0-beta.2.0.6", | ||
"aurelia-dependency-injection": "^1.0.0-beta.2.1.0", | ||
@@ -55,3 +55,3 @@ "aurelia-metadata": "^1.0.0-beta.2.0.0", | ||
"dependencies": { | ||
"aurelia-binding": "^1.0.0-beta.2.0.4", | ||
"aurelia-binding": "^1.0.0-beta.2.0.6", | ||
"aurelia-dependency-injection": "^1.0.0-beta.2.1.0", | ||
@@ -104,4 +104,4 @@ "aurelia-metadata": "^1.0.0-beta.2.0.0", | ||
"through2": "^2.0.1", | ||
"typedoc": "^0.4.2", | ||
"typescript": "^1.9.0-dev.20160614-1.0", | ||
"typedoc": "^0.4.3", | ||
"typescript": "^1.9.0-dev.20160615-1.0", | ||
"vinyl": "^1.1.1", | ||
@@ -108,0 +108,0 @@ "vinyl-paths": "^2.1.0", |
# aurelia-validation | ||
[![npm Version](https://img.shields.io/npm/v/aurelia-validate.svg)](https://www.npmjs.com/package/aurelia-validate) | ||
[![npm Version](https://img.shields.io/npm/v/aurelia-validation.svg)](https://www.npmjs.com/package/aurelia-validation) | ||
[![ZenHub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.io) | ||
[![Join the chat at https://gitter.im/aurelia/discuss](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aurelia/discuss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![CircleCI](https://circleci.com/gh/aurelia/aurelia-validation.svg?style=shield)](https://circleci.com/gh/aurelia/aurelia-validation) | ||
[![CircleCI](https://circleci.com/gh/aurelia/validation.svg?style=shield)](https://circleci.com/gh/aurelia/validation) | ||
@@ -8,0 +8,0 @@ This is a plugin that will allow using indicative in your Aurelia application for expressive validation. Karma/Jasmine testing is also configured. |
@@ -32,3 +32,3 @@ import {inject, Optional} from 'aurelia-dependency-injection'; | ||
// locate the controller. | ||
const controller = source.container.get(Optional.of(ValidationController)); | ||
const controller = source.container.get(Optional.of(ValidationController, true)); | ||
if (controller === null) { | ||
@@ -35,0 +35,0 @@ throw new Error('A ValidationController has not been registered.'); |
@@ -21,3 +21,3 @@ import {inject} from 'aurelia-dependency-injection'; | ||
addRenderer(renderer: ValidationRenderer) { | ||
for (let [binding, { target, rules, errors }] of this.bindings) { | ||
for (let { target, errors } of this.bindings.values()) { | ||
for (let i = 0, ii = errors.length; i < ii; i++) { | ||
@@ -35,3 +35,3 @@ renderer.render(errors[i], target); | ||
removeRenderer(renderer: ValidationRenderer) { | ||
for (let [binding, { target, rules, errors }] of this.bindings) { | ||
for (let { target, errors } of this.bindings.values()) { | ||
for (let i = 0, ii = errors.length; i < ii; i++) { | ||
@@ -47,2 +47,3 @@ renderer.unrender(errors[i], target); | ||
* @param binding The binding instance. | ||
* @param target The DOM element. | ||
* @param rules (optional) rules associated with the binding. Validator implementation specific. | ||
@@ -56,2 +57,11 @@ */ | ||
/** | ||
* Unregisters a binding with the controller. | ||
* @param binding The binding instance. | ||
*/ | ||
unregisterBinding(binding) { | ||
this._resetBinding(binding); | ||
this.bindings.delete(binding); | ||
} | ||
/** | ||
* Validates all bindings and renders any validation errors. | ||
@@ -134,5 +144,5 @@ */ | ||
_resetBinding(binding) { | ||
const { target, rules, errors } = this.bindings.get(binding); | ||
const { target, errors } = this.bindings.get(binding); | ||
this._updateErrors(errors, [], target); | ||
} | ||
} |
@@ -38,6 +38,2 @@ import {bindingMode} from 'aurelia-binding'; | ||
unrender(error, target) { | ||
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) { | ||
return; | ||
} | ||
const index = this.errors.findIndex(x => x.error === error); | ||
@@ -44,0 +40,0 @@ if (index === -1) { |
Sorry, the diff of this file is too big to display
186653
4019