added a datepicker fix

This commit is contained in:
Micha
2025-11-04 16:05:37 +01:00
parent b87ac53dc8
commit 71ee0d9b72
18 changed files with 169 additions and 117 deletions

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.4
/*! X-editable-bootstrap5 - v1.5.5
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.4
/*! X-editable-bootstrap5 - v1.5.5
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -3882,19 +3882,25 @@ $(function(){
}
},
input2value: function() {
var val = this.$input.val();
input2value: function() {
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;
}
}
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
return val;
},
// --- Handle Select2 v4.x ---
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) {
if(typeof str !== 'string' || !this.isMultiple) {
@@ -5018,7 +5024,11 @@ $(function(){
},
input2value: function() {
return this.$input.data('datepicker').date;
const dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
return dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
return this.$input.val();
},
activate: function() {

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.4
/*! X-editable-bootstrap5 - v1.5.5
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.4
/*! X-editable-bootstrap5 - v1.5.5
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -3882,19 +3882,25 @@ $(function(){
}
},
input2value: function() {
var val = this.$input.val();
input2value: function() {
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;
}
}
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
return val;
},
// --- Handle Select2 v4.x ---
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) {
if(typeof str !== 'string' || !this.isMultiple) {
@@ -5086,7 +5092,11 @@ $(function(){
},
input2value: function() {
return this.$input.data('datepicker').date;
const dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
return dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
return this.$input.val();
},
activate: function() {

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.4
/*! X-editable-bootstrap5 - v1.5.5
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.4
/*! X-editable-bootstrap5 - v1.5.5
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -3882,19 +3882,25 @@ $(function(){
}
},
input2value: function() {
var val = this.$input.val();
input2value: function() {
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;
}
}
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
return val;
},
// --- Handle Select2 v4.x ---
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) {
if(typeof str !== 'string' || !this.isMultiple) {
@@ -4952,7 +4958,11 @@ $(function(){
},
input2value: function() {
return this.$input.data('datepicker').date;
const dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
return dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
return this.$input.val();
},
activate: function() {

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.4
/*! X-editable-bootstrap5 - v1.5.5
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.4
/*! X-editable-bootstrap5 - v1.5.5
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -3882,19 +3882,25 @@ $(function(){
}
},
input2value: function() {
var val = this.$input.val();
input2value: function() {
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;
}
}
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
return val;
},
// --- Handle Select2 v4.x ---
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) {
if(typeof str !== 'string' || !this.isMultiple) {

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.4
/*! X-editable-bootstrap5 - v1.5.5
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */

View File

@@ -1,4 +1,4 @@
/*! X-editable-bootstrap5 - v1.5.4
/*! X-editable-bootstrap5 - v1.5.5
* A maintained fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
@@ -3882,19 +3882,25 @@ $(function(){
}
},
input2value: function() {
var val = this.$input.val();
input2value: function() {
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;
}
}
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
return val;
},
// --- Handle Select2 v4.x ---
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) {
if(typeof str !== 'string' || !this.isMultiple) {

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,7 @@
"name": "x-editable-bootstrap5",
"title": "X-editable-bootstrap5",
"description": "A maintained fork of x-editable for Bootstrap 5 support.",
"version": "1.5.4",
"version": "1.5.5",
"homepage": "https://git.24unix.net/tracer/x-editable",
"author": {
"name": "Micha Espey",

View File

@@ -115,7 +115,11 @@ $(function(){
},
input2value: function() {
return this.$input.data('datepicker').date;
const dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
return dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
return this.$input.val();
},
activate: function() {

View File

@@ -281,19 +281,25 @@ $(function(){
}
},
input2value: function() {
var val = this.$input.val();
input2value: function() {
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;
}
}
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
return val;
},
// --- Handle Select2 v4.x ---
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) {
if(typeof str !== 'string' || !this.isMultiple) {