Skip to content

Commit

Permalink
chore(all): prepare release 0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jun 16, 2016
1 parent fbfed5b commit a191f25
Show file tree
Hide file tree
Showing 21 changed files with 93 additions and 4,336 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"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.",
"keywords": [
"aurelia",
Expand Down
2 changes: 1 addition & 1 deletion dist/amd/validate-binding-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', './vali

var target = this.getTarget(binding, source);

var controller = source.container.get(_aureliaDependencyInjection.Optional.of(_validationController.ValidationController));
var controller = source.container.get(_aureliaDependencyInjection.Optional.of(_validationController.ValidationController, true));
if (controller === null) {
throw new Error('A ValidationController has not been registered.');
}
Expand Down
24 changes: 11 additions & 13 deletions dist/amd/validation-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ define(['exports', 'aurelia-dependency-injection', './validator', './validate-tr
}

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;

if (_isArray) {
Expand All @@ -35,11 +35,8 @@ define(['exports', 'aurelia-dependency-injection', './validator', './validate-tr
}

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;

for (var i = 0, ii = errors.length; i < ii; i++) {
renderer.render(errors[i], target);
Expand All @@ -49,7 +46,7 @@ define(['exports', 'aurelia-dependency-injection', './validator', './validate-tr
};

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;

if (_isArray2) {
Expand All @@ -62,11 +59,8 @@ define(['exports', 'aurelia-dependency-injection', './validator', './validate-tr
}

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;

for (var i = 0, ii = errors.length; i < ii; i++) {
renderer.unrender(errors[i], target);
Expand All @@ -82,6 +76,11 @@ define(['exports', 'aurelia-dependency-injection', './validator', './validate-tr
this.bindings.set(binding, { target: target, rules: rules, errors: errors });
};

ValidationController.prototype.unregisterBinding = function unregisterBinding(binding) {
this._resetBinding(binding);
this.bindings.delete(binding);
};

ValidationController.prototype.validate = function validate() {
var errors = [];
for (var _iterator3 = this.bindings.keys(), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
Expand Down Expand Up @@ -192,7 +191,6 @@ define(['exports', 'aurelia-dependency-injection', './validator', './validate-tr
var _bindings$get2 = this.bindings.get(binding);

var target = _bindings$get2.target;
var rules = _bindings$get2.rules;
var errors = _bindings$get2.errors;

this._updateErrors(errors, [], target);
Expand Down
4 changes: 0 additions & 4 deletions dist/amd/validation-errors-custom-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ define(['exports', 'aurelia-binding', 'aurelia-dependency-injection', 'aurelia-t
};

ValidationErrorsCustomAttribute.prototype.unrender = function unrender(error, target) {
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) {
return;
}

var index = this.errors.findIndex(function (x) {
return x.error === error;
});
Expand Down
7 changes: 7 additions & 0 deletions dist/aurelia-validation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,17 @@ export declare class ValidationController {
/**
* Registers a binding with the controller.
* @param binding The binding instance.
* @param target The DOM element.
* @param rules (optional) rules associated with the binding. Validator implementation specific.
*/
registerBinding(binding?: any, target?: any, rules?: any): any;

/**
* Unregisters a binding with the controller.
* @param binding The binding instance.
*/
unregisterBinding(binding?: any): any;

/**
* Validates all bindings and renders any validation errors.
*/
Expand Down
22 changes: 14 additions & 8 deletions dist/aurelia-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class ValidationController {
* @param renderer The renderer.
*/
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++) {
renderer.render(errors[i], target);
}
Expand All @@ -151,7 +151,7 @@ export class ValidationController {
* @param renderer The renderer.
*/
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++) {
renderer.unrender(errors[i], target);
}
Expand All @@ -162,13 +162,23 @@ export class ValidationController {
/**
* Registers a binding with the controller.
* @param binding The binding instance.
* @param target The DOM element.
* @param rules (optional) rules associated with the binding. Validator implementation specific.
*/
registerBinding(binding, target, rules = null) {
const errors = [];
this.bindings.set(binding, { target, rules, errors });
}

/**
* 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.
*/
Expand Down Expand Up @@ -247,7 +257,7 @@ export class ValidationController {
* Resets and unrenders errors for a particular binding.
*/
_resetBinding(binding) {
const { target, rules, errors } = this.bindings.get(binding);
const { target, errors } = this.bindings.get(binding);
this._updateErrors(errors, [], target);
}
}
Expand Down Expand Up @@ -278,7 +288,7 @@ export class ValidateBindingBehavior {
const target = this.getTarget(binding, source);

// locate the controller.
const controller = source.container.get(Optional.of(ValidationController));
const controller = source.container.get(Optional.of(ValidationController, true));
if (controller === null) {
throw new Error('A ValidationController has not been registered.');
}
Expand Down Expand Up @@ -359,10 +369,6 @@ export class ValidationErrorsCustomAttribute {
}

unrender(error, target) {
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) {
return;
}

const index = this.errors.findIndex(x => x.error === error);
if (index === -1) {
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/commonjs/validate-binding-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var ValidateBindingBehavior = exports.ValidateBindingBehavior = (_dec = (0, _aur

var target = this.getTarget(binding, source);

var controller = source.container.get(_aureliaDependencyInjection.Optional.of(_validationController.ValidationController));
var controller = source.container.get(_aureliaDependencyInjection.Optional.of(_validationController.ValidationController, true));
if (controller === null) {
throw new Error('A ValidationController has not been registered.');
}
Expand Down
24 changes: 11 additions & 13 deletions dist/commonjs/validation-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var ValidationController = exports.ValidationController = (_dec = (0, _aureliaDe
}

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;

if (_isArray) {
Expand All @@ -42,11 +42,8 @@ var ValidationController = exports.ValidationController = (_dec = (0, _aureliaDe
}

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;

for (var i = 0, ii = errors.length; i < ii; i++) {
renderer.render(errors[i], target);
Expand All @@ -56,7 +53,7 @@ var ValidationController = exports.ValidationController = (_dec = (0, _aureliaDe
};

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;

if (_isArray2) {
Expand All @@ -69,11 +66,8 @@ var ValidationController = exports.ValidationController = (_dec = (0, _aureliaDe
}

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;

for (var i = 0, ii = errors.length; i < ii; i++) {
renderer.unrender(errors[i], target);
Expand All @@ -89,6 +83,11 @@ var ValidationController = exports.ValidationController = (_dec = (0, _aureliaDe
this.bindings.set(binding, { target: target, rules: rules, errors: errors });
};

ValidationController.prototype.unregisterBinding = function unregisterBinding(binding) {
this._resetBinding(binding);
this.bindings.delete(binding);
};

ValidationController.prototype.validate = function validate() {
var errors = [];
for (var _iterator3 = this.bindings.keys(), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
Expand Down Expand Up @@ -199,7 +198,6 @@ var ValidationController = exports.ValidationController = (_dec = (0, _aureliaDe
var _bindings$get2 = this.bindings.get(binding);

var target = _bindings$get2.target;
var rules = _bindings$get2.rules;
var errors = _bindings$get2.errors;

this._updateErrors(errors, [], target);
Expand Down
4 changes: 0 additions & 4 deletions dist/commonjs/validation-errors-custom-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ var ValidationErrorsCustomAttribute = exports.ValidationErrorsCustomAttribute =
};

ValidationErrorsCustomAttribute.prototype.unrender = function unrender(error, target) {
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) {
return;
}

var index = this.errors.findIndex(function (x) {
return x.error === error;
});
Expand Down
2 changes: 1 addition & 1 deletion dist/es2015/validate-binding-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export let ValidateBindingBehavior = (_dec = inject(TaskQueue), _dec(_class = cl
bind(binding, source, rules) {
const target = this.getTarget(binding, source);

const controller = source.container.get(Optional.of(ValidationController));
const controller = source.container.get(Optional.of(ValidationController, true));
if (controller === null) {
throw new Error('A ValidationController has not been registered.');
}
Expand Down
11 changes: 8 additions & 3 deletions dist/es2015/validation-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export let ValidationController = (_dec = inject(Validator), _dec(_class = 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++) {
renderer.render(errors[i], target);
}
Expand All @@ -25,7 +25,7 @@ export let ValidationController = (_dec = inject(Validator), _dec(_class = class
}

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++) {
renderer.unrender(errors[i], target);
}
Expand All @@ -38,6 +38,11 @@ export let ValidationController = (_dec = inject(Validator), _dec(_class = class
this.bindings.set(binding, { target, rules, errors });
}

unregisterBinding(binding) {
this._resetBinding(binding);
this.bindings.delete(binding);
}

validate() {
const errors = [];
for (let binding of this.bindings.keys()) {
Expand Down Expand Up @@ -99,7 +104,7 @@ export let ValidationController = (_dec = inject(Validator), _dec(_class = class
}

_resetBinding(binding) {
const { target, rules, errors } = this.bindings.get(binding);
const { target, errors } = this.bindings.get(binding);
this._updateErrors(errors, [], target);
}
}) || _class);
4 changes: 0 additions & 4 deletions dist/es2015/validation-errors-custom-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ export let ValidationErrorsCustomAttribute = (_dec = customAttribute('validation
}

unrender(error, target) {
if (!target || !(this.boundaryElement === target || this.boundaryElement.contains(target))) {
return;
}

const index = this.errors.findIndex(x => x.error === error);
if (index === -1) {
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/native-modules/validate-binding-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export var ValidateBindingBehavior = (_dec = inject(TaskQueue), _dec(_class = fu

var target = this.getTarget(binding, source);

var controller = source.container.get(Optional.of(ValidationController));
var controller = source.container.get(Optional.of(ValidationController, true));
if (controller === null) {
throw new Error('A ValidationController has not been registered.');
}
Expand Down
Loading

0 comments on commit a191f25

Please sign in to comment.