dev build 1.4.6
This commit is contained in:
parent
27bf7b6d1e
commit
71c9d904a6
dist
5
dist/CHANGELOG.txt
vendored
5
dist/CHANGELOG.txt
vendored
@ -1,6 +1,11 @@
|
|||||||
X-editable changelog
|
X-editable changelog
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
|
Version 1.4.6 wip
|
||||||
|
----------------------------
|
||||||
|
[bug #276] support id() and text() functions of select2 (vitalets)
|
||||||
|
|
||||||
|
|
||||||
Version 1.4.5 Jun 23, 2013
|
Version 1.4.5 Jun 23, 2013
|
||||||
----------------------------
|
----------------------------
|
||||||
[enh #245] highlight element after update (vitalets)
|
[enh #245] highlight element after update (vitalets)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*! X-editable - v1.4.5
|
/*! X-editable - v1.4.6
|
||||||
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||||
* http://github.com/vitalets/x-editable
|
* http://github.com/vitalets/x-editable
|
||||||
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||||
|
39
dist/bootstrap-editable/js/bootstrap-editable.js
vendored
39
dist/bootstrap-editable/js/bootstrap-editable.js
vendored
@ -1,4 +1,4 @@
|
|||||||
/*! X-editable - v1.4.5
|
/*! X-editable - v1.4.6
|
||||||
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||||
* http://github.com/vitalets/x-editable
|
* http://github.com/vitalets/x-editable
|
||||||
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||||
@ -753,7 +753,10 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
valueProp = valueProp || 'value';
|
if (typeof(valueProp) !== "function") {
|
||||||
|
var idKey = valueProp || 'value';
|
||||||
|
valueProp = function (e) { return e[idKey]; };
|
||||||
|
}
|
||||||
|
|
||||||
var isValArray = $.isArray(value),
|
var isValArray = $.isArray(value),
|
||||||
result = [],
|
result = [],
|
||||||
@ -765,11 +768,11 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
} else {
|
} else {
|
||||||
/*jslint eqeq: true*/
|
/*jslint eqeq: true*/
|
||||||
if(isValArray) {
|
if(isValArray) {
|
||||||
if($.grep(value, function(v){ return v == (o && typeof o === 'object' ? o[valueProp] : o); }).length) {
|
if($.grep(value, function(v){ return v == (o && typeof o === 'object' ? valueProp(o) : o); }).length) {
|
||||||
result.push(o);
|
result.push(o);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(value == (o && typeof o === 'object' ? o[valueProp] : o)) {
|
if(value == (o && typeof o === 'object' ? valueProp(o) : o)) {
|
||||||
result.push(o);
|
result.push(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1809,16 +1812,19 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
|||||||
//highlight when saving
|
//highlight when saving
|
||||||
if(this.options.highlight) {
|
if(this.options.highlight) {
|
||||||
var $e = this.$element,
|
var $e = this.$element,
|
||||||
$bgColor = $e.css('background-color');
|
bgColor = $e.css('background-color');
|
||||||
|
|
||||||
$e.css('background-color', this.options.highlight);
|
$e.css('background-color', this.options.highlight);
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$e.css('background-color', $bgColor);
|
if(bgColor === 'transparent') {
|
||||||
|
bgColor = '';
|
||||||
|
}
|
||||||
|
$e.css('background-color', bgColor);
|
||||||
$e.addClass('editable-bg-transition');
|
$e.addClass('editable-bg-transition');
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$e.removeClass('editable-bg-transition');
|
$e.removeClass('editable-bg-transition');
|
||||||
}, 1700);
|
}, 1700);
|
||||||
}, 0);
|
}, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
//set new value
|
//set new value
|
||||||
@ -3511,7 +3517,7 @@ $(function(){
|
|||||||
|
|
||||||
//detect whether it is multi-valued
|
//detect whether it is multi-valued
|
||||||
this.isMultiple = this.options.select2.tags || this.options.select2.multiple;
|
this.isMultiple = this.options.select2.tags || this.options.select2.multiple;
|
||||||
this.isRemote = ('ajax' in this.options.select2);
|
this.isRemote = ('ajax' in this.options.select2);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
|
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
|
||||||
@ -3536,16 +3542,21 @@ $(function(){
|
|||||||
this.$input.on('change', function() {
|
this.$input.on('change', function() {
|
||||||
$(this).closest('form').parent().triggerHandler('resize');
|
$(this).closest('form').parent().triggerHandler('resize');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//store function that extracs ID from element
|
||||||
|
this.idFunc = this.$input.data('select2').opts.id;
|
||||||
|
this.formatSelection = this.$input.data('select2').opts.formatSelection;
|
||||||
},
|
},
|
||||||
|
|
||||||
value2html: function(value, element) {
|
value2html: function(value, element) {
|
||||||
var text = '', data;
|
var text = '', data,
|
||||||
|
that = this;
|
||||||
|
|
||||||
if(this.options.select2.tags) { //in tags mode just assign value
|
if(this.options.select2.tags) { //in tags mode just assign value
|
||||||
data = value;
|
data = value;
|
||||||
} else if(this.sourceData) {
|
} else if(this.sourceData) {
|
||||||
data = $.fn.editableutils.itemsByValue(value, this.sourceData, 'id');
|
data = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc);
|
||||||
} else {
|
} else {
|
||||||
//can not get list of possible values (e.g. autotext for select2 with ajax source)
|
//can not get list of possible values (e.g. autotext for select2 with ajax source)
|
||||||
}
|
}
|
||||||
@ -3555,10 +3566,10 @@ $(function(){
|
|||||||
//collect selected data and show with separator
|
//collect selected data and show with separator
|
||||||
text = [];
|
text = [];
|
||||||
$.each(data, function(k, v){
|
$.each(data, function(k, v){
|
||||||
text.push(v && typeof v === 'object' ? v.text : v);
|
text.push(v && typeof v === 'object' ? that.formatSelection(v) : v);
|
||||||
});
|
});
|
||||||
} else if(data) {
|
} else if(data) {
|
||||||
text = data.text;
|
text = that.formatSelection(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
text = $.isArray(text) ? text.join(this.options.viewseparator) : text;
|
text = $.isArray(text) ? text.join(this.options.viewseparator) : text;
|
||||||
@ -3577,7 +3588,7 @@ $(function(){
|
|||||||
var item, items;
|
var item, items;
|
||||||
//if sourceData loaded, use it to get text for display
|
//if sourceData loaded, use it to get text for display
|
||||||
if(this.sourceData) {
|
if(this.sourceData) {
|
||||||
items = $.fn.editableutils.itemsByValue(value, this.sourceData, 'id');
|
items = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc);
|
||||||
if(items.length) {
|
if(items.length) {
|
||||||
item = items[0];
|
item = items[0];
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
2
dist/jquery-editable/css/jquery-editable.css
vendored
2
dist/jquery-editable/css/jquery-editable.css
vendored
@ -1,4 +1,4 @@
|
|||||||
/*! X-editable - v1.4.5
|
/*! X-editable - v1.4.6
|
||||||
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||||
* http://github.com/vitalets/x-editable
|
* http://github.com/vitalets/x-editable
|
||||||
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*! X-editable - v1.4.5
|
/*! X-editable - v1.4.6
|
||||||
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||||
* http://github.com/vitalets/x-editable
|
* http://github.com/vitalets/x-editable
|
||||||
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||||
@ -753,7 +753,10 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
valueProp = valueProp || 'value';
|
if (typeof(valueProp) !== "function") {
|
||||||
|
var idKey = valueProp || 'value';
|
||||||
|
valueProp = function (e) { return e[idKey]; };
|
||||||
|
}
|
||||||
|
|
||||||
var isValArray = $.isArray(value),
|
var isValArray = $.isArray(value),
|
||||||
result = [],
|
result = [],
|
||||||
@ -765,11 +768,11 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
} else {
|
} else {
|
||||||
/*jslint eqeq: true*/
|
/*jslint eqeq: true*/
|
||||||
if(isValArray) {
|
if(isValArray) {
|
||||||
if($.grep(value, function(v){ return v == (o && typeof o === 'object' ? o[valueProp] : o); }).length) {
|
if($.grep(value, function(v){ return v == (o && typeof o === 'object' ? valueProp(o) : o); }).length) {
|
||||||
result.push(o);
|
result.push(o);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(value == (o && typeof o === 'object' ? o[valueProp] : o)) {
|
if(value == (o && typeof o === 'object' ? valueProp(o) : o)) {
|
||||||
result.push(o);
|
result.push(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1809,16 +1812,19 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
|||||||
//highlight when saving
|
//highlight when saving
|
||||||
if(this.options.highlight) {
|
if(this.options.highlight) {
|
||||||
var $e = this.$element,
|
var $e = this.$element,
|
||||||
$bgColor = $e.css('background-color');
|
bgColor = $e.css('background-color');
|
||||||
|
|
||||||
$e.css('background-color', this.options.highlight);
|
$e.css('background-color', this.options.highlight);
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$e.css('background-color', $bgColor);
|
if(bgColor === 'transparent') {
|
||||||
|
bgColor = '';
|
||||||
|
}
|
||||||
|
$e.css('background-color', bgColor);
|
||||||
$e.addClass('editable-bg-transition');
|
$e.addClass('editable-bg-transition');
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$e.removeClass('editable-bg-transition');
|
$e.removeClass('editable-bg-transition');
|
||||||
}, 1700);
|
}, 1700);
|
||||||
}, 0);
|
}, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
//set new value
|
//set new value
|
||||||
@ -3511,7 +3517,7 @@ $(function(){
|
|||||||
|
|
||||||
//detect whether it is multi-valued
|
//detect whether it is multi-valued
|
||||||
this.isMultiple = this.options.select2.tags || this.options.select2.multiple;
|
this.isMultiple = this.options.select2.tags || this.options.select2.multiple;
|
||||||
this.isRemote = ('ajax' in this.options.select2);
|
this.isRemote = ('ajax' in this.options.select2);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
|
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
|
||||||
@ -3536,16 +3542,21 @@ $(function(){
|
|||||||
this.$input.on('change', function() {
|
this.$input.on('change', function() {
|
||||||
$(this).closest('form').parent().triggerHandler('resize');
|
$(this).closest('form').parent().triggerHandler('resize');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//store function that extracs ID from element
|
||||||
|
this.idFunc = this.$input.data('select2').opts.id;
|
||||||
|
this.formatSelection = this.$input.data('select2').opts.formatSelection;
|
||||||
},
|
},
|
||||||
|
|
||||||
value2html: function(value, element) {
|
value2html: function(value, element) {
|
||||||
var text = '', data;
|
var text = '', data,
|
||||||
|
that = this;
|
||||||
|
|
||||||
if(this.options.select2.tags) { //in tags mode just assign value
|
if(this.options.select2.tags) { //in tags mode just assign value
|
||||||
data = value;
|
data = value;
|
||||||
} else if(this.sourceData) {
|
} else if(this.sourceData) {
|
||||||
data = $.fn.editableutils.itemsByValue(value, this.sourceData, 'id');
|
data = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc);
|
||||||
} else {
|
} else {
|
||||||
//can not get list of possible values (e.g. autotext for select2 with ajax source)
|
//can not get list of possible values (e.g. autotext for select2 with ajax source)
|
||||||
}
|
}
|
||||||
@ -3555,10 +3566,10 @@ $(function(){
|
|||||||
//collect selected data and show with separator
|
//collect selected data and show with separator
|
||||||
text = [];
|
text = [];
|
||||||
$.each(data, function(k, v){
|
$.each(data, function(k, v){
|
||||||
text.push(v && typeof v === 'object' ? v.text : v);
|
text.push(v && typeof v === 'object' ? that.formatSelection(v) : v);
|
||||||
});
|
});
|
||||||
} else if(data) {
|
} else if(data) {
|
||||||
text = data.text;
|
text = that.formatSelection(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
text = $.isArray(text) ? text.join(this.options.viewseparator) : text;
|
text = $.isArray(text) ? text.join(this.options.viewseparator) : text;
|
||||||
@ -3577,7 +3588,7 @@ $(function(){
|
|||||||
var item, items;
|
var item, items;
|
||||||
//if sourceData loaded, use it to get text for display
|
//if sourceData loaded, use it to get text for display
|
||||||
if(this.sourceData) {
|
if(this.sourceData) {
|
||||||
items = $.fn.editableutils.itemsByValue(value, this.sourceData, 'id');
|
items = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc);
|
||||||
if(items.length) {
|
if(items.length) {
|
||||||
item = items[0];
|
item = items[0];
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
|||||||
/*! X-editable - v1.4.5
|
/*! X-editable - v1.4.6
|
||||||
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||||
* http://github.com/vitalets/x-editable
|
* http://github.com/vitalets/x-editable
|
||||||
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||||
|
39
dist/jqueryui-editable/js/jqueryui-editable.js
vendored
39
dist/jqueryui-editable/js/jqueryui-editable.js
vendored
@ -1,4 +1,4 @@
|
|||||||
/*! X-editable - v1.4.5
|
/*! X-editable - v1.4.6
|
||||||
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||||
* http://github.com/vitalets/x-editable
|
* http://github.com/vitalets/x-editable
|
||||||
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||||
@ -753,7 +753,10 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
valueProp = valueProp || 'value';
|
if (typeof(valueProp) !== "function") {
|
||||||
|
var idKey = valueProp || 'value';
|
||||||
|
valueProp = function (e) { return e[idKey]; };
|
||||||
|
}
|
||||||
|
|
||||||
var isValArray = $.isArray(value),
|
var isValArray = $.isArray(value),
|
||||||
result = [],
|
result = [],
|
||||||
@ -765,11 +768,11 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
} else {
|
} else {
|
||||||
/*jslint eqeq: true*/
|
/*jslint eqeq: true*/
|
||||||
if(isValArray) {
|
if(isValArray) {
|
||||||
if($.grep(value, function(v){ return v == (o && typeof o === 'object' ? o[valueProp] : o); }).length) {
|
if($.grep(value, function(v){ return v == (o && typeof o === 'object' ? valueProp(o) : o); }).length) {
|
||||||
result.push(o);
|
result.push(o);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(value == (o && typeof o === 'object' ? o[valueProp] : o)) {
|
if(value == (o && typeof o === 'object' ? valueProp(o) : o)) {
|
||||||
result.push(o);
|
result.push(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1809,16 +1812,19 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
|||||||
//highlight when saving
|
//highlight when saving
|
||||||
if(this.options.highlight) {
|
if(this.options.highlight) {
|
||||||
var $e = this.$element,
|
var $e = this.$element,
|
||||||
$bgColor = $e.css('background-color');
|
bgColor = $e.css('background-color');
|
||||||
|
|
||||||
$e.css('background-color', this.options.highlight);
|
$e.css('background-color', this.options.highlight);
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$e.css('background-color', $bgColor);
|
if(bgColor === 'transparent') {
|
||||||
|
bgColor = '';
|
||||||
|
}
|
||||||
|
$e.css('background-color', bgColor);
|
||||||
$e.addClass('editable-bg-transition');
|
$e.addClass('editable-bg-transition');
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$e.removeClass('editable-bg-transition');
|
$e.removeClass('editable-bg-transition');
|
||||||
}, 1700);
|
}, 1700);
|
||||||
}, 0);
|
}, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
//set new value
|
//set new value
|
||||||
@ -3511,7 +3517,7 @@ $(function(){
|
|||||||
|
|
||||||
//detect whether it is multi-valued
|
//detect whether it is multi-valued
|
||||||
this.isMultiple = this.options.select2.tags || this.options.select2.multiple;
|
this.isMultiple = this.options.select2.tags || this.options.select2.multiple;
|
||||||
this.isRemote = ('ajax' in this.options.select2);
|
this.isRemote = ('ajax' in this.options.select2);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
|
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
|
||||||
@ -3536,16 +3542,21 @@ $(function(){
|
|||||||
this.$input.on('change', function() {
|
this.$input.on('change', function() {
|
||||||
$(this).closest('form').parent().triggerHandler('resize');
|
$(this).closest('form').parent().triggerHandler('resize');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//store function that extracs ID from element
|
||||||
|
this.idFunc = this.$input.data('select2').opts.id;
|
||||||
|
this.formatSelection = this.$input.data('select2').opts.formatSelection;
|
||||||
},
|
},
|
||||||
|
|
||||||
value2html: function(value, element) {
|
value2html: function(value, element) {
|
||||||
var text = '', data;
|
var text = '', data,
|
||||||
|
that = this;
|
||||||
|
|
||||||
if(this.options.select2.tags) { //in tags mode just assign value
|
if(this.options.select2.tags) { //in tags mode just assign value
|
||||||
data = value;
|
data = value;
|
||||||
} else if(this.sourceData) {
|
} else if(this.sourceData) {
|
||||||
data = $.fn.editableutils.itemsByValue(value, this.sourceData, 'id');
|
data = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc);
|
||||||
} else {
|
} else {
|
||||||
//can not get list of possible values (e.g. autotext for select2 with ajax source)
|
//can not get list of possible values (e.g. autotext for select2 with ajax source)
|
||||||
}
|
}
|
||||||
@ -3555,10 +3566,10 @@ $(function(){
|
|||||||
//collect selected data and show with separator
|
//collect selected data and show with separator
|
||||||
text = [];
|
text = [];
|
||||||
$.each(data, function(k, v){
|
$.each(data, function(k, v){
|
||||||
text.push(v && typeof v === 'object' ? v.text : v);
|
text.push(v && typeof v === 'object' ? that.formatSelection(v) : v);
|
||||||
});
|
});
|
||||||
} else if(data) {
|
} else if(data) {
|
||||||
text = data.text;
|
text = that.formatSelection(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
text = $.isArray(text) ? text.join(this.options.viewseparator) : text;
|
text = $.isArray(text) ? text.join(this.options.viewseparator) : text;
|
||||||
@ -3577,7 +3588,7 @@ $(function(){
|
|||||||
var item, items;
|
var item, items;
|
||||||
//if sourceData loaded, use it to get text for display
|
//if sourceData loaded, use it to get text for display
|
||||||
if(this.sourceData) {
|
if(this.sourceData) {
|
||||||
items = $.fn.editableutils.itemsByValue(value, this.sourceData, 'id');
|
items = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc);
|
||||||
if(items.length) {
|
if(items.length) {
|
||||||
item = items[0];
|
item = items[0];
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user