diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index e1861d31..34288986 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,6 +1,20 @@
Angular-xeditable changelog
=============================
+Version 0.2.0 Jun 28, 2016
+
+----------------------------
+[enh #491] Added popover functionality (ckosloski)
+[fix #489] Fix - Memory leak when ending editing by destroying the scope (kenfdev)
+[enh #479] Added ability to add a label to an input (ckosloski)
+[enh #473] Added support for datetime-local input (ckosloski)
+[bug #464] Added ability to add more then one editable-ui-select component on the same page (julia-k)
+[enh #463] Added on-change support for bsdate and placeholder support for editable-select (ckosloski)
+[bug #456] Fixed bsdate warnings with latest ui-bootstrap (ckosloski)
+[bug #454] Fix finding form controller when elements not yet in DOM (bostrom)
+[bug #366] Make 'e-form' publish local $form even if specify object property (hshn)
+
+
Version 0.1.12 Apr 14, 2016
----------------------------
[enh #448] Add support for ui-select (ckosloski)
diff --git a/bower.json b/bower.json
index 73c0cc6a..b91990a8 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "angular-xeditable",
- "version": "0.1.12",
+ "version": "0.2.0",
"description": "Edit in place for AngularJS",
"author": "https://github.com/vitalets",
"license": "MIT",
diff --git a/dist/css/xeditable.css b/dist/css/xeditable.css
index 8919a903..ae9d4642 100644
--- a/dist/css/xeditable.css
+++ b/dist/css/xeditable.css
@@ -113,4 +113,53 @@ a.editable-empty:focus {
text-decoration: none;
}
+/* editable popover */
+.popover-wrapper a {
+ /* make the link always show up */
+ display: inline !important;
+}
+
+.popover-wrapper {
+ /* make absolutely positioned children constrained to this box*/
+ display: inline;
+ position: relative;
+}
+
+.popover-wrapper form {
+ position: absolute;
+ top: -53px;
+ background: #FFF;
+ border: 1px solid #AAA;
+ border-radius: 5px;
+ padding: 7px;
+ width: auto;
+ display: inline-block;
+ left: 50%;
+ margin-left: -110px;
+ z-index: 101;
+}
+
+.popover-wrapper form:before {
+ content:"";
+ width: 0;
+ height: 0;
+ border-left: 10px solid transparent;
+ border-right: 10px solid transparent;
+ border-top: 10px solid #AAA;
+ position:absolute;
+ bottom:-10px;
+ left:100px;
+}
+
+.popover-wrapper form:after {
+ content:"";
+ width:0;
+ height:0;
+ border-left: 9px solid transparent;
+ border-right: 9px solid transparent;
+ border-top: 9px solid #FFF;
+ position:absolute;
+ bottom:-9px;
+ left:101px;
+}
diff --git a/dist/css/xeditable.min.css b/dist/css/xeditable.min.css
index 4590ae42..376e3dd2 100644
--- a/dist/css/xeditable.min.css
+++ b/dist/css/xeditable.min.css
@@ -1,7 +1,7 @@
/*!
-angular-xeditable - 0.1.12
+angular-xeditable - 0.2.0
Edit-in-place for angular.js
-Build date: 2016-04-14
+Build date: 2016-06-28
*/
-.editable-wrap{display:inline-block;white-space:nowrap;margin:0}.editable-wrap .editable-controls,.editable-wrap .editable-error{margin-bottom:0}.editable-wrap .editable-controls>input,.editable-wrap .editable-controls>select,.editable-wrap .editable-controls>textarea{margin-bottom:0}.editable-wrap .editable-input{display:inline-block}.editable-buttons{display:inline-block;vertical-align:top}.editable-buttons button{margin-left:5px}.editable-input.editable-has-buttons{width:auto}.editable-bstime .editable-input input[type=text]{width:46px}.editable-bstime .well-small{margin-bottom:0;padding:10px}.editable-range output{display:inline-block;min-width:30px;vertical-align:top;text-align:center}.editable-color input[type=color]{width:50px}.editable-checkbox label span,.editable-checklist label span,.editable-radiolist label span{margin-left:7px;margin-right:10px}.editable-hide{display:none!important}.editable-click,a.editable-click{text-decoration:none;color:#428bca;border-bottom:dashed 1px #428bca}.editable-click:hover,a.editable-click:hover{text-decoration:none;color:#2a6496;border-bottom-color:#2a6496}.editable-empty,.editable-empty:hover,.editable-empty:focus,a.editable-empty,a.editable-empty:hover,a.editable-empty:focus{font-style:italic;color:#D14;text-decoration:none}
\ No newline at end of file
+.editable-wrap{display:inline-block;white-space:nowrap;margin:0}.editable-wrap .editable-controls,.editable-wrap .editable-error{margin-bottom:0}.editable-wrap .editable-controls>input,.editable-wrap .editable-controls>select,.editable-wrap .editable-controls>textarea{margin-bottom:0}.editable-wrap .editable-input{display:inline-block}.editable-buttons{display:inline-block;vertical-align:top}.editable-buttons button{margin-left:5px}.editable-input.editable-has-buttons{width:auto}.editable-bstime .editable-input input[type=text]{width:46px}.editable-bstime .well-small{margin-bottom:0;padding:10px}.editable-range output{display:inline-block;min-width:30px;vertical-align:top;text-align:center}.editable-color input[type=color]{width:50px}.editable-checkbox label span,.editable-checklist label span,.editable-radiolist label span{margin-left:7px;margin-right:10px}.editable-hide{display:none!important}.editable-click,a.editable-click{text-decoration:none;color:#428bca;border-bottom:dashed 1px #428bca}.editable-click:hover,a.editable-click:hover{text-decoration:none;color:#2a6496;border-bottom-color:#2a6496}.editable-empty,.editable-empty:hover,.editable-empty:focus,a.editable-empty,a.editable-empty:hover,a.editable-empty:focus{font-style:italic;color:#D14;text-decoration:none}.popover-wrapper a{display:inline!important}.popover-wrapper{display:inline;position:relative}.popover-wrapper form{position:absolute;top:-53px;background:#FFF;border:1px solid #AAA;border-radius:5px;padding:7px;width:auto;display:inline-block;left:50%;margin-left:-110px;z-index:101}.popover-wrapper form:before{content:"";width:0;height:0;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid #AAA;position:absolute;bottom:-10px;left:100px}.popover-wrapper form:after{content:"";width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;border-top:9px solid #FFF;position:absolute;bottom:-9px;left:101px}
\ No newline at end of file
diff --git a/dist/js/xeditable.js b/dist/js/xeditable.js
index 2bc855e5..8817d68b 100644
--- a/dist/js/xeditable.js
+++ b/dist/js/xeditable.js
@@ -1,7 +1,7 @@
/*!
-angular-xeditable - 0.1.12
+angular-xeditable - 0.2.0
Edit-in-place for angular.js
-Build date: 2016-04-14
+Build date: 2016-06-28
*/
/**
* Angular-xeditable module
@@ -97,16 +97,12 @@ angular.module('xeditable').directive('editableBsdate', ['editableDirectiveFacto
**/
this.parent.render.call(this);
- var inputDatePicker = angular.element('');
- var buttonDatePicker = angular.element('');
- var buttonWrapper = angular.element('');
+ var inputDatePicker = angular.element('');
inputDatePicker.attr('uib-datepicker-popup', this.attrs.eDatepickerPopupXEditable || 'yyyy/MM/dd' );
inputDatePicker.attr('is-open', this.attrs.eIsOpen);
inputDatePicker.attr('date-disabled', this.attrs.eDateDisabled);
inputDatePicker.attr('uib-datepicker-popup', this.attrs.eDatepickerPopup);
- inputDatePicker.attr('min-date', this.attrs.eMinDate);
- inputDatePicker.attr('max-date', this.attrs.eMaxDate);
inputDatePicker.attr('year-range', this.attrs.eYearRange || 20);
inputDatePicker.attr('show-button-bar', this.attrs.eShowButtonBar || true);
inputDatePicker.attr('current-text', this.attrs.eCurrentText || 'Today');
@@ -116,6 +112,13 @@ angular.module('xeditable').directive('editableBsdate', ['editableDirectiveFacto
inputDatePicker.attr('datepicker-append-to-body', this.attrs.eDatePickerAppendToBody || false);
inputDatePicker.attr('date-disabled', this.attrs.eDateDisabled);
inputDatePicker.attr('name', this.attrs.eName);
+ inputDatePicker.attr('on-open-focus', this.attrs.eOnOpenFocus || true);
+ inputDatePicker.attr('ng-readonly', this.attrs.eReadonly || false);
+
+ if (this.attrs.eNgChange) {
+ inputDatePicker.attr('ng-change', this.attrs.eNgChange);
+ this.inputEl.removeAttr('ng-change');
+ }
this.scope.dateOptions = {
formatDay: this.attrs.eFormatDay || 'dd',
@@ -128,17 +131,32 @@ angular.module('xeditable').directive('editableBsdate', ['editableDirectiveFacto
startingDay: this.attrs.eStartingDay || 0,
minMode: this.attrs.eMinMode || 'day',
maxMode: this.attrs.eMaxMode || 'year',
- initDate: this.attrs.eInitDate || new Date(),
- datepickerMode: this.attrs.eDatepickerMode || 'day'
+ initDate: this.scope.$eval(this.attrs.eInitDate) || new Date(),
+ datepickerMode: this.attrs.eDatepickerMode || 'day',
+ maxDate: this.scope.$eval(this.attrs.eMaxDate) || null,
+ minDate: this.scope.$eval(this.attrs.eMinDate) || null
};
- inputDatePicker.attr('datepicker-options', "dateOptions");
+ var showCalendarButton = angular.isDefined(this.attrs.eShowCalendarButton) ? this.attrs.eShowCalendarButton : "true";
+
+ //See if calendar button should be displayed
+ if (showCalendarButton === "true") {
+ var buttonDatePicker = angular.element('');
+ var buttonWrapper = angular.element('');
+
+ buttonDatePicker.attr('ng-click', this.attrs.eNgClick);
+
+ buttonWrapper.append(buttonDatePicker);
- buttonDatePicker.attr('ng-click',this.attrs.eNgClick);
+ this.inputEl.append(buttonWrapper);
+ } else {
+ //If no calendar button, display calendar popup on click of input field
+ inputDatePicker.attr('ng-click', this.attrs.eNgClick);
+ }
+
+ inputDatePicker.attr('datepicker-options', "dateOptions");
- buttonWrapper.append(buttonDatePicker);
this.inputEl.prepend(inputDatePicker);
- this.inputEl.append(buttonWrapper);
this.inputEl.removeAttr('class');
this.inputEl.removeAttr('ng-click');
@@ -224,7 +242,7 @@ angular.module('xeditable').directive('editableChecklist', [
this.parent.render.call(this);
var parsed = editableNgOptionsParser(this.attrs.eNgOptions);
var html = '';
this.inputEl.removeAttr('ng-model');
@@ -264,23 +282,43 @@ angular.module('xeditable').directive('editableCombodate', ['editableDirectiveFa
]);
/*
-Input types: text|email|tel|number|url|search|color|date|datetime|time|month|week
+Input types: text|password|email|tel|number|url|search|color|date|datetime|datetime-local|time|month|week|file
*/
(function() {
- var types = 'text|password|email|tel|number|url|search|color|date|datetime|time|month|week|file'.split('|');
+ var camelCase = function(dashDelimitedString) {
+ return dashDelimitedString.toLowerCase().replace(/-(.)/g, function(match, word) {
+ return word.toUpperCase();
+ });
+ };
+
+ var types = 'text|password|email|tel|number|url|search|color|date|datetime|datetime-local|time|month|week|file'.split('|');
//todo: datalist
// generate directives
angular.forEach(types, function(type) {
- var directiveName = 'editable'+type.charAt(0).toUpperCase() + type.slice(1);
+ var directiveName = camelCase('editable' + '-' + type);
angular.module('xeditable').directive(directiveName, ['editableDirectiveFactory',
function(editableDirectiveFactory) {
return editableDirectiveFactory({
directiveName: directiveName,
- inputTpl: ''
+ inputTpl: '',
+ render: function() {
+ this.parent.render.call(this);
+
+ // Add label to the input
+ if (this.attrs.eLabel) {
+ var label = angular.element('');
+ this.inputEl.parent().prepend(label);
+ }
+
+ // Add classes to the form
+ if (this.attrs.eFormclass) {
+ this.editorEl.addClass(this.attrs.eFormclass);
+ }
+ }
});
}]);
});
@@ -312,9 +350,10 @@ angular.module('xeditable').directive('editableRadiolist', [
render: function() {
this.parent.render.call(this);
var parsed = editableNgOptionsParser(this.attrs.eNgOptions);
- var html = '';
+
+ var html = '';
this.inputEl.removeAttr('ng-model');
this.inputEl.removeAttr('ng-options');
@@ -339,6 +378,14 @@ angular.module('xeditable').directive('editableSelect', ['editableDirectiveFacto
return editableDirectiveFactory({
directiveName: 'editableSelect',
inputTpl: '',
+ render: function() {
+ this.parent.render.call(this);
+
+ if (this.attrs.ePlaceholder) {
+ var placeholder = angular.element('');
+ this.inputEl.append(placeholder);
+ }
+ },
autosubmit: function() {
var self = this;
self.inputEl.bind('change', function() {
@@ -392,17 +439,27 @@ angular.module('xeditable').directive('editableUiSelect',['editableDirectiveFact
return newEl;
};
- var match = null;
- var choices = null;
+ var findElement = function(name) {
+ for(var i = 0, len = match.length; i < len; i++) {
+ if (match[i].name === name) {
+ return i;
+ }
+ }
+ };
+
+ var match = [];
+ var choices = [];
+
var dir = editableDirectiveFactory({
directiveName: 'editableUiSelect',
inputTpl: '