diff --git a/bower.json b/bower.json index 4b6ba4d3..b82341bd 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-validation", - "version": "0.1.0", + "version": "0.1.1", "description": "A validation plugin for Aurelia.", "keywords": [ "aurelia", diff --git a/dist/amd/validation.js b/dist/amd/validation.js index ea105037..d375b9ab 100644 --- a/dist/amd/validation.js +++ b/dist/amd/validation.js @@ -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); } -}); +}); \ No newline at end of file diff --git a/dist/amd/validation/pathObserver.js b/dist/amd/validation/pathObserver.js index 5e4b78aa..831e1d65 100644 --- a/dist/amd/validation/pathObserver.js +++ b/dist/amd/validation/pathObserver.js @@ -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 @@ -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: { @@ -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(); } @@ -159,4 +139,4 @@ define(["exports", "aurelia-binding"], function (exports, _aureliaBinding) { return PathObserver; })(); -}); +}); \ No newline at end of file diff --git a/dist/amd/validation/validateAttachedBehavior.js b/dist/amd/validation/validateAttachedBehavior.js index 2ea953f6..78198d04 100644 --- a/dist/amd/validation/validateAttachedBehavior.js +++ b/dist/amd/validation/validateAttachedBehavior.js @@ -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 @@ -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); @@ -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); } @@ -140,8 +118,36 @@ 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: { @@ -149,34 +155,18 @@ define(["exports", "aurelia-templating", "aurelia-binding", "../validation/valid 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: { @@ -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 +}); \ No newline at end of file diff --git a/dist/amd/validation/validation.js b/dist/amd/validation/validation.js index 57833d91..c15fa41a 100644 --- a/dist/amd/validation/validation.js +++ b/dist/amd/validation/validation.js @@ -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 @@ -86,4 +67,4 @@ define(["exports", "aurelia-binding", "../validation/validationRules", "../valid } }; Validation.Locale = new ValidationLocaleRepository(); -}); +}); \ No newline at end of file diff --git a/dist/amd/validation/validationGroup.js b/dist/amd/validation/validationGroup.js index 59fd23dd..28930219 100644 --- a/dist/amd/validation/validationGroup.js +++ b/dist/amd/validation/validationGroup.js @@ -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 @@ -194,4 +175,4 @@ define(["exports", "../validation/validationGroupBuilder", "../validation/valida return ValidationGroup; })(); -}); +}); \ No newline at end of file diff --git a/dist/amd/validation/validationGroupBuilder.js b/dist/amd/validation/validationGroupBuilder.js index 541aab1f..4a869009 100644 --- a/dist/amd/validation/validationGroupBuilder.js +++ b/dist/amd/validation/validationGroupBuilder.js @@ -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 @@ -233,4 +214,4 @@ define(["exports", "../validation/validationRules", "../validation/validationRul return ValidationGroupBuilder; })(); -}); +}); \ No newline at end of file diff --git a/dist/amd/validation/validationLocaleRepository.js b/dist/amd/validation/validationLocaleRepository.js index 1e729c41..39b38df9 100644 --- a/dist/amd/validation/validationLocaleRepository.js +++ b/dist/amd/validation/validationLocaleRepository.js @@ -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 @@ -99,4 +80,4 @@ define(["exports", "../resources/defaults"], function (exports, _resourcesDefaul return ValidationLocaleRepository; })(); -}); +}); \ No newline at end of file diff --git a/dist/amd/validation/validationProperty.js b/dist/amd/validation/validationProperty.js index dc845f71..562bc84a 100644 --- a/dist/amd/validation/validationProperty.js +++ b/dist/amd/validation/validationProperty.js @@ -1,28 +1,9 @@ define(["exports", "../validation/validationRulesCollection", "../validation/pathObserver"], function (exports, _validationValidationRulesCollection, _validationPathObserver) { "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 @@ -72,4 +53,4 @@ define(["exports", "../validation/validationRulesCollection", "../validation/pat return ValidationProperty; })(); -}); +}); \ No newline at end of file diff --git a/dist/amd/validation/validationResult.js b/dist/amd/validation/validationResult.js index 2cd35a71..58bfc864 100644 --- a/dist/amd/validation/validationResult.js +++ b/dist/amd/validation/validationResult.js @@ -1,28 +1,9 @@ define(["exports"], function (exports) { "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 @@ -102,4 +83,4 @@ define(["exports"], function (exports) { return ValidationResultProperty; })(); -}); +}); \ No newline at end of file diff --git a/dist/amd/validation/validationRules.js b/dist/amd/validation/validationRules.js index 1ff3652d..b3b4f9b9 100644 --- a/dist/amd/validation/validationRules.js +++ b/dist/amd/validation/validationRules.js @@ -1,63 +1,13 @@ define(["exports", "../validation/validation"], function (exports, _validationValidation) { "use strict"; - var _get = function get(object, property, receiver) { - var desc = Object.getOwnPropertyDescriptor(object, property); - if (desc === undefined) { - var parent = Object.getPrototypeOf(object); - if (parent === null) { - return undefined; - } else { - return get(parent, property, receiver); - } - } else if ("value" in desc && desc.writable) { - return desc.value; - } else { - var getter = desc.get; - if (getter === undefined) { - return undefined; - } - return getter.call(receiver); - } - }; + var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - var _inherits = function (subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - enumerable: false, - writable: true, - configurable: true - } - }); - if (superClass) subClass.__proto__ = superClass; - }; - - 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 _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; - 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 @@ -166,10 +116,7 @@ define(["exports", "../validation/validation"], function (exports, _validationVa function BetweenLengthValidationRule(minimumLength, maximumLength) { _classCallCheck(this, BetweenLengthValidationRule); - _get(Object.getPrototypeOf(BetweenLengthValidationRule.prototype), "constructor", this).call(this, { - minimumLength: minimumLength, - maximumLength: maximumLength - }, function (newValue, threshold) { + _get(Object.getPrototypeOf(BetweenLengthValidationRule.prototype), "constructor", this).call(this, { minimumLength: minimumLength, maximumLength: maximumLength }, function (newValue, threshold) { return newValue.length !== undefined && newValue.length >= threshold.minimumLength && newValue.length < threshold.maximumLength; }); } @@ -253,10 +200,7 @@ define(["exports", "../validation/validation"], function (exports, _validationVa function BetweenValueValidationRule(minimumValue, maximumValue) { _classCallCheck(this, BetweenValueValidationRule); - _get(Object.getPrototypeOf(BetweenValueValidationRule.prototype), "constructor", this).call(this, { - minimumValue: minimumValue, - maximumValue: maximumValue - }, function (newValue, threshold) { + _get(Object.getPrototypeOf(BetweenValueValidationRule.prototype), "constructor", this).call(this, { minimumValue: minimumValue, maximumValue: maximumValue }, function (newValue, threshold) { return threshold.minimumValue <= newValue && newValue < threshold.maximumValue; }); } @@ -376,4 +320,4 @@ define(["exports", "../validation/validation"], function (exports, _validationVa return InCollectionValidationRule; })(ValidationRule); -}); +}); \ No newline at end of file diff --git a/dist/amd/validation/validationRulesCollection.js b/dist/amd/validation/validationRulesCollection.js index 02c5eabb..39aab8b5 100644 --- a/dist/amd/validation/validationRulesCollection.js +++ b/dist/amd/validation/validationRulesCollection.js @@ -1,28 +1,9 @@ define(["exports", "../validation/validation"], function (exports, _validationValidation) { "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 @@ -108,7 +89,7 @@ define(["exports", "../validation/validation"], function (exports, _validationVa this.innerCollections = []; this.defaultCollection = new ValidationRulesCollection(); this.caseLabel = ""; - this.defaultCaseLabel = {description: "this is the case label for 'default'"}; + this.defaultCaseLabel = { description: "this is the case label for 'default'" }; } _createClass(SwitchCaseValidationRulesCollection, { @@ -129,8 +110,7 @@ define(["exports", "../validation/validation"], function (exports, _validationVa if (caseLabel === this.defaultCaseLabel) { return this.defaultCollection; - } - var currentCollection = null; + }var currentCollection = null; for (var i = 0; i < this.innerCollections.length; i++) { currentCollection = this.innerCollections[i]; if (currentCollection.caseLabel === caseLabel) { @@ -173,11 +153,11 @@ define(["exports", "../validation/validation"], function (exports, _validationVa notEmpty: { value: function notEmpty() { var collection = this.getCurrentCollection(this.caseLabel); - if (collection !== null) collection.notEmpty(); else this.defaultCollection.notEmpty(); + if (collection !== null) collection.notEmpty();else this.defaultCollection.notEmpty(); } } }); return SwitchCaseValidationRulesCollection; })(); -}); +}); \ No newline at end of file diff --git a/dist/es6/validation/validateAttachedBehavior.js b/dist/es6/validation/validateAttachedBehavior.js index 55dac00d..b6036edd 100644 --- a/dist/es6/validation/validateAttachedBehavior.js +++ b/dist/es6/validation/validateAttachedBehavior.js @@ -60,8 +60,7 @@ export class ValidateAttachedBehavior { if (currentElement.nodeName === "LABEL" && ((currentElement.attributes['for'] && currentElement.attributes['for'].value === inputId) || (!currentElement.attributes['for'])) - ) - { + ) { currentLabels.push(currentElement); } @@ -118,17 +117,16 @@ export class ValidateAttachedBehavior { element.parentNode.appendChild(helpBlock); } } - if(validationProperty) + if (validationProperty) helpBlock.textContent = validationProperty.message; else helpBlock.textContent = ''; } - appendUIVisuals(validationProperty, currentElement) - { + appendUIVisuals(validationProperty, currentElement) { var formGroup = this.searchFormGroup(currentElement, 0); if (formGroup) { - if(validationProperty) { + if (validationProperty) { if (validationProperty.isValid) { formGroup.classList.remove('has-warning'); formGroup.classList.add('has-success'); @@ -138,7 +136,7 @@ export class ValidateAttachedBehavior { formGroup.classList.add('has-warning'); } } - else{ + else { formGroup.classList.remove('has-warning'); formGroup.classList.remove('has-success'); } diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md new file mode 100644 index 00000000..272adca2 --- /dev/null +++ b/doc/CHANGELOG.md @@ -0,0 +1,2 @@ +### 0.1.1 (2015-03-24) + diff --git a/doc/api.json b/doc/api.json new file mode 100644 index 00000000..6de3c0a9 --- /dev/null +++ b/doc/api.json @@ -0,0 +1 @@ +{"classes":[],"methods":[],"properties":[],"events":[]} \ No newline at end of file diff --git a/package.json b/package.json index 1e75d067..be7ff4e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-validation", - "version": "0.1.0", + "version": "0.1.1", "description": "A validation plugin for Aurelia.", "keywords": [ "aurelia",