3 Commits

Author SHA1 Message Date
Micha
68a5cefd46 added a datepicker fix 2025-11-04 16:36:24 +01:00
Micha
51aaa130b7 added a datepicker fix 2025-11-04 16:11:53 +01:00
Micha
71ee0d9b72 added a datepicker fix 2025-11-04 16:05:37 +01:00
18 changed files with 297 additions and 157 deletions

View File

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

View File

@@ -1,5 +1,5 @@
/*! X-editable-bootstrap5 - v1.5.4
* A maintained fork of x-editable for Bootstrap 5 support.
/*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
/**
@@ -3881,20 +3881,26 @@ $(function(){
this.$input.val(value).trigger('change.select2');
}
},
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;
}
}
return val;
},
input2value: function() {
var val = this.$input.val();
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
// --- 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) {
@@ -4991,19 +4997,41 @@ $(function(){
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
}
},
value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
Date.superclass.value2html.call(this, text, element);
let text = '';
if (value) {
if (typeof value === 'string') {
text = value;
} else if (value instanceof Date && typeof value.getUTCDate === 'function') {
text = this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
}
}
// direct fallback: set text without using editableutils
if (element) {
element.textContent = text;
}
},
html2value: function(html) {
return this.parseDate(html, this.parsedViewFormat);
},
},
value2str: function(value) {
return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : '';
},
if (!value) {
return '';
}
// If value is already a string (like "2025-11-27"), just return it.
if (typeof value === 'string') {
return value;
}
// Otherwise, assume it's a Date object and format it.
return this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
},
str2value: function(str) {
return this.parseDate(str, this.parsedFormat);
@@ -5017,9 +5045,13 @@ $(function(){
this.$input.bdatepicker('update', value);
},
input2value: function() {
return this.$input.data('datepicker').date;
},
input2value: function() {
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,5 +1,5 @@
/*! X-editable-bootstrap5 - v1.5.4
* A maintained fork of x-editable for Bootstrap 5 support.
/*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
.editableform {

View File

@@ -1,5 +1,5 @@
/*! X-editable-bootstrap5 - v1.5.4
* A maintained fork of x-editable for Bootstrap 5 support.
/*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
/**
@@ -3881,20 +3881,26 @@ $(function(){
this.$input.val(value).trigger('change.select2');
}
},
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;
}
}
return val;
},
input2value: function() {
var val = this.$input.val();
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
// --- 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) {
@@ -5059,19 +5065,41 @@ $(function(){
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
}
},
value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
Date.superclass.value2html.call(this, text, element);
let text = '';
if (value) {
if (typeof value === 'string') {
text = value;
} else if (value instanceof Date && typeof value.getUTCDate === 'function') {
text = this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
}
}
// direct fallback: set text without using editableutils
if (element) {
element.textContent = text;
}
},
html2value: function(html) {
return this.parseDate(html, this.parsedViewFormat);
},
},
value2str: function(value) {
return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : '';
},
if (!value) {
return '';
}
// If value is already a string (like "2025-11-27"), just return it.
if (typeof value === 'string') {
return value;
}
// Otherwise, assume it's a Date object and format it.
return this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
},
str2value: function(str) {
return this.parseDate(str, this.parsedFormat);
@@ -5085,9 +5113,13 @@ $(function(){
this.$input.bdatepicker('update', value);
},
input2value: function() {
return this.$input.data('datepicker').date;
},
input2value: function() {
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,5 +1,5 @@
/*! X-editable-bootstrap5 - v1.5.4
* A maintained fork of x-editable for Bootstrap 5 support.
/*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
.editableform {

View File

@@ -1,5 +1,5 @@
/*! X-editable-bootstrap5 - v1.5.4
* A maintained fork of x-editable for Bootstrap 5 support.
/*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
/**
@@ -3881,20 +3881,26 @@ $(function(){
this.$input.val(value).trigger('change.select2');
}
},
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;
}
}
return val;
},
input2value: function() {
var val = this.$input.val();
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
// --- 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) {
@@ -4925,19 +4931,41 @@ $(function(){
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
}
},
value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
Date.superclass.value2html.call(this, text, element);
let text = '';
if (value) {
if (typeof value === 'string') {
text = value;
} else if (value instanceof Date && typeof value.getUTCDate === 'function') {
text = this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
}
}
// direct fallback: set text without using editableutils
if (element) {
element.textContent = text;
}
},
html2value: function(html) {
return this.parseDate(html, this.parsedViewFormat);
},
},
value2str: function(value) {
return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : '';
},
if (!value) {
return '';
}
// If value is already a string (like "2025-11-27"), just return it.
if (typeof value === 'string') {
return value;
}
// Otherwise, assume it's a Date object and format it.
return this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
},
str2value: function(str) {
return this.parseDate(str, this.parsedFormat);
@@ -4951,9 +4979,13 @@ $(function(){
this.$input.bdatepicker('update', value);
},
input2value: function() {
return this.$input.data('datepicker').date;
},
input2value: function() {
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,5 +1,5 @@
/*! X-editable-bootstrap5 - v1.5.4
* A maintained fork of x-editable for Bootstrap 5 support.
/*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
.editableform {

View File

@@ -1,5 +1,5 @@
/*! X-editable-bootstrap5 - v1.5.4
* A maintained fork of x-editable for Bootstrap 5 support.
/*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
/**
@@ -3881,20 +3881,26 @@ $(function(){
this.$input.val(value).trigger('change.select2');
}
},
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;
}
}
return val;
},
input2value: function() {
var val = this.$input.val();
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
// --- 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,5 +1,5 @@
/*! X-editable-bootstrap5 - v1.5.4
* A maintained fork of x-editable for Bootstrap 5 support.
/*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
.editableform {

View File

@@ -1,5 +1,5 @@
/*! X-editable-bootstrap5 - v1.5.4
* A maintained fork of x-editable for Bootstrap 5 support.
/*! X-editable-bootstrap5 - v1.5.7
* A fork of x-editable for Bootstrap 5 support.
* https://git.24unix.net/tracer/x-editable
* Copyright (c) 2025 Micha Espey; Licensed MIT */
/**
@@ -3881,20 +3881,26 @@ $(function(){
this.$input.val(value).trigger('change.select2');
}
},
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;
}
}
return val;
},
input2value: function() {
var val = this.$input.val();
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
// --- 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,8 +1,8 @@
{
"name": "x-editable-bootstrap5",
"title": "X-editable-bootstrap5",
"description": "A maintained fork of x-editable for Bootstrap 5 support.",
"version": "1.5.4",
"description": "A fork of x-editable for Bootstrap 5 support.",
"version": "1.5.7",
"homepage": "https://git.24unix.net/tracer/x-editable",
"author": {
"name": "Micha Espey",

View File

@@ -88,19 +88,41 @@ $(function(){
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
}
},
value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
Date.superclass.value2html.call(this, text, element);
let text = '';
if (value) {
if (typeof value === 'string') {
text = value;
} else if (value instanceof Date && typeof value.getUTCDate === 'function') {
text = this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
}
}
// direct fallback: set text without using editableutils
if (element) {
element.textContent = text;
}
},
html2value: function(html) {
return this.parseDate(html, this.parsedViewFormat);
},
},
value2str: function(value) {
return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : '';
},
if (!value) {
return '';
}
// If value is already a string (like "2025-11-27"), just return it.
if (typeof value === 'string') {
return value;
}
// Otherwise, assume it's a Date object and format it.
return this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language);
},
str2value: function(str) {
return this.parseDate(str, this.parsedFormat);
@@ -114,9 +136,13 @@ $(function(){
this.$input.bdatepicker('update', value);
},
input2value: function() {
return this.$input.data('datepicker').date;
},
input2value: function() {
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

@@ -280,20 +280,26 @@ $(function(){
this.$input.val(value).trigger('change.select2');
}
},
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;
}
}
return val;
},
input2value: function() {
var val = this.$input.val();
// --- Handle Bootstrap Datepicker ---
var dp = this.$input.data('datepicker');
if (dp && typeof dp.getFormattedDate === 'function') {
val = dp.getFormattedDate(this.options.format || 'yyyy-mm-dd');
}
// --- 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) {