Skip to content

Commit

Permalink
chore(validation) prepare release 0.1.1
Browse files Browse the repository at this point in the history
Preparing first release
  • Loading branch information
janvanderhaegen committed Mar 25, 2015
1 parent 10a269a commit 8a6d4f6
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 317 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.1.0",
"version": "0.1.1",
"description": "A validation plugin for Aurelia.",
"keywords": [
"aurelia",
Expand Down
4 changes: 2 additions & 2 deletions dist/amd/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ define(["exports", "./validation/validationLocaleRepository", "./validation/vali

_defaults(exports, _interopRequireWildcard(_validationValidateAttachedBehavior));

_defaults(exports, _interopRequireWildcard(_validationValidateAttachedBehaviorConfig));
_defaults(exports, _interopRequireWildcard(_validationValidateAttachedBehaviorConfig));

var ValidateAttachedBehavior = _validationValidateAttachedBehavior.ValidateAttachedBehavior;

function install(aurelia) {
aurelia.withResources(ValidateAttachedBehavior);
}
});
});
38 changes: 9 additions & 29 deletions dist/amd/validation/pathObserver.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
define(["exports", "aurelia-binding"], function (exports, _aureliaBinding) {
"use strict";

var _createClass = (function () {
function defineProperties(target, props) {
for (var key in props) {
var prop = props[key];
prop.configurable = true;
if (prop.value) prop.writable = true;
}
Object.defineProperties(target, props);
}
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
})();

var _classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

Object.defineProperty(exports, "__esModule", {
value: true
Expand Down Expand Up @@ -112,8 +93,7 @@ define(["exports", "aurelia-binding"], function (exports, _aureliaBinding) {
value: function getObserver() {
if (this.path.length == 1) {
return this.observerLocator.getObserver(this.subject, this.path[0]);
}
return this;
}return this;
}
},
getValue: {
Expand All @@ -131,11 +111,11 @@ define(["exports", "aurelia-binding"], function (exports, _aureliaBinding) {
}
}
if (currentObserver.obj !== expectedSubject)
//Happens if you set a value somewhere along the binding path and immediately call getValue (on the very last observer)
{
this.observeParts(this.path[i - 1]);
break;
}
//Happens if you set a value somewhere along the binding path and immediately call getValue (on the very last observer)
{
this.observeParts(this.path[i - 1]);
break;
}
expectedSubject = currentObserver.getValue();
}

Expand All @@ -159,4 +139,4 @@ define(["exports", "aurelia-binding"], function (exports, _aureliaBinding) {

return PathObserver;
})();
});
});
100 changes: 44 additions & 56 deletions dist/amd/validation/validateAttachedBehavior.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
define(["exports", "aurelia-templating", "aurelia-binding", "../validation/validateAttachedBehaviorConfig"], function (exports, _aureliaTemplating, _aureliaBinding, _validationValidateAttachedBehaviorConfig) {
"use strict";

var _createClass = (function () {
function defineProperties(target, props) {
for (var key in props) {
var prop = props[key];
prop.configurable = true;
if (prop.value) prop.writable = true;
}
Object.defineProperties(target, props);
}

return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
})();
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

var _classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

Object.defineProperty(exports, "__esModule", {
value: true
Expand All @@ -44,13 +25,10 @@ define(["exports", "aurelia-templating", "aurelia-binding", "../validation/valid
_createClass(ValidateAttachedBehavior, {
valueChanged: {
value: function valueChanged(newValue) {
}
},
attached: {
value: function attached() {
if (this.value === null || this.value === undefined) throw "Cannot bind ValidateAttachedBehavior to null/undefined";
if (typeof this.value === "string") {
return; //this is just to tell the real validation instance (higher in the DOM) the exact property to bind to
if (this.value === null || this.value === undefined) {
return;
}if (typeof this.value === "string") {
return; //this is just to tell the real validation instance (higher in the DOM) the exact property-path to bind to
} else if (this.value.constructor.name === "ValidationResultProperty") {
//Binding to a single validation property
this.subscribeChangedHandlersForProperty(this.value, this.element);
Expand Down Expand Up @@ -83,7 +61,7 @@ define(["exports", "aurelia-templating", "aurelia-binding", "../validation/valid
if (currentDepth === 5) {
return;
}
if (currentElement.nodeName === "LABEL" && currentElement.attributes["for"] && currentElement.attributes["for"].value === inputId) {
if (currentElement.nodeName === "LABEL" && (currentElement.attributes["for"] && currentElement.attributes["for"].value === inputId || !currentElement.attributes["for"])) {
currentLabels.push(currentElement);
}

Expand Down Expand Up @@ -140,43 +118,55 @@ define(["exports", "aurelia-templating", "aurelia-binding", "../validation/valid
element.parentNode.appendChild(helpBlock);
}
}

helpBlock.textContent = validationProperty.message;
if (validationProperty) helpBlock.textContent = validationProperty.message;else helpBlock.textContent = "";
}
},
appendUIVisuals: {
value: function appendUIVisuals(validationProperty, currentElement) {
var formGroup = this.searchFormGroup(currentElement, 0);
if (formGroup) {
if (validationProperty) {
if (validationProperty.isValid) {
formGroup.classList.remove("has-warning");
formGroup.classList.add("has-success");
} else {
formGroup.classList.remove("has-success");
formGroup.classList.add("has-warning");
}
} else {
formGroup.classList.remove("has-warning");
formGroup.classList.remove("has-success");
}
if (this.config.appendMessageToInput) {
this.appendMessageToElement(currentElement, validationProperty);
}
if (this.config.appendMessageToLabel) {
var labels = this.findLabels(formGroup, currentElement.id);
for (var ii = 0; ii < labels.length; ii++) {
var label = labels[ii];
this.appendMessageToElement(label, validationProperty);
}
}
}
}
},
subscribeChangedHandlersForProperty: {
value: function subscribeChangedHandlersForProperty(validationProperty, currentElement) {
var _this = this;

if (validationProperty !== undefined) {
this.appendUIVisuals(null, currentElement);
validationProperty.onValidate(function (validationProperty) {
var formGroup = _this.searchFormGroup(currentElement, 0);
if (formGroup) {
if (validationProperty.isValid) {
formGroup.classList.remove("has-warning");
formGroup.classList.add("has-success");
} else {
formGroup.classList.remove("has-success");
formGroup.classList.add("has-warning");
}
if (_this.config.appendMessageToInput) {
_this.appendMessageToElement(currentElement, validationProperty);
}
if (_this.config.appendMessageToLabel) {
var labels = _this.findLabels(formGroup, currentElement.id);
for (var ii = 0; ii < labels.length; ii++) {
var label = labels[ii];
_this.appendMessageToElement(label, validationProperty);
}
}
}
_this.appendUIVisuals(validationProperty, currentElement);
});
}
}
},
detached: {
value: function detached() {
}
value: function detached() {}
},
attached: {
value: function attached() {}
}
}, {
metadata: {
Expand All @@ -193,6 +183,4 @@ define(["exports", "aurelia-templating", "aurelia-binding", "../validation/valid

return ValidateAttachedBehavior;
})();
});

//This empty method must be here, aurelia will not set this.value if it's not :-O
});
25 changes: 3 additions & 22 deletions dist/amd/validation/validation.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
define(["exports", "aurelia-binding", "../validation/validationRules", "../validation/validationRulesCollection", "../validation/validationGroup", "../validation/validationLocaleRepository"], function (exports, _aureliaBinding, _validationValidationRules, _validationValidationRulesCollection, _validationValidationGroup, _validationValidationLocaleRepository) {
"use strict";

var _createClass = (function () {
function defineProperties(target, props) {
for (var key in props) {
var prop = props[key];
prop.configurable = true;
if (prop.value) prop.writable = true;
}
Object.defineProperties(target, props);
}

return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
})();
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

var _classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

Object.defineProperty(exports, "__esModule", {
value: true
Expand Down Expand Up @@ -86,4 +67,4 @@ define(["exports", "aurelia-binding", "../validation/validationRules", "../valid
}
};
Validation.Locale = new ValidationLocaleRepository();
});
});
25 changes: 3 additions & 22 deletions dist/amd/validation/validationGroup.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
define(["exports", "../validation/validationGroupBuilder", "../validation/validationResult"], function (exports, _validationValidationGroupBuilder, _validationValidationResult) {
"use strict";

var _createClass = (function () {
function defineProperties(target, props) {
for (var key in props) {
var prop = props[key];
prop.configurable = true;
if (prop.value) prop.writable = true;
}
Object.defineProperties(target, props);
}
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
})();

var _classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

Object.defineProperty(exports, "__esModule", {
value: true
Expand Down Expand Up @@ -194,4 +175,4 @@ define(["exports", "../validation/validationGroupBuilder", "../validation/valida

return ValidationGroup;
})();
});
});
25 changes: 3 additions & 22 deletions dist/amd/validation/validationGroupBuilder.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
define(["exports", "../validation/validationRules", "../validation/validationRulesCollection", "../validation/validationProperty"], function (exports, _validationValidationRules, _validationValidationRulesCollection, _validationValidationProperty) {
"use strict";

var _createClass = (function () {
function defineProperties(target, props) {
for (var key in props) {
var prop = props[key];
prop.configurable = true;
if (prop.value) prop.writable = true;
}
Object.defineProperties(target, props);
}
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
})();

var _classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

Object.defineProperty(exports, "__esModule", {
value: true
Expand Down Expand Up @@ -233,4 +214,4 @@ define(["exports", "../validation/validationRules", "../validation/validationRul

return ValidationGroupBuilder;
})();
});
});
25 changes: 3 additions & 22 deletions dist/amd/validation/validationLocaleRepository.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
define(["exports", "../resources/defaults"], function (exports, _resourcesDefaults) {
"use strict";

var _createClass = (function () {
function defineProperties(target, props) {
for (var key in props) {
var prop = props[key];
prop.configurable = true;
if (prop.value) prop.writable = true;
}
Object.defineProperties(target, props);
}
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
})();

var _classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

Object.defineProperty(exports, "__esModule", {
value: true
Expand Down Expand Up @@ -99,4 +80,4 @@ define(["exports", "../resources/defaults"], function (exports, _resourcesDefaul

return ValidationLocaleRepository;
})();
});
});
Loading

0 comments on commit 8a6d4f6

Please sign in to comment.