').append(this.$clear)))},value2html:function(t,e){t=t?this.dpg.formatDate(t,this.parsedViewFormat,this.options.datepicker.language):"";n.superclass.value2html.call(this,t,e)},html2value:function(t){return this.parseDate(t,this.parsedViewFormat)},value2str:function(t){return t?this.dpg.formatDate(t,this.parsedFormat,this.options.datepicker.language):""},str2value:function(t){return this.parseDate(t,this.parsedFormat)},value2submit:function(t){return this.value2str(t)},value2input:function(t){this.$input.bdatepicker("update",t)},input2value:function(){return this.$input.data("datepicker").date},activate:function(){},clear:function(){this.$input.data("datepicker").date=null,this.$input.find(".active").removeClass("active"),this.options.showbuttons||this.$input.closest("form").submit()},autosubmit:function(){this.$input.on("mouseup",".day",function(t){var e;i(t.currentTarget).is(".old")||i(t.currentTarget).is(".new")||(e=i(this).closest("form"),setTimeout(function(){e.submit()},200))})},parseDate:function(t,e){var i=null;return i=t&&(i=this.dpg.parseDate(t,e,this.options.datepicker.language),"string"==typeof t)&&t!==this.dpg.formatDate(i,e,this.options.datepicker.language)?null:i}}),n.defaults=i.extend({},i.fn.editabletypes.abstractinput.defaults,{tpl:'
',inputclass:null,format:"yyyy-mm-dd",viewformat:null,datepicker:{weekStart:0,startView:0,minViewMode:0,autoclose:!1},clear:"× clear"}),i.fn.editabletypes.date=n})(window.jQuery),(t=>{function e(t){this.init("datefield",t,e.defaults),this.initPicker(t,e.defaults)}t.fn.editableutils.inherit(e,t.fn.editabletypes.date),t.extend(e.prototype,{render:function(){this.$input=this.$tpl.find("input"),this.setClass(),this.setAttr("placeholder"),this.$tpl.bdatepicker(this.options.datepicker),this.$input.off("focus keydown"),this.$input.keyup(t.proxy(function(){this.$tpl.removeData("date"),this.$tpl.bdatepicker("update")},this))},value2input:function(t){this.$input.val(t?this.dpg.formatDate(t,this.parsedViewFormat,this.options.datepicker.language):""),this.$tpl.bdatepicker("update")},input2value:function(){return this.html2value(this.$input.val())},activate:function(){t.fn.editabletypes.text.prototype.activate.call(this)},autosubmit:function(){}}),e.defaults=t.extend({},t.fn.editabletypes.date.defaults,{tpl:'
',inputclass:"input-small",datepicker:{weekStart:0,startView:0,minViewMode:0,autoclose:!0}}),t.fn.editabletypes.datefield=e})(window.jQuery),(i=>{function n(t){this.init("datetime",t,n.defaults),this.initPicker(t,n.defaults)}i.fn.editableutils.inherit(n,i.fn.editabletypes.abstractinput),i.extend(n.prototype,{initPicker:function(t,e){this.options.viewformat||(this.options.viewformat=this.options.format),t.datetimepicker=i.fn.editableutils.tryParseJson(t.datetimepicker,!0),this.options.datetimepicker=i.extend({},e.datetimepicker,t.datetimepicker,{format:this.options.viewformat}),this.options.datetimepicker.language=this.options.datetimepicker.language||"en",this.dpg=i.fn.datetimepicker.DPGlobal,this.parsedFormat=this.dpg.parseFormat(this.options.format,this.options.formatType),this.parsedViewFormat=this.dpg.parseFormat(this.options.viewformat,this.options.formatType)},render:function(){this.$input.datetimepicker(this.options.datetimepicker),this.$input.on("changeMode",function(t){var e=i(this).closest("form").parent();setTimeout(function(){e.triggerHandler("resize")},0)}),this.options.clear&&(this.$clear=i('
').html(this.options.clear).click(i.proxy(function(t){t.preventDefault(),t.stopPropagation(),this.clear()},this)),this.$tpl.parent().append(i('
').append(this.$clear)))},value2html:function(t,e){t=t?this.dpg.formatDate(this.toUTC(t),this.parsedViewFormat,this.options.datetimepicker.language,this.options.formatType):"";if(!e)return t;n.superclass.value2html.call(this,t,e)},html2value:function(t){t=this.parseDate(t,this.parsedViewFormat);return t?this.fromUTC(t):null},value2str:function(t){return t?this.dpg.formatDate(this.toUTC(t),this.parsedFormat,this.options.datetimepicker.language,this.options.formatType):""},str2value:function(t){t=this.parseDate(t,this.parsedFormat);return t?this.fromUTC(t):null},value2submit:function(t){return this.value2str(t)},value2input:function(t){t&&this.$input.data("datetimepicker").setDate(t)},input2value:function(){var t=this.$input.data("datetimepicker");return t.date?t.getDate():null},activate:function(){},clear:function(){this.$input.data("datetimepicker").date=null,this.$input.find(".active").removeClass("active"),this.options.showbuttons||this.$input.closest("form").submit()},autosubmit:function(){this.$input.on("mouseup",".minute",function(t){var e=i(this).closest("form");setTimeout(function(){e.submit()},200)})},toUTC:function(t){return t&&new Date(t.valueOf()-6e4*t.getTimezoneOffset())},fromUTC:function(t){return t&&new Date(t.valueOf()+6e4*t.getTimezoneOffset())},parseDate:function(t,e){var i=null;return i=t&&(i=this.dpg.parseDate(t,e,this.options.datetimepicker.language,this.options.formatType),"string"==typeof t)&&t!==this.dpg.formatDate(i,e,this.options.datetimepicker.language,this.options.formatType)?null:i}}),n.defaults=i.extend({},i.fn.editabletypes.abstractinput.defaults,{tpl:'
',inputclass:null,format:"yyyy-mm-dd hh:ii",formatType:"standard",viewformat:null,datetimepicker:{todayHighlight:!1,autoclose:!1},clear:"× clear"}),i.fn.editabletypes.datetime=n})(window.jQuery),(t=>{function e(t){this.init("datetimefield",t,e.defaults),this.initPicker(t,e.defaults)}t.fn.editableutils.inherit(e,t.fn.editabletypes.datetime),t.extend(e.prototype,{render:function(){this.$input=this.$tpl.find("input"),this.setClass(),this.setAttr("placeholder"),this.$tpl.datetimepicker(this.options.datetimepicker),this.$input.off("focus keydown"),this.$input.keyup(t.proxy(function(){this.$tpl.removeData("date"),this.$tpl.datetimepicker("update")},this))},value2input:function(t){this.$input.val(this.value2html(t)),this.$tpl.datetimepicker("update")},input2value:function(){return this.html2value(this.$input.val())},activate:function(){t.fn.editabletypes.text.prototype.activate.call(this)},autosubmit:function(){}}),e.defaults=t.extend({},t.fn.editabletypes.datetime.defaults,{tpl:'
',inputclass:"input-medium",datetimepicker:{todayHighlight:!1,autoclose:!0}}),t.fn.editabletypes.datetimefield=e})(window.jQuery);
\ No newline at end of file
diff --git a/dist/jquery-editable/css/jquery-editable.css b/dist/jquery-editable/css/jquery-editable.css
index dfd3886..079bf30 100644
--- a/dist/jquery-editable/css/jquery-editable.css
+++ b/dist/jquery-editable/css/jquery-editable.css
@@ -1,4 +1,4 @@
-/*! X-editable - v1.5.2
+/*! X-editable-bs5 - v1.5.2
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
diff --git a/dist/jquery-editable/js/jquery-editable-poshytip.js b/dist/jquery-editable/js/jquery-editable-poshytip.js
index 190e3c9..cde8faa 100644
--- a/dist/jquery-editable/js/jquery-editable-poshytip.js
+++ b/dist/jquery-editable/js/jquery-editable-poshytip.js
@@ -1,4 +1,4 @@
-/*! X-editable - v1.5.2
+/*! X-editable-bs5 - v1.5.2
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -1540,16 +1540,15 @@ Makes editable any HTML element on the page. Applied as jQuery method.
e.preventDefault();
}
- //stop propagation not required because in document click handler it checks event target
- //e.stopPropagation();
+ //stop propagation to prevent interference with other click handlers
+ e.stopPropagation();
if(this.options.toggle === 'mouseenter') {
//for hover only show container
this.show();
} else {
- //when toggle='click' we should not close all other containers as they will be closed automatically in document click listener
- var closeAll = (this.options.toggle !== 'click');
- this.toggle(closeAll);
+ //always close other containers when opening a new one
+ this.toggle(true);
}
}, this));
} else {
@@ -3601,23 +3600,20 @@ Time
}(window.jQuery));
/**
-Select2 input. Based on amazing work of Igor Vaynberg https://github.com/ivaynberg/select2.
-Please see [original select2 docs](http://ivaynberg.github.com/select2) for detailed description and options.
+Select2 input. Based on amazing work of Igor Vaynberg https://github.com/select2/select2.
+Please see [Select2 docs](https://select2.org/) for detailed description and options.
-You should manually download and include select2 distributive:
+You should manually download and include Select2 v4.x distributive:
-
-
+
+
-To make it **bootstrap-styled** you can use css from [here](https://github.com/t0m/select2-bootstrap-css):
+To make it **bootstrap-styled** you can use css from [select2-bootstrap-5-theme](https://github.com/apalfrey/select2-bootstrap-5-theme):
-
-
-**Note:** currently `autotext` feature does not work for select2 with `ajax` remote source.
-You need initially put both `data-value` and element's text youself:
-
-
Text1
+
+**Note:** This version requires Select2 v4.x. For remote sources, you may need to provide custom
+`templateResult` and `templateSelection` functions.
@class select2
@extends abstractinput
@@ -3646,36 +3642,40 @@ $(function(){
minimumInputLength: 1
}
});
- //remote source (advanced)
+ //remote source (advanced) - Select2 v4.x format
$('#country').editable({
select2: {
placeholder: 'Select Country',
allowClear: true,
minimumInputLength: 3,
- id: function (item) {
- return item.CountryId;
- },
ajax: {
url: '/getCountries',
dataType: 'json',
- data: function (term, page) {
- return { query: term };
+ delay: 250,
+ data: function (params) {
+ return {
+ query: params.term,
+ page: params.page
+ };
},
- results: function (data, page) {
- return { results: data };
- }
+ processResults: function (data, params) {
+ return {
+ results: data.map(function(item) {
+ return {
+ id: item.CountryId,
+ text: item.CountryName
+ };
+ })
+ };
+ },
+ cache: true
},
- formatResult: function (item) {
- return item.CountryName;
+ templateResult: function (item) {
+ return item.text || item.CountryName;
},
- formatSelection: function (item) {
- return item.CountryName;
- },
- initSelection: function (element, callback) {
- return $.get('/getCountryById', { query: element.val() }, function (data) {
- callback(data);
- });
- }
+ templateSelection: function (item) {
+ return item.text || item.CountryName;
+ }
}
});
});
@@ -3706,12 +3706,19 @@ $(function(){
if (typeof source === 'string') {
options.select2.ajax = options.select2.ajax || {};
- //some default ajax params
+ //default ajax params for Select2 v4.x
if(!options.select2.ajax.data) {
- options.select2.ajax.data = function(term) {return { query:term };};
+ options.select2.ajax.data = function(params) {
+ return {
+ query: params.term,
+ page: params.page
+ };
+ };
}
- if(!options.select2.ajax.results) {
- options.select2.ajax.results = function(data) { return {results:data };};
+ if(!options.select2.ajax.processResults) {
+ options.select2.ajax.processResults = function(data) {
+ return {results: data };
+ };
}
options.select2.ajax.url = source;
} else {
@@ -3728,16 +3735,8 @@ $(function(){
this.isMultiple = this.options.select2.tags || this.options.select2.multiple;
this.isRemote = ('ajax' in this.options.select2);
- //store function returning ID of item
- //should be here as used inautotext for local source
- this.idFunc = this.options.select2.id;
- if (typeof(this.idFunc) !== "function") {
- var idKey = this.idFunc || 'id';
- this.idFunc = function (e) { return e[idKey]; };
- }
-
//store function that renders text in select2
- this.formatSelection = this.options.select2.formatSelection;
+ this.formatSelection = this.options.select2.templateSelection;
if (typeof(this.formatSelection) !== "function") {
this.formatSelection = function (e) { return e.text; };
}
@@ -3748,20 +3747,8 @@ $(function(){
$.extend(Constructor.prototype, {
render: function() {
this.setClass();
-
- //can not apply select2 here as it calls initSelection
- //over input that does not have correct value yet.
- //apply select2 only in value2input
- //this.$input.select2(this.options.select2);
-
- //when data is loaded via ajax, we need to know when it's done to populate listData
- if(this.isRemote) {
- //listen to loaded event to populate data
- this.$input.on('select2-loaded', $.proxy(function(e) {
- this.sourceData = e.items.results;
- }, this));
- }
-
+
+
//trigger resize of editableform to re-position container in multi-valued mode
if(this.isMultiple) {
this.$input.on('change', function() {
@@ -3770,15 +3757,33 @@ $(function(){
}
},
+ autosubmit: function() {
+ var self = this;
+ var submitting = false;
+
+ // Use Select2 v4.x events for autosubmit - avoid double submissions
+ this.$input.on('select2:select select2:unselect', $.proxy(function(e){
+ if (!submitting) {
+ submitting = true;
+ setTimeout(function() {
+ $(self.$input).closest('form').submit();
+ submitting = false;
+ }, 100);
+ }
+ }, this));
+ },
+
value2html: function(value, element) {
var text = '', data,
that = this;
- if(this.options.select2.tags) { //in tags mode just assign value
+ // Use stored selected data if available (for visual display after selection)
+ if(this.selectedData && this.selectedData.length > 0) {
+ data = this.selectedData;
+ } else if(this.options.select2.tags) { //in tags mode just assign value
data = value;
- //data = $.fn.editableutils.itemsByValue(value, this.options.select2.tags, this.idFunc);
} else if(this.sourceData) {
- data = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc);
+ data = $.fn.editableutils.itemsByValue(value, this.sourceData, function(e) { return e.id; });
} else {
//can not get list of possible values
//(e.g. autotext for select2 with ajax source)
@@ -3797,7 +3802,6 @@ $(function(){
text = Array.isArray(text) ? text.join(this.options.viewseparator) : text;
- //$(element).text(text);
Constructor.superclass.value2html.call(this, text, element);
},
@@ -3806,45 +3810,90 @@ $(function(){
},
value2input: function(value) {
+
// if value array => join it anyway
if(Array.isArray(value)) {
value = value.join(this.getSeparator());
}
- //for remote source just set value, text is updated by initSelection
+ // For remote sources with existing value, create option element before Select2 init
+ if(this.isRemote && !this.isMultiple && value) {
+ var $el = $(this.options.scope);
+ if (!$el.data('editable').isEmpty) {
+ var text = $el.text();
+ var $option = new Option(text, value, true, true);
+ this.$input.append($option);
+ }
+ }
+
+ //initialize select2 if not already done
if(!this.$input.data('select2')) {
this.$input.val(value);
this.$input.select2(this.options.select2);
- } else {
- //second argument needed to separate initial change from user's click (for autosubmit)
- this.$input.val(value).trigger('change', true);
-
- //Uncaught Error: cannot call val() if initSelection() is not defined
- //this.$input.select2('val', value);
- }
-
- // if defined remote source AND no multiple mode AND no user's initSelection provided -->
- // we should somehow get text for provided id.
- // The solution is to use element's text as text for that id (exclude empty)
- if(this.isRemote && !this.isMultiple && !this.options.select2.initSelection) {
- // customId and customText are methods to extract `id` and `text` from data object
- // we can use this workaround only if user did not define these methods
- // otherwise we cant construct data object
- var customId = this.options.select2.id,
- customText = this.options.select2.formatSelection;
-
- if(!customId && !customText) {
- var $el = $(this.options.scope);
- if (!$el.data('editable').isEmpty) {
- var data = {id: value, text: $el.text()};
- this.$input.select2('data', data);
+
+ // Set up minimal event handling AFTER initialization
+ this.$input.on('select2:select', $.proxy(function(e) {
+
+ if (e.params && e.params.data) {
+ var selectedData = e.params.data;
+ this.selectedData = [selectedData];
+
+ // Fix Select2's visual display by ensuring the option exists and is selected
+ var $existingOption = this.$input.find('option[value="' + selectedData.id + '"]');
+ if ($existingOption.length === 0) {
+ // Create the option if it doesn't exist
+ var $option = $('
')
+ .attr('value', selectedData.id)
+ .text(selectedData.text)
+ .prop('selected', true);
+ this.$input.append($option);
+ } else {
+ // Make sure existing option is selected
+ $existingOption.prop('selected', true);
+ }
+
+ // Force Select2 to update its display
+ this.$input.trigger('change.select2');
+
+ // Mark that a selection was just made (for blur handling)
+ this._justSelected = true;
}
- }
+ }, this));
+
+ this.$input.on('select2:unselect', $.proxy(function(e) {
+ this.selectedData = [];
+ }, this));
+
+ // Ensure Select2 doesn't interfere with x-editable's document click handling
+ // by making sure clicks on Select2 elements don't stop propagation
+ this.$input.on('select2:open', $.proxy(function(e) {
+ // Find the Select2 dropdown container and ensure it allows document clicks to propagate
+ setTimeout(function() {
+ $('.select2-container--open .select2-dropdown').off('click.editable-prevent-close');
+ $('.select2-container--open .select2-results').off('click.editable-prevent-close');
+ }, 10);
+ }, this));
+
+
+
+ } else {
+ //update value on existing select2
+ this.$input.val(value).trigger('change.select2');
}
},
input2value: function() {
- return this.$input.select2('val');
+ var val = this.$input.val();
+
+ // For Select2 v4.x, ensure we get the actual selected value
+ if (this.$input.data('select2')) {
+ var selectedData = this.$input.select2('data');
+ if (selectedData && selectedData.length > 0) {
+ val = this.isMultiple ? selectedData.map(function(item) { return item.id; }) : selectedData[0].id;
+ }
+ }
+
+ return val;
},
str2value: function(str, separator) {
@@ -3867,16 +3916,10 @@ $(function(){
return val;
},
- autosubmit: function() {
- this.$input.on('change', function(e, isInitial){
- if(!isInitial) {
- $(this).closest('form').submit();
- }
- });
- },
getSeparator: function() {
- return this.options.select2.separator || $.fn.select2.defaults.separator;
+ // Select2 v4.x uses different separator handling
+ return this.options.select2.separator || ',';
},
/*
@@ -3912,7 +3955,7 @@ $(function(){
**/
tpl:'
',
/**
- Configuration of select2. [Full list of options](http://ivaynberg.github.com/select2).
+ Configuration of select2. [Full list of options](https://select2.org/configuration).
@property select2
@type object
@@ -3950,7 +3993,6 @@ $(function(){
$.fn.editabletypes.select2 = Constructor;
}(window.jQuery));
-
/**
* Combodate - 1.0.5
* Dropdown date and time picker.
diff --git a/dist/jquery-editable/js/jquery-editable-poshytip.min.js b/dist/jquery-editable/js/jquery-editable-poshytip.min.js
index 96d8784..5b8311a 100644
--- a/dist/jquery-editable/js/jquery-editable-poshytip.min.js
+++ b/dist/jquery-editable/js/jquery-editable-poshytip.min.js
@@ -1,5 +1,5 @@
-/*! X-editable - v1.5.2
+/*! X-editable-bs5 - v1.5.2
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
-(o=>{function n(t,e){this.options=o.extend({},o.fn.editableform.defaults,e),this.$div=o(t),this.options.scope||(this.options.scope=this)}n.prototype={constructor:n,initInput:function(){this.input=this.options.input,this.value=this.input.str2value(this.options.value),this.input.prerender()},initTemplate:function(){this.$form=o(o.fn.editableform.template)},initButtons:function(){var t=this.$form.find(".editable-buttons");t.append(o.fn.editableform.buttons),"bottom"===this.options.showbuttons&&t.addClass("editable-buttons-bottom")},render:function(){this.$loading=o(o.fn.editableform.loading),this.$div.empty().append(this.$loading),this.initTemplate(),this.options.showbuttons?this.initButtons():this.$form.find(".editable-buttons").remove(),this.showLoading(),this.isSaving=!1,this.$div.triggerHandler("rendering"),this.initInput(),this.$form.find("div.editable-input").append(this.input.$tpl),this.$div.append(this.$form),o.when(this.input.render()).then(o.proxy(function(){var t;this.options.showbuttons||this.input.autosubmit(),this.$form.find(".editable-cancel").click(o.proxy(this.cancel,this)),this.input.error?(this.error(this.input.error),this.$form.find(".editable-submit").attr("disabled",!0),this.input.$input.attr("disabled",!0),this.$form.submit(function(t){t.preventDefault()})):(this.error(!1),this.input.$input.removeAttr("disabled"),this.$form.find(".editable-submit").removeAttr("disabled"),t=null==this.value||""===this.value?this.options.defaultValue:this.value,this.input.value2input(t),this.$form.submit(o.proxy(this.submit,this))),this.$div.triggerHandler("rendered"),this.showForm(),this.input.postrender&&this.input.postrender()},this))},cancel:function(){this.$div.triggerHandler("cancel")},showLoading:function(){var t,e;this.$form?(t=this.$form.outerWidth(),e=this.$form.outerHeight(),t&&this.$loading.width(t),e&&this.$loading.height(e),this.$form.hide()):(t=this.$loading.parent().width())&&this.$loading.width(t),this.$loading.show()},showForm:function(t){this.$loading.hide(),this.$form.show(),!1!==t&&this.input.activate(),this.$div.triggerHandler("show")},error:function(t){var e=this.$form.find(".control-group"),i=this.$form.find(".editable-error-block");if(!1===t)e.removeClass(o.fn.editableform.errorGroupClass),i.removeClass(o.fn.editableform.errorBlockClass).empty().hide();else{if(t){for(var s=(""+t).split("\n"),n=0;n
").text(s[n]).html();t=s.join("
")}e.addClass(o.fn.editableform.errorGroupClass),i.addClass(o.fn.editableform.errorBlockClass).html(t).show()}},submit:function(t){t.stopPropagation(),t.preventDefault();var i,s=this.input.input2value(),t=this.validate(s);if("object"===o.type(t)&&void 0!==t.newValue){if(s=t.newValue,this.input.value2input(s),"string"==typeof t.msg)return this.error(t.msg),void this.showForm()}else if(t)return this.error(t),void this.showForm();this.options.savenochange||this.input.value2str(s)!=this.input.value2str(this.value)?(i=this.input.value2submit(s),this.isSaving=!0,o.when(this.save(i)).done(o.proxy(function(t){this.isSaving=!1;var e="function"==typeof this.options.success?this.options.success.call(this.options.scope,t,s):null;!1===e?(this.error(!1),this.showForm(!1)):"string"==typeof e?(this.error(e),this.showForm()):(e&&"object"==typeof e&&e.hasOwnProperty("newValue")&&(s=e.newValue),this.error(!1),this.value=s,this.$div.triggerHandler("save",{newValue:s,submitValue:i,response:t}))},this)).fail(o.proxy(function(t){this.isSaving=!1,t="function"==typeof this.options.error?this.options.error.call(this.options.scope,t,s):"string"==typeof t?t:t.responseText||t.statusText||"Unknown error!",this.error(t),this.showForm()},this))):this.$div.triggerHandler("nochange")},save:function(t){this.options.pk=o.fn.editableutils.tryParseJson(this.options.pk,!0);var e="function"==typeof this.options.pk?this.options.pk.call(this.options.scope):this.options.pk;if(!!("function"==typeof this.options.url||this.options.url&&("always"===this.options.send||"auto"===this.options.send&&null!=e)))return this.showLoading(),t={name:this.options.name||"",value:t,pk:e},"function"==typeof this.options.params?t=this.options.params.call(this.options.scope,t):(this.options.params=o.fn.editableutils.tryParseJson(this.options.params,!0),o.extend(t,this.options.params)),"function"==typeof this.options.url?this.options.url.call(this.options.scope,t):o.ajax(o.extend({url:this.options.url,data:t,type:"POST"},this.options.ajaxOptions))},validate:function(t){if(void 0===t&&(t=this.value),"function"==typeof this.options.validate)return this.options.validate.call(this.options.scope,t)},option:function(t,e){t in this.options&&(this.options[t]=e),"value"===t&&this.setValue(e)},setValue:function(t,e){this.value=e?this.input.str2value(t):t,this.$form&&this.$form.is(":visible")&&this.input.value2input(this.value)}},o.fn.editableform=function(i){var s=arguments;return this.each(function(){var t=o(this),e=t.data("editableform");e||t.data("editableform",e=new n(this,"object"==typeof i&&i)),"string"==typeof i&&e[i].apply(e,Array.prototype.slice.call(s,1))})},o.fn.editableform.Constructor=n,o.fn.editableform.defaults={type:"text",url:null,params:null,name:null,pk:null,value:null,defaultValue:null,send:"auto",validate:null,success:null,error:null,ajaxOptions:null,showbuttons:!0,scope:null,savenochange:!1},o.fn.editableform.template='',o.fn.editableform.loading='',o.fn.editableform.buttons='',o.fn.editableform.errorGroupClass=null,o.fn.editableform.errorBlockClass="editable-error",o.fn.editableform.engine="jquery"})(window.jQuery),(l=>{l.fn.editableutils={inherit:function(t,e){function i(){}i.prototype=e.prototype,t.prototype=new i,(t.prototype.constructor=t).superclass=e.prototype},setCursorPosition:function(t,e){t.setSelectionRange?t.setSelectionRange(e,e):t.createTextRange&&((t=t.createTextRange()).collapse(!0),t.moveEnd("character",e),t.moveStart("character",e),t.select())},tryParseJson:function(t,e){if("string"==typeof t&&t.length&&t.match(/^[\{\[].*[\}\]]$/))if(e)try{t=new Function("return "+t)()}catch(t){}finally{return t}else t=new Function("return "+t)();return t},sliceObj:function(t,e,i){var s,n,o={};if(Array.isArray(e)&&e.length)for(var a=0;a").text(t).html()},itemsByValue:function(s,t,n){var e,o,a,r;return t&&null!==s?("function"!=typeof n&&(e=n||"value",n=function(t){return t[e]}),o=Array.isArray(s),a=[],r=this,l.each(t,function(t,e){var i;e.children?a=a.concat(r.itemsByValue(s,e.children,n)):o?l.grep(s,function(t){return t==(e&&"object"==typeof e?n(e):e)}).length&&a.push(e):(i=e&&"object"==typeof e?n(e):e,s==i&&a.push(e))}),a):[]},createInput:function(t){var e,i=t.type;return"date"===i&&("inline"===t.mode?l.fn.editabletypes.datefield?i="datefield":l.fn.editabletypes.dateuifield&&(i="dateuifield"):l.fn.editabletypes.date?i="date":l.fn.editabletypes.dateui&&(i="dateui"),"date"!==i||l.fn.editabletypes.date||(i="combodate")),"wysihtml5"!==(i="datetime"===i&&"inline"===t.mode?"datetimefield":i)||l.fn.editabletypes[i]||(i="textarea"),"function"==typeof l.fn.editabletypes[i]?new(e=l.fn.editabletypes[i])(this.sliceObj(t,this.objectKeys(e.defaults))):(l.error("Unknown type: "+i),!1)},supportsTransitions:function(){var t=(document.body||document.documentElement).style,e=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof t[i="transition"])return!0;for(var i=i.charAt(0).toUpperCase()+i.substr(1),s=0;s{function l(t,e){this.init(t,e)}function h(t,e){this.init(t,e)}l.prototype={containerName:null,containerDataName:null,innerCss:null,containerClass:"editable-container editable-popup",defaults:{},init:function(t,e){this.$element=r(t),this.options=r.extend({},r.fn.editableContainer.defaults,e),this.splitOptions(),this.formOptions.scope=this.$element[0],this.initContainer(),this.delayedHide=!1,this.$element.on("destroyed",r.proxy(function(){this.destroy()},this)),r(document).data("editable-handlers-attached")||(r(document).on("keyup.editable",function(t){27===t.which&&r(".editable-open").editableContainer("hide","cancel")}),r(document).on("click.editable",function(t){var e,i=r(t.target),s=[".editable-container",".ui-datepicker-header",".datepicker",".modal-backdrop",".bootstrap-wysihtml5-insert-image-modal",".bootstrap-wysihtml5-insert-link-modal"];if(!r(".select2-drop-mask").is(":visible")&&r.contains(document.documentElement,t.target)&&!i.is(document)){for(e=0;e"),(this.tip().is(this.innerCss)?this.tip():this.tip().find(this.innerCss)).append(this.$form),this.renderForm()},hide:function(t){this.tip()&&this.tip().is(":visible")&&this.$element.hasClass("editable-open")&&(this.$form.data("editableform").isSaving?this.delayedHide={reason:t}:(this.delayedHide=!1,this.$element.removeClass("editable-open"),this.innerHide(),this.$element.triggerHandler("hidden",t||"manual")))},innerShow:function(){},innerHide:function(){},toggle:function(t){this.container()&&this.tip()&&this.tip().is(":visible")?this.hide():this.show(t)},setPosition:function(){},save:function(t,e){this.$element.triggerHandler("save",e),this.hide("save")},option:function(t,e){this.options[t]=e,t in this.containerOptions?(this.containerOptions[t]=e,this.setContainerOption(t,e)):(this.formOptions[t]=e,this.$form&&this.$form.editableform("option",t,e))},setContainerOption:function(t,e){this.call("option",t,e)},destroy:function(){this.hide(),this.innerDestroy(),this.$element.off("destroyed"),this.$element.removeData("editableContainer")},innerDestroy:function(){},closeOthers:function(s){r(".editable-open").each(function(t,e){var i;e===s||r(e).find(s).length||(i=(e=r(e)).data("editableContainer"))&&("cancel"===i.options.onblur?e.data("editableContainer").hide("onblur"):"submit"===i.options.onblur&&e.data("editableContainer").tip().find("form").submit())})},activate:function(){this.tip&&this.tip().is(":visible")&&this.$form&&this.$form.data("editableform").input.activate()}},r.fn.editableContainer=function(o){var a=arguments;return this.each(function(){var t=r(this),e="editableContainer",i=t.data(e),s="object"==typeof o&&o,n="inline"===s.mode?h:l;i||t.data(e,i=new n(this,s)),"string"==typeof o&&i[o].apply(i,Array.prototype.slice.call(a,1))})},r.fn.editableContainer.Popup=l,r.fn.editableContainer.Inline=h,r.fn.editableContainer.defaults={value:null,placement:"top",autohide:!0,onblur:"cancel",anim:!1,mode:"popup"},jQuery.event.special.destroyed={remove:function(t){t.handler&&t.handler()}}})(window.jQuery),(t=>{t.extend(t.fn.editableContainer.Inline.prototype,t.fn.editableContainer.Popup.prototype,{containerName:"editableform",innerCss:".editable-inline",containerClass:"editable-container editable-inline",initContainer:function(){this.$tip=t(""),this.options.anim||(this.options.anim=0)},splitOptions:function(){this.containerOptions={},this.formOptions=this.options},tip:function(){return this.$tip},innerShow:function(){this.$element.hide(),this.tip().insertAfter(this.$element).show()},innerHide:function(){this.$tip.hide(this.options.anim,t.proxy(function(){this.$element.show(),this.innerDestroy()},this))},innerDestroy:function(){this.tip()&&this.tip().empty().remove()}})})(window.jQuery),(u=>{function p(t,e){this.$element=u(t),this.options=u.extend({},u.fn.editable.defaults,e,u.fn.editableutils.getConfigData(this.$element)),this.options.selector?this.initLive():this.init(),this.options.highlight&&!u.fn.editableutils.supportsTransitions()&&(this.options.highlight=!1)}p.prototype={constructor:p,init:function(){var t,e=!1;if(this.options.name=this.options.name||this.$element.attr("id"),this.options.scope=this.$element[0],this.input=u.fn.editableutils.createInput(this.options),this.input){switch(null==this.options.value?(this.value=this.input.html2value(this.$element.html().trim()),e=!0):(this.options.value=u.fn.editableutils.tryParseJson(this.options.value,!0),"string"==typeof this.options.value?this.value=this.input.str2value(this.options.value):this.value=this.options.value),this.$element.addClass("editable"),"textarea"===this.input.type&&this.$element.addClass("editable-pre-wrapped"),"manual"!==this.options.toggle?(this.$element.addClass("editable-click"),this.$element.on(this.options.toggle+".editable",u.proxy(function(t){this.options.disabled||t.preventDefault(),"mouseenter"===this.options.toggle?this.show():(t="click"!==this.options.toggle,this.toggle(t))},this))):this.$element.attr("tabindex",-1),"function"==typeof this.options.display&&(this.options.autotext="always"),this.options.autotext){case"always":t=!0;break;case"auto":t=!this.$element.text().trim().length&&null!=this.value&&!e;break;default:t=!1}u.when(!t||this.render()).then(u.proxy(function(){this.options.disabled?this.disable():this.enable(),this.$element.triggerHandler("init",this)},this))}},initLive:function(){var t=this.options.selector;this.options.selector=!1,this.options.autotext="never",this.$element.on(this.options.toggle+".editable",t,u.proxy(function(t){var e=u(t.target);e.data("editable")||(e.hasClass(this.options.emptyclass)&&e.empty(),e.editable(this.options).trigger(t))},this))},render:function(t){if(!1!==this.options.display)return this.input.value2htmlFinal?this.input.value2html(this.value,this.$element[0],this.options.display,t):"function"==typeof this.options.display?this.options.display.call(this.$element[0],this.value,t):this.input.value2html(this.value,this.$element[0])},enable:function(){this.options.disabled=!1,this.$element.removeClass("editable-disabled"),this.handleEmpty(this.isEmpty),"manual"!==this.options.toggle&&"-1"===this.$element.attr("tabindex")&&this.$element.removeAttr("tabindex")},disable:function(){this.options.disabled=!0,this.hide(),this.$element.addClass("editable-disabled"),this.handleEmpty(this.isEmpty),this.$element.attr("tabindex",-1)},toggleDisabled:function(){this.options.disabled?this.enable():this.disable()},option:function(t,e){if(t&&"object"==typeof t)u.each(t,u.proxy(function(t,e){this.option(t.triim(),e)},this));else{if(this.options[t]=e,"disabled"===t)return e?this.disable():this.enable();"value"===t&&this.setValue(e),this.container&&this.container.option(t,e),this.input.option&&this.input.option(t,e)}},handleEmpty:function(t){!1!==this.options.display&&(void 0!==t?this.isEmpty=t:"function"==typeof this.input.isEmpty?this.isEmpty=this.input.isEmpty(this.$element):this.isEmpty=""===this.$element.html().trim(),this.options.disabled?this.isEmpty&&(this.$element.empty(),this.options.emptyclass)&&this.$element.removeClass(this.options.emptyclass):this.isEmpty?(this.$element.html(this.options.emptytext),this.options.emptyclass&&this.$element.addClass(this.options.emptyclass)):this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass))},show:function(t){if(!this.options.disabled){if(this.container){if(this.container.tip().is(":visible"))return}else{var e=u.extend({},this.options,{value:this.value,input:this.input});this.$element.editableContainer(e),this.$element.on("save.internal",u.proxy(this.save,this)),this.container=this.$element.data("editableContainer")}this.container.show(t)}},hide:function(){this.container&&this.container.hide()},toggle:function(t){this.container&&this.container.tip().is(":visible")?this.hide():this.show(t)},save:function(t,e){var i,s;this.options.unsavedclass&&("function"==typeof this.options.url||!1===this.options.display||void 0!==e.response||this.options.savenochange&&this.input.value2str(this.value)!==this.input.value2str(e.newValue)?this.$element.removeClass(this.options.unsavedclass):this.$element.addClass(this.options.unsavedclass)),this.options.highlight&&(i=this.$element,s=i.css("background-color"),i.css("background-color",this.options.highlight),setTimeout(function(){"transparent"===s&&(s=""),i.css("background-color",s),i.addClass("editable-bg-transition"),setTimeout(function(){i.removeClass("editable-bg-transition")},1700)},10)),this.setValue(e.newValue,!1,e.response)},validate:function(){if("function"==typeof this.options.validate)return this.options.validate.call(this,this.value)},setValue:function(t,e,i){this.value=e?this.input.str2value(t):t,this.container&&this.container.option("value",this.value),u.when(this.render(i)).then(u.proxy(function(){this.handleEmpty()},this))},activate:function(){this.container&&this.container.activate()},destroy:function(){this.disable(),this.container&&this.container.destroy(),this.input.destroy(),"manual"!==this.options.toggle&&(this.$element.removeClass("editable-click"),this.$element.off(this.options.toggle+".editable")),this.$element.off("save.internal"),this.$element.removeClass("editable editable-open editable-disabled"),this.$element.removeData("editable")}},u.fn.editable=function(s){var i={},n=arguments,o="editable";switch(s){case"validate":return this.each(function(){var t,e=u(this).data(o);e&&(t=e.validate())&&(i[e.options.name]=t)}),i;case"getValue":return 2===arguments.length&&!0===arguments[1]?i=this.eq(0).data(o).value:this.each(function(){var t=u(this).data(o);t&&null!=t.value&&(i[t.options.name]=t.input.value2submit(t.value))}),i;case"submit":var t,e,a,r=arguments[1]||{},l=this,h=this.editable("validate");return u.isEmptyObject(h)?(a={},1===l.length?(e={name:(t=l.data("editable")).options.name||"",value:t.input.value2submit(t.value),pk:"function"==typeof t.options.pk?t.options.pk.call(t.options.scope):t.options.pk},"function"==typeof t.options.params?e=t.options.params.call(t.options.scope,e):(t.options.params=u.fn.editableutils.tryParseJson(t.options.params,!0),u.extend(e,t.options.params)),a={url:t.options.url,data:e,type:"POST"},r.success=r.success||t.options.success,r.error=r.error||t.options.error):(e=this.editable("getValue"),a={url:r.url,data:e,type:"POST"}),a.success="function"==typeof r.success?function(t){r.success.call(l,t,r)}:u.noop,a.error="function"==typeof r.error?function(){r.error.apply(l,arguments)}:u.noop,r.ajaxOptions&&u.extend(a,r.ajaxOptions),r.data&&u.extend(a.data,r.data),u.ajax(a)):"function"==typeof r.error&&r.error.call(l,h),this}return this.each(function(){var t=u(this),e=t.data(o),i="object"==typeof s&&s;i&&i.selector?e=new p(this,i):(e||t.data(o,e=new p(this,i)),"string"==typeof s&&e[s].apply(e,Array.prototype.slice.call(n,1)))})},u.fn.editable.defaults={type:"text",disabled:!1,toggle:"click",emptytext:"Empty",autotext:"auto",value:null,display:null,emptyclass:"editable-empty",unsavedclass:"editable-unsaved",selector:null,highlight:"#FFFF80"}})(window.jQuery),(s=>{function t(){}s.fn.editabletypes={},t.prototype={init:function(t,e,i){this.type=t,this.options=s.extend({},i,e)},prerender:function(){this.$tpl=s(this.options.tpl),this.$input=this.$tpl,this.$clear=null,this.error=null},render:function(){},value2html:function(t,e){s(e)[this.options.escape?"text":"html"](t.trim())},html2value:function(t){return s("").html(t).text()},value2str:function(t){return t},str2value:function(t){return t},value2submit:function(t){return t},value2input:function(t){this.$input.val(t)},input2value:function(){return this.$input.val()},activate:function(){this.$input.is(":visible")&&this.$input.focus()},clear:function(){this.$input.val(null)},escape:function(t){return s("
").text(t).html()},autosubmit:function(){},destroy:function(){},setClass:function(){this.options.inputclass&&this.$input.addClass(this.options.inputclass)},setAttr:function(t){null!=this.options[t]&&this.$input.attr(t,this.options[t])},option:function(t,e){this.options[t]=e}},t.defaults={tpl:"",inputclass:null,escape:!0,scope:null,showbuttons:!0},s.extend(s.fn.editabletypes,{abstractinput:t})})(window.jQuery),(r=>{function t(t){}r.fn.editableutils.inherit(t,r.fn.editabletypes.abstractinput),r.extend(t.prototype,{render:function(){var t=r.Deferred();return this.error=null,this.onSourceReady(function(){this.renderList(),t.resolve()},function(){this.error=this.options.sourceError,t.resolve()}),t.promise()},html2value:function(t){return null},value2html:function(t,e,i,s){function n(){"function"==typeof i?i.call(e,t,this.sourceData,s):this.value2htmlFinal(t,e),o.resolve()}var o=r.Deferred();return null===t?n.call(this):this.onSourceReady(n,function(){o.resolve()}),o.promise()},onSourceReady:function(e,i){var t;if("function"==typeof this.options.source?(t=this.options.source.call(this.options.scope),this.sourceData=null):t=this.options.source,this.options.sourceCache&&Array.isArray(this.sourceData))e.call(this);else{try{t=r.fn.editableutils.tryParseJson(t,!1)}catch(t){return void i.call(this)}if("string"==typeof t){if(this.options.sourceCache){var s,n=t;if(r(document).data(n)||r(document).data(n,{}),!1===(s=r(document).data(n)).loading&&s.sourceData)return this.sourceData=s.sourceData,this.doPrepend(),void e.call(this);if(!0===s.loading)return s.callbacks.push(r.proxy(function(){this.sourceData=s.sourceData,this.doPrepend(),e.call(this)},this)),void s.err_callbacks.push(r.proxy(i,this));s.loading=!0,s.callbacks=[],s.err_callbacks=[]}n=r.extend({url:t,type:"get",cache:!1,dataType:"json",success:r.proxy(function(t){s&&(s.loading=!1),this.sourceData=this.makeArray(t),Array.isArray(this.sourceData)?(s&&(s.sourceData=this.sourceData,r.each(s.callbacks,function(){this.call()})),this.doPrepend(),e.call(this)):(i.call(this),s&&r.each(s.err_callbacks,function(){this.call()}))},this),error:r.proxy(function(){i.call(this),s&&(s.loading=!1,r.each(s.err_callbacks,function(){this.call()}))},this)},this.options.sourceOptions);r.ajax(n)}else this.sourceData=this.makeArray(t),(Array.isArray(this.sourceData)?(this.doPrepend(),e):i).call(this)}},doPrepend:function(){null!=this.options.prepend&&(Array.isArray(this.prependData)||("function"==typeof this.options.prepend&&(this.options.prepend=this.options.prepend.call(this.options.scope)),this.options.prepend=r.fn.editableutils.tryParseJson(this.options.prepend,!0),"string"==typeof this.options.prepend&&(this.options.prepend={"":this.options.prepend}),this.prependData=this.makeArray(this.options.prepend)),Array.isArray(this.prependData))&&Array.isArray(this.sourceData)&&(this.sourceData=this.prependData.concat(this.sourceData))},renderList:function(){},value2htmlFinal:function(t,e){},makeArray:function(t){var i,s,e,n=[];if(!t||"string"==typeof t)return null;if(Array.isArray(t))for(var o=function(t,e){if(s={value:t,text:e},2<=i++)return!1},a=0;a
{function e(t){this.init("text",t,e.defaults)}i.fn.editableutils.inherit(e,i.fn.editabletypes.abstractinput),i.extend(e.prototype,{render:function(){this.renderClear(),this.setClass(),this.setAttr("placeholder")},activate:function(){this.$input.is(":visible")&&(this.$input.focus(),i.fn.editableutils.setCursorPosition(this.$input.get(0),this.$input.val().length),this.toggleClear)&&this.toggleClear()},renderClear:function(){this.options.clear&&(this.$clear=i(''),this.$input.after(this.$clear).css("padding-right",24).keyup(i.proxy(function(t){var e;~i.inArray(t.keyCode,[40,38,9,13,27])||(clearTimeout(this.t),(e=this).t=setTimeout(function(){e.toggleClear(t)},100))},this)).parent().css("position","relative"),this.$clear.click(i.proxy(this.clear,this)))},postrender:function(){},toggleClear:function(t){var e,i;this.$clear&&(e=this.$input.val().length,i=this.$clear.is(":visible"),e&&!i&&this.$clear.show(),!e)&&i&&this.$clear.hide()},clear:function(){this.$clear.hide(),this.$input.val("").focus()}}),e.defaults=i.extend({},i.fn.editabletypes.abstractinput.defaults,{tpl:'',placeholder:null,clear:!0}),i.fn.editabletypes.text=e})(window.jQuery),(e=>{function i(t){this.init("textarea",t,i.defaults)}e.fn.editableutils.inherit(i,e.fn.editabletypes.abstractinput),e.extend(i.prototype,{render:function(){this.setClass(),this.setAttr("placeholder"),this.setAttr("rows"),this.$input.keydown(function(t){t.ctrlKey&&13===t.which&&e(this).closest("form").submit()})},activate:function(){e.fn.editabletypes.text.prototype.activate.call(this)}}),i.defaults=e.extend({},e.fn.editabletypes.abstractinput.defaults,{tpl:"",inputclass:"input-large",placeholder:null,rows:7}),e.fn.editabletypes.textarea=i})(window.jQuery),(o=>{function e(t){this.init("select",t,e.defaults)}o.fn.editableutils.inherit(e,o.fn.editabletypes.list),o.extend(e.prototype,{renderList:function(){this.$input.empty();var n=function(t,e){var i;if(Array.isArray(e))for(var s=0;s",i),e[s].children))):(i.value=e[s].value,e[s].disabled&&(i.disabled=!0),t.append(o("