Skip to content

Commit

Permalink
Built 4.1.11 release
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Mar 8, 2016
1 parent 3471d11 commit 95c7842
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 107 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.1.11
Fixed `TypeError: Cannot read property 'unwatchers' of undefined` bug reported in issue #186.
Special thanks to @baconcutter for submitting this PR.

## 4.1.10
Validation now properly handles `minimum` and `maximum` values of 0 instead of filtering them out as falsy.

Expand Down
9 changes: 9 additions & 0 deletions dist/form-for.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
text-align: center;
vertical-align: middle;
display: inline-block;
background-image: -webkit-linear-gradient(bottom, #f9f9f9, #fff);
background-image: linear-gradient(to top, #f9f9f9, #fff);
border: 1px solid #aaa;
position: relative;
Expand Down Expand Up @@ -156,6 +157,7 @@ field-label {
text-align: center;
vertical-align: middle;
display: inline-block;
background-image: -webkit-linear-gradient(bottom, #f9f9f9, #fff);
background-image: linear-gradient(to top, #f9f9f9, #fff);
border: 1px solid #aaa;
position: relative;
Expand Down Expand Up @@ -231,6 +233,7 @@ select-field {
}
/************************* Select *************************/
.form-for-field select {
background: -webkit-linear-gradient(top, #fff, #efefef);
background: linear-gradient(top, #fff, #efefef);
padding-right: 30px;
}
Expand Down Expand Up @@ -336,6 +339,7 @@ submit-field {
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-transition: all;
transition: all;
border-radius: 6px;
border-style: none;
Expand All @@ -357,6 +361,7 @@ submit-field {
color: #fff;
}
.submit-button:active {
-webkit-transition: none;
transition: none;
box-shadow: inset 0 4px 2px rgba(0,0,0,0.1);
}
Expand Down Expand Up @@ -444,9 +449,11 @@ text-field {
}

.form-for-tooltip {
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
Expand All @@ -457,6 +464,7 @@ text-field {
display: inline-block;
width: 15px;
height: 15px;
-webkit-box-flex: 0;
-webkit-flex: 0 0 15px;
-ms-flex: 0 0 15px;
flex: 0 0 15px;
Expand All @@ -477,6 +485,7 @@ text-field {
display: none;
position: relative;
z-index: 2;
-webkit-box-flex: 0;
-webkit-flex: 0 0 350px;
-ms-flex: 0 0 350px;
flex: 0 0 350px;
Expand Down
209 changes: 106 additions & 103 deletions dist/form-for.js
Original file line number Diff line number Diff line change
Expand Up @@ -1179,9 +1179,12 @@ var formFor;
*/
target.unregisterFormField = function (fieldName) {
var bindableFieldName = nestedObjectHelper.flattenAttribute(fieldName);
angular.forEach($scope.fields[bindableFieldName].unwatchers, function (unwatch) {
unwatch();
});
var formField = $scope.fields[bindableFieldName];
if (formField) {
angular.forEach(formField.unwatchers, function (unwatch) {
unwatch();
});
}
delete $scope.fields[bindableFieldName];
};
/**
Expand Down Expand Up @@ -2359,6 +2362,106 @@ var formFor;
;
})(formFor || (formFor = {}));
;
/// <reference path="nested-object-helper.ts" />
var formFor;
(function (formFor) {
/*
* Organizes state management for form-submission and field validity.
*
* <p>Intended for use only by formFor directive; this class is not exposed to the $injector.
*/
var FormForStateHelper = (function () {
// TODO Add some documentation
function FormForStateHelper($parse, $scope) {
this.formForScope_ = $scope;
this.nestedObjectHelper_ = new formFor.NestedObjectHelper($parse);
this.formForScope_.fieldNameToErrorMap = $scope.fieldNameToErrorMap || {};
this.formForScope_.valid = true;
this.fieldNameToModifiedStateMap_ = {};
this.formSubmitted_ = false;
this.fieldNameToErrorMap_ = {};
this.watchable = 0;
}
FormForStateHelper.prototype.getFieldError = function (fieldName) {
return this.nestedObjectHelper_.readAttribute(this.formForScope_.fieldNameToErrorMap, fieldName);
};
FormForStateHelper.prototype.hasFieldBeenModified = function (fieldName) {
return this.nestedObjectHelper_.readAttribute(this.fieldNameToModifiedStateMap_, fieldName);
};
FormForStateHelper.prototype.hasFormBeenSubmitted = function () {
return this.formSubmitted_;
};
FormForStateHelper.prototype.isFormInvalid = function () {
return !this.isFormValid();
};
FormForStateHelper.prototype.isFormValid = function () {
for (var prop in this.fieldNameToErrorMap_) {
return false;
}
return true;
};
FormForStateHelper.prototype.resetFieldErrors = function () {
this.formForScope_.fieldNameToErrorMap = {};
};
FormForStateHelper.prototype.setFieldError = function (fieldName, error) {
var safeFieldName = this.nestedObjectHelper_.flattenAttribute(fieldName);
this.nestedObjectHelper_.writeAttribute(this.formForScope_.fieldNameToErrorMap, fieldName, error);
if (error) {
this.fieldNameToErrorMap_[safeFieldName] = error;
}
else {
delete this.fieldNameToErrorMap_[safeFieldName];
}
this.formForScope_.valid = this.isFormValid();
this.watchable++;
};
FormForStateHelper.prototype.setFieldHasBeenModified = function (fieldName, hasBeenModified) {
this.nestedObjectHelper_.writeAttribute(this.fieldNameToModifiedStateMap_, fieldName, hasBeenModified);
this.watchable++;
};
FormForStateHelper.prototype.setFormSubmitted = function (submitted) {
this.formSubmitted_ = submitted;
this.watchable++;
};
return FormForStateHelper;
})();
formFor.FormForStateHelper = FormForStateHelper;
})(formFor || (formFor = {}));
var formFor;
(function (formFor) {
/**
* Utility for working with strings.
*
* <p>Intended for use only by formFor directive; this class is not exposed to the $injector.
*/
var StringUtil = (function () {
function StringUtil() {
}
/**
* Converts text in common variable formats to humanized form.
*
* @param text Name of variable to be humanized (ex. myVariable, my_variable)
* @returns Humanized string (ex. 'My Variable')
*/
StringUtil.humanize = function (text) {
if (!text) {
return '';
}
text = text.replace(/[A-Z]/g, function (match) {
return ' ' + match;
});
text = text.replace(/_([a-z])/g, function (match, $1) {
return ' ' + $1.toUpperCase();
});
text = text.replace(/\s+/g, ' ');
text = text.trim();
text = text.charAt(0).toUpperCase() + text.slice(1);
return text;
};
return StringUtil;
})();
formFor.StringUtil = StringUtil;
})(formFor || (formFor = {}));
/// <reference path="../../definitions/angular.d.ts" />
/// <reference path="form-for-configuration.ts" />
/// <reference path="../utils/nested-object-helper.ts" />
Expand Down Expand Up @@ -2832,104 +2935,4 @@ var formFor;
return new ModelValidator($interpolate, $parse, $q, FormForConfiguration);
}]);
})(formFor || (formFor = {}));
/// <reference path="nested-object-helper.ts" />
var formFor;
(function (formFor) {
/*
* Organizes state management for form-submission and field validity.
*
* <p>Intended for use only by formFor directive; this class is not exposed to the $injector.
*/
var FormForStateHelper = (function () {
// TODO Add some documentation
function FormForStateHelper($parse, $scope) {
this.formForScope_ = $scope;
this.nestedObjectHelper_ = new formFor.NestedObjectHelper($parse);
this.formForScope_.fieldNameToErrorMap = $scope.fieldNameToErrorMap || {};
this.formForScope_.valid = true;
this.fieldNameToModifiedStateMap_ = {};
this.formSubmitted_ = false;
this.fieldNameToErrorMap_ = {};
this.watchable = 0;
}
FormForStateHelper.prototype.getFieldError = function (fieldName) {
return this.nestedObjectHelper_.readAttribute(this.formForScope_.fieldNameToErrorMap, fieldName);
};
FormForStateHelper.prototype.hasFieldBeenModified = function (fieldName) {
return this.nestedObjectHelper_.readAttribute(this.fieldNameToModifiedStateMap_, fieldName);
};
FormForStateHelper.prototype.hasFormBeenSubmitted = function () {
return this.formSubmitted_;
};
FormForStateHelper.prototype.isFormInvalid = function () {
return !this.isFormValid();
};
FormForStateHelper.prototype.isFormValid = function () {
for (var prop in this.fieldNameToErrorMap_) {
return false;
}
return true;
};
FormForStateHelper.prototype.resetFieldErrors = function () {
this.formForScope_.fieldNameToErrorMap = {};
};
FormForStateHelper.prototype.setFieldError = function (fieldName, error) {
var safeFieldName = this.nestedObjectHelper_.flattenAttribute(fieldName);
this.nestedObjectHelper_.writeAttribute(this.formForScope_.fieldNameToErrorMap, fieldName, error);
if (error) {
this.fieldNameToErrorMap_[safeFieldName] = error;
}
else {
delete this.fieldNameToErrorMap_[safeFieldName];
}
this.formForScope_.valid = this.isFormValid();
this.watchable++;
};
FormForStateHelper.prototype.setFieldHasBeenModified = function (fieldName, hasBeenModified) {
this.nestedObjectHelper_.writeAttribute(this.fieldNameToModifiedStateMap_, fieldName, hasBeenModified);
this.watchable++;
};
FormForStateHelper.prototype.setFormSubmitted = function (submitted) {
this.formSubmitted_ = submitted;
this.watchable++;
};
return FormForStateHelper;
})();
formFor.FormForStateHelper = FormForStateHelper;
})(formFor || (formFor = {}));
var formFor;
(function (formFor) {
/**
* Utility for working with strings.
*
* <p>Intended for use only by formFor directive; this class is not exposed to the $injector.
*/
var StringUtil = (function () {
function StringUtil() {
}
/**
* Converts text in common variable formats to humanized form.
*
* @param text Name of variable to be humanized (ex. myVariable, my_variable)
* @returns Humanized string (ex. 'My Variable')
*/
StringUtil.humanize = function (text) {
if (!text) {
return '';
}
text = text.replace(/[A-Z]/g, function (match) {
return ' ' + match;
});
text = text.replace(/_([a-z])/g, function (match, $1) {
return ' ' + $1.toUpperCase();
});
text = text.replace(/\s+/g, ' ');
text = text.trim();
text = text.charAt(0).toUpperCase() + text.slice(1);
return text;
};
return StringUtil;
})();
formFor.StringUtil = StringUtil;
})(formFor || (formFor = {}));
/// <reference path="../../../definitions/angular.d.ts" />
4 changes: 2 additions & 2 deletions dist/form-for.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/form-for.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-form-for",
"version": "4.1.10",
"version": "4.1.11",
"description": "Set of Angular directives to simplify creating and validating HTML forms.",
"keywords": [
"angular",
Expand Down

0 comments on commit 95c7842

Please sign in to comment.