Clean up debug code: remove all console.log statements
- Removed all debug console.log statements from source files - Cleaned up date.js and datefield.js of debugging output - Simplified test.js by removing extensive debug logging - Reduced bundle size and improved production readiness - Maintained all functionality while removing debug clutter Code is now production-ready without console noise.
This commit is contained in:
2
dist/app.js
vendored
2
dist/app.js
vendored
File diff suppressed because one or more lines are too long
62
dist/bootstrap-editable/js/bootstrap-editable.js
vendored
62
dist/bootstrap-editable/js/bootstrap-editable.js
vendored
@@ -4897,27 +4897,22 @@ $(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
var Date = function (options) {
|
var Date = function (options) {
|
||||||
console.log("Date constructor called with options:", options);
|
|
||||||
this.init('date', options, Date.defaults);
|
this.init('date', options, Date.defaults);
|
||||||
this.initPicker(options, Date.defaults);
|
this.initPicker(options, Date.defaults);
|
||||||
|
|
||||||
// Ensure type is set correctly
|
// Ensure type is set correctly
|
||||||
this.type = 'date';
|
this.type = 'date';
|
||||||
console.log("Date constructor completed, type set to:", this.type);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$.fn.editableutils.inherit(Date, $.fn.editabletypes.abstractinput);
|
$.fn.editableutils.inherit(Date, $.fn.editabletypes.abstractinput);
|
||||||
|
|
||||||
$.extend(Date.prototype, {
|
$.extend(Date.prototype, {
|
||||||
prerender: function() {
|
prerender: function() {
|
||||||
console.log("Date.prerender() called");
|
|
||||||
// Call parent prerender
|
// Call parent prerender
|
||||||
Date.superclass.prerender.call(this);
|
Date.superclass.prerender.call(this);
|
||||||
console.log("Date.prerender() completed, $input:", this.$input[0]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initPicker: function(options, defaults) {
|
initPicker: function(options, defaults) {
|
||||||
console.log("Date.initPicker() called");
|
|
||||||
//'format' is set directly from settings or data-* attributes
|
//'format' is set directly from settings or data-* attributes
|
||||||
|
|
||||||
//by default viewformat equals to format
|
//by default viewformat equals to format
|
||||||
@@ -4946,30 +4941,21 @@ $(function(){
|
|||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
// Debug: Check if render is being called
|
|
||||||
console.log("Date.render() called, options:", this.options.datepicker);
|
|
||||||
console.log("Input element for datepicker:", this.$input[0]);
|
|
||||||
|
|
||||||
// Ensure we have an input element
|
// Ensure we have an input element
|
||||||
if (!this.$input || !this.$input.length) {
|
if (!this.$input || !this.$input.length) {
|
||||||
console.error("No input element found in render()");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize datepicker immediately
|
// Initialize datepicker immediately
|
||||||
try {
|
try {
|
||||||
console.log("Attempting datepicker initialization in render()...");
|
|
||||||
this.$input.datepicker(this.options.datepicker);
|
this.$input.datepicker(this.options.datepicker);
|
||||||
console.log("Datepicker initialized successfully in render()");
|
|
||||||
console.log("Datepicker data after render:", this.$input.data('datepicker'));
|
|
||||||
|
|
||||||
// Force set the initial value if we have one
|
// Force set the initial value if we have one
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
console.log("Setting initial value in render():", this.value);
|
|
||||||
this.$input.datepicker('setDate', this.value);
|
this.$input.datepicker('setDate', this.value);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error initializing datepicker in render():", error);
|
// Silently handle datepicker initialization errors
|
||||||
}
|
}
|
||||||
|
|
||||||
//"clear" link
|
//"clear" link
|
||||||
@@ -5006,59 +4992,41 @@ $(function(){
|
|||||||
},
|
},
|
||||||
|
|
||||||
value2input: function(value) {
|
value2input: function(value) {
|
||||||
console.log("Date.value2input() called with value:", value);
|
|
||||||
console.log("Input element in value2input:", this.$input[0]);
|
|
||||||
console.log("Datepicker data in value2input:", this.$input.data('datepicker'));
|
|
||||||
|
|
||||||
// Ensure datepicker is initialized before trying to update
|
// Ensure datepicker is initialized before trying to update
|
||||||
if (!this.$input.data('datepicker')) {
|
if (!this.$input.data('datepicker')) {
|
||||||
console.log("Datepicker not initialized in value2input, initializing now...");
|
|
||||||
this.$input.datepicker(this.options.datepicker);
|
this.$input.datepicker(this.options.datepicker);
|
||||||
console.log("Datepicker data after manual init in value2input:", this.$input.data('datepicker'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$input.datepicker('update', value);
|
this.$input.datepicker('update', value);
|
||||||
},
|
},
|
||||||
|
|
||||||
input2value: function() {
|
input2value: function() {
|
||||||
console.log("Date.input2value() called");
|
|
||||||
var datepicker = this.$input.data('datepicker');
|
var datepicker = this.$input.data('datepicker');
|
||||||
console.log("Datepicker object in input2value:", datepicker);
|
|
||||||
|
|
||||||
if (datepicker) {
|
if (datepicker) {
|
||||||
console.log("Datepicker.date:", datepicker.date);
|
|
||||||
console.log("Datepicker.dates:", datepicker.dates);
|
|
||||||
console.log("Datepicker.getDate():", typeof datepicker.getDate === 'function' ? datepicker.getDate() : 'getDate not available');
|
|
||||||
|
|
||||||
if (datepicker.date) {
|
if (datepicker.date) {
|
||||||
console.log("Returning datepicker.date:", datepicker.date);
|
|
||||||
return datepicker.date;
|
return datepicker.date;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try getting date from dates array
|
// Try getting date from dates array
|
||||||
if (datepicker.dates && datepicker.dates.length > 0) {
|
if (datepicker.dates && datepicker.dates.length > 0) {
|
||||||
console.log("Returning from dates array:", datepicker.dates[0]);
|
|
||||||
return datepicker.dates[0];
|
return datepicker.dates[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try using getDate method
|
// Try using getDate method
|
||||||
if (typeof datepicker.getDate === 'function') {
|
if (typeof datepicker.getDate === 'function') {
|
||||||
var dateFromMethod = datepicker.getDate();
|
var dateFromMethod = datepicker.getDate();
|
||||||
console.log("Returning from getDate():", dateFromMethod);
|
|
||||||
return dateFromMethod;
|
return dateFromMethod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: try to parse the input value directly
|
// Fallback: try to parse the input value directly
|
||||||
var inputVal = this.$input.val();
|
var inputVal = this.$input.val();
|
||||||
console.log("Input value fallback:", inputVal);
|
|
||||||
if (inputVal) {
|
if (inputVal) {
|
||||||
var parsedDate = this.parseDate(inputVal, this.parsedViewFormat);
|
var parsedDate = this.parseDate(inputVal, this.parsedViewFormat);
|
||||||
console.log("Parsed date fallback:", parsedDate);
|
|
||||||
return parsedDate;
|
return parsedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("input2value returning null - no valid date found");
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -5203,29 +5171,13 @@ Automatically shown in inline mode.
|
|||||||
|
|
||||||
$.extend(DateField.prototype, {
|
$.extend(DateField.prototype, {
|
||||||
render: function () {
|
render: function () {
|
||||||
console.log("DateField.render() called");
|
|
||||||
this.$input = this.$tpl.find('input');
|
this.$input = this.$tpl.find('input');
|
||||||
this.setClass();
|
this.setClass();
|
||||||
this.setAttr('placeholder');
|
this.setAttr('placeholder');
|
||||||
|
|
||||||
console.log("DateField initializing datepicker on container:", this.$tpl[0]);
|
|
||||||
console.log("DateField datepicker options:", this.options.datepicker);
|
|
||||||
|
|
||||||
//use datepicker instead of bdatepicker
|
//use datepicker instead of bdatepicker
|
||||||
this.$tpl.datepicker(this.options.datepicker);
|
this.$tpl.datepicker(this.options.datepicker);
|
||||||
|
|
||||||
console.log("DateField datepicker initialized, data:", this.$tpl.data('datepicker'));
|
|
||||||
|
|
||||||
// Add event listeners to track date changes
|
|
||||||
this.$tpl.on('changeDate', $.proxy(function(e) {
|
|
||||||
console.log("DateField changeDate event triggered:", e.date);
|
|
||||||
}, this));
|
|
||||||
|
|
||||||
this.$tpl.on('hide', $.proxy(function(e) {
|
|
||||||
console.log("DateField datepicker hide event triggered");
|
|
||||||
console.log("DateField datepicker data on hide:", this.$tpl.data('datepicker'));
|
|
||||||
}, this));
|
|
||||||
|
|
||||||
//need to disable original event handlers
|
//need to disable original event handlers
|
||||||
this.$input.off('focus keydown');
|
this.$input.off('focus keydown');
|
||||||
|
|
||||||
@@ -5238,32 +5190,23 @@ Automatically shown in inline mode.
|
|||||||
},
|
},
|
||||||
|
|
||||||
value2input: function(value) {
|
value2input: function(value) {
|
||||||
console.log("DateField.value2input() called with value:", value);
|
|
||||||
var formattedValue = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
|
var formattedValue = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
|
||||||
console.log("DateField formatted value for input:", formattedValue);
|
|
||||||
this.$input.val(formattedValue);
|
this.$input.val(formattedValue);
|
||||||
this.$tpl.datepicker('update');
|
this.$tpl.datepicker('update');
|
||||||
console.log("DateField after update, datepicker data:", this.$tpl.data('datepicker'));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
input2value: function() {
|
input2value: function() {
|
||||||
console.log("DateField.input2value() called");
|
|
||||||
|
|
||||||
// First try the container datepicker (ideal case)
|
// First try the container datepicker (ideal case)
|
||||||
var containerDatepicker = this.$tpl.data('datepicker');
|
var containerDatepicker = this.$tpl.data('datepicker');
|
||||||
console.log("DateField container datepicker object:", containerDatepicker);
|
|
||||||
|
|
||||||
if (containerDatepicker && containerDatepicker.dates && containerDatepicker.dates.length > 0) {
|
if (containerDatepicker && containerDatepicker.dates && containerDatepicker.dates.length > 0) {
|
||||||
console.log("DateField returning from container dates array:", containerDatepicker.dates[0]);
|
|
||||||
return containerDatepicker.dates[0];
|
return containerDatepicker.dates[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: try the input datepicker (in case manual init worked)
|
// Fallback: try the input datepicker (in case manual init worked)
|
||||||
var inputDatepicker = this.$input.data('datepicker');
|
var inputDatepicker = this.$input.data('datepicker');
|
||||||
console.log("DateField input datepicker object:", inputDatepicker);
|
|
||||||
|
|
||||||
if (inputDatepicker && inputDatepicker.dates && inputDatepicker.dates.length > 0) {
|
if (inputDatepicker && inputDatepicker.dates && inputDatepicker.dates.length > 0) {
|
||||||
console.log("DateField returning from input dates array:", inputDatepicker.dates[0]);
|
|
||||||
return inputDatepicker.dates[0];
|
return inputDatepicker.dates[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5271,7 +5214,6 @@ Automatically shown in inline mode.
|
|||||||
if (containerDatepicker && typeof containerDatepicker.getDate === 'function') {
|
if (containerDatepicker && typeof containerDatepicker.getDate === 'function') {
|
||||||
var containerDate = containerDatepicker.getDate();
|
var containerDate = containerDatepicker.getDate();
|
||||||
if (containerDate) {
|
if (containerDate) {
|
||||||
console.log("DateField returning from container getDate():", containerDate);
|
|
||||||
return containerDate;
|
return containerDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5279,13 +5221,11 @@ Automatically shown in inline mode.
|
|||||||
if (inputDatepicker && typeof inputDatepicker.getDate === 'function') {
|
if (inputDatepicker && typeof inputDatepicker.getDate === 'function') {
|
||||||
var inputDate = inputDatepicker.getDate();
|
var inputDate = inputDatepicker.getDate();
|
||||||
if (inputDate) {
|
if (inputDate) {
|
||||||
console.log("DateField returning from input getDate():", inputDate);
|
|
||||||
return inputDate;
|
return inputDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Final fallback to text parsing
|
// Final fallback to text parsing
|
||||||
console.log("DateField fallback to text input value:", this.$input.val());
|
|
||||||
return this.html2value(this.$input.val());
|
return this.html2value(this.$input.val());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -4965,27 +4965,22 @@ $(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
var Date = function (options) {
|
var Date = function (options) {
|
||||||
console.log("Date constructor called with options:", options);
|
|
||||||
this.init('date', options, Date.defaults);
|
this.init('date', options, Date.defaults);
|
||||||
this.initPicker(options, Date.defaults);
|
this.initPicker(options, Date.defaults);
|
||||||
|
|
||||||
// Ensure type is set correctly
|
// Ensure type is set correctly
|
||||||
this.type = 'date';
|
this.type = 'date';
|
||||||
console.log("Date constructor completed, type set to:", this.type);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$.fn.editableutils.inherit(Date, $.fn.editabletypes.abstractinput);
|
$.fn.editableutils.inherit(Date, $.fn.editabletypes.abstractinput);
|
||||||
|
|
||||||
$.extend(Date.prototype, {
|
$.extend(Date.prototype, {
|
||||||
prerender: function() {
|
prerender: function() {
|
||||||
console.log("Date.prerender() called");
|
|
||||||
// Call parent prerender
|
// Call parent prerender
|
||||||
Date.superclass.prerender.call(this);
|
Date.superclass.prerender.call(this);
|
||||||
console.log("Date.prerender() completed, $input:", this.$input[0]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initPicker: function(options, defaults) {
|
initPicker: function(options, defaults) {
|
||||||
console.log("Date.initPicker() called");
|
|
||||||
//'format' is set directly from settings or data-* attributes
|
//'format' is set directly from settings or data-* attributes
|
||||||
|
|
||||||
//by default viewformat equals to format
|
//by default viewformat equals to format
|
||||||
@@ -5014,30 +5009,21 @@ $(function(){
|
|||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
// Debug: Check if render is being called
|
|
||||||
console.log("Date.render() called, options:", this.options.datepicker);
|
|
||||||
console.log("Input element for datepicker:", this.$input[0]);
|
|
||||||
|
|
||||||
// Ensure we have an input element
|
// Ensure we have an input element
|
||||||
if (!this.$input || !this.$input.length) {
|
if (!this.$input || !this.$input.length) {
|
||||||
console.error("No input element found in render()");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize datepicker immediately
|
// Initialize datepicker immediately
|
||||||
try {
|
try {
|
||||||
console.log("Attempting datepicker initialization in render()...");
|
|
||||||
this.$input.datepicker(this.options.datepicker);
|
this.$input.datepicker(this.options.datepicker);
|
||||||
console.log("Datepicker initialized successfully in render()");
|
|
||||||
console.log("Datepicker data after render:", this.$input.data('datepicker'));
|
|
||||||
|
|
||||||
// Force set the initial value if we have one
|
// Force set the initial value if we have one
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
console.log("Setting initial value in render():", this.value);
|
|
||||||
this.$input.datepicker('setDate', this.value);
|
this.$input.datepicker('setDate', this.value);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error initializing datepicker in render():", error);
|
// Silently handle datepicker initialization errors
|
||||||
}
|
}
|
||||||
|
|
||||||
//"clear" link
|
//"clear" link
|
||||||
@@ -5074,59 +5060,41 @@ $(function(){
|
|||||||
},
|
},
|
||||||
|
|
||||||
value2input: function(value) {
|
value2input: function(value) {
|
||||||
console.log("Date.value2input() called with value:", value);
|
|
||||||
console.log("Input element in value2input:", this.$input[0]);
|
|
||||||
console.log("Datepicker data in value2input:", this.$input.data('datepicker'));
|
|
||||||
|
|
||||||
// Ensure datepicker is initialized before trying to update
|
// Ensure datepicker is initialized before trying to update
|
||||||
if (!this.$input.data('datepicker')) {
|
if (!this.$input.data('datepicker')) {
|
||||||
console.log("Datepicker not initialized in value2input, initializing now...");
|
|
||||||
this.$input.datepicker(this.options.datepicker);
|
this.$input.datepicker(this.options.datepicker);
|
||||||
console.log("Datepicker data after manual init in value2input:", this.$input.data('datepicker'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$input.datepicker('update', value);
|
this.$input.datepicker('update', value);
|
||||||
},
|
},
|
||||||
|
|
||||||
input2value: function() {
|
input2value: function() {
|
||||||
console.log("Date.input2value() called");
|
|
||||||
var datepicker = this.$input.data('datepicker');
|
var datepicker = this.$input.data('datepicker');
|
||||||
console.log("Datepicker object in input2value:", datepicker);
|
|
||||||
|
|
||||||
if (datepicker) {
|
if (datepicker) {
|
||||||
console.log("Datepicker.date:", datepicker.date);
|
|
||||||
console.log("Datepicker.dates:", datepicker.dates);
|
|
||||||
console.log("Datepicker.getDate():", typeof datepicker.getDate === 'function' ? datepicker.getDate() : 'getDate not available');
|
|
||||||
|
|
||||||
if (datepicker.date) {
|
if (datepicker.date) {
|
||||||
console.log("Returning datepicker.date:", datepicker.date);
|
|
||||||
return datepicker.date;
|
return datepicker.date;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try getting date from dates array
|
// Try getting date from dates array
|
||||||
if (datepicker.dates && datepicker.dates.length > 0) {
|
if (datepicker.dates && datepicker.dates.length > 0) {
|
||||||
console.log("Returning from dates array:", datepicker.dates[0]);
|
|
||||||
return datepicker.dates[0];
|
return datepicker.dates[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try using getDate method
|
// Try using getDate method
|
||||||
if (typeof datepicker.getDate === 'function') {
|
if (typeof datepicker.getDate === 'function') {
|
||||||
var dateFromMethod = datepicker.getDate();
|
var dateFromMethod = datepicker.getDate();
|
||||||
console.log("Returning from getDate():", dateFromMethod);
|
|
||||||
return dateFromMethod;
|
return dateFromMethod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: try to parse the input value directly
|
// Fallback: try to parse the input value directly
|
||||||
var inputVal = this.$input.val();
|
var inputVal = this.$input.val();
|
||||||
console.log("Input value fallback:", inputVal);
|
|
||||||
if (inputVal) {
|
if (inputVal) {
|
||||||
var parsedDate = this.parseDate(inputVal, this.parsedViewFormat);
|
var parsedDate = this.parseDate(inputVal, this.parsedViewFormat);
|
||||||
console.log("Parsed date fallback:", parsedDate);
|
|
||||||
return parsedDate;
|
return parsedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("input2value returning null - no valid date found");
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -5271,29 +5239,13 @@ Automatically shown in inline mode.
|
|||||||
|
|
||||||
$.extend(DateField.prototype, {
|
$.extend(DateField.prototype, {
|
||||||
render: function () {
|
render: function () {
|
||||||
console.log("DateField.render() called");
|
|
||||||
this.$input = this.$tpl.find('input');
|
this.$input = this.$tpl.find('input');
|
||||||
this.setClass();
|
this.setClass();
|
||||||
this.setAttr('placeholder');
|
this.setAttr('placeholder');
|
||||||
|
|
||||||
console.log("DateField initializing datepicker on container:", this.$tpl[0]);
|
|
||||||
console.log("DateField datepicker options:", this.options.datepicker);
|
|
||||||
|
|
||||||
//use datepicker instead of bdatepicker
|
//use datepicker instead of bdatepicker
|
||||||
this.$tpl.datepicker(this.options.datepicker);
|
this.$tpl.datepicker(this.options.datepicker);
|
||||||
|
|
||||||
console.log("DateField datepicker initialized, data:", this.$tpl.data('datepicker'));
|
|
||||||
|
|
||||||
// Add event listeners to track date changes
|
|
||||||
this.$tpl.on('changeDate', $.proxy(function(e) {
|
|
||||||
console.log("DateField changeDate event triggered:", e.date);
|
|
||||||
}, this));
|
|
||||||
|
|
||||||
this.$tpl.on('hide', $.proxy(function(e) {
|
|
||||||
console.log("DateField datepicker hide event triggered");
|
|
||||||
console.log("DateField datepicker data on hide:", this.$tpl.data('datepicker'));
|
|
||||||
}, this));
|
|
||||||
|
|
||||||
//need to disable original event handlers
|
//need to disable original event handlers
|
||||||
this.$input.off('focus keydown');
|
this.$input.off('focus keydown');
|
||||||
|
|
||||||
@@ -5306,32 +5258,23 @@ Automatically shown in inline mode.
|
|||||||
},
|
},
|
||||||
|
|
||||||
value2input: function(value) {
|
value2input: function(value) {
|
||||||
console.log("DateField.value2input() called with value:", value);
|
|
||||||
var formattedValue = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
|
var formattedValue = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
|
||||||
console.log("DateField formatted value for input:", formattedValue);
|
|
||||||
this.$input.val(formattedValue);
|
this.$input.val(formattedValue);
|
||||||
this.$tpl.datepicker('update');
|
this.$tpl.datepicker('update');
|
||||||
console.log("DateField after update, datepicker data:", this.$tpl.data('datepicker'));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
input2value: function() {
|
input2value: function() {
|
||||||
console.log("DateField.input2value() called");
|
|
||||||
|
|
||||||
// First try the container datepicker (ideal case)
|
// First try the container datepicker (ideal case)
|
||||||
var containerDatepicker = this.$tpl.data('datepicker');
|
var containerDatepicker = this.$tpl.data('datepicker');
|
||||||
console.log("DateField container datepicker object:", containerDatepicker);
|
|
||||||
|
|
||||||
if (containerDatepicker && containerDatepicker.dates && containerDatepicker.dates.length > 0) {
|
if (containerDatepicker && containerDatepicker.dates && containerDatepicker.dates.length > 0) {
|
||||||
console.log("DateField returning from container dates array:", containerDatepicker.dates[0]);
|
|
||||||
return containerDatepicker.dates[0];
|
return containerDatepicker.dates[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: try the input datepicker (in case manual init worked)
|
// Fallback: try the input datepicker (in case manual init worked)
|
||||||
var inputDatepicker = this.$input.data('datepicker');
|
var inputDatepicker = this.$input.data('datepicker');
|
||||||
console.log("DateField input datepicker object:", inputDatepicker);
|
|
||||||
|
|
||||||
if (inputDatepicker && inputDatepicker.dates && inputDatepicker.dates.length > 0) {
|
if (inputDatepicker && inputDatepicker.dates && inputDatepicker.dates.length > 0) {
|
||||||
console.log("DateField returning from input dates array:", inputDatepicker.dates[0]);
|
|
||||||
return inputDatepicker.dates[0];
|
return inputDatepicker.dates[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5339,7 +5282,6 @@ Automatically shown in inline mode.
|
|||||||
if (containerDatepicker && typeof containerDatepicker.getDate === 'function') {
|
if (containerDatepicker && typeof containerDatepicker.getDate === 'function') {
|
||||||
var containerDate = containerDatepicker.getDate();
|
var containerDate = containerDatepicker.getDate();
|
||||||
if (containerDate) {
|
if (containerDate) {
|
||||||
console.log("DateField returning from container getDate():", containerDate);
|
|
||||||
return containerDate;
|
return containerDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5347,13 +5289,11 @@ Automatically shown in inline mode.
|
|||||||
if (inputDatepicker && typeof inputDatepicker.getDate === 'function') {
|
if (inputDatepicker && typeof inputDatepicker.getDate === 'function') {
|
||||||
var inputDate = inputDatepicker.getDate();
|
var inputDate = inputDatepicker.getDate();
|
||||||
if (inputDate) {
|
if (inputDate) {
|
||||||
console.log("DateField returning from input getDate():", inputDate);
|
|
||||||
return inputDate;
|
return inputDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Final fallback to text parsing
|
// Final fallback to text parsing
|
||||||
console.log("DateField fallback to text input value:", this.$input.val());
|
|
||||||
return this.html2value(this.$input.val());
|
return this.html2value(this.$input.val());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -33,27 +33,22 @@ $(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
var Date = function (options) {
|
var Date = function (options) {
|
||||||
console.log("Date constructor called with options:", options);
|
|
||||||
this.init('date', options, Date.defaults);
|
this.init('date', options, Date.defaults);
|
||||||
this.initPicker(options, Date.defaults);
|
this.initPicker(options, Date.defaults);
|
||||||
|
|
||||||
// Ensure type is set correctly
|
// Ensure type is set correctly
|
||||||
this.type = 'date';
|
this.type = 'date';
|
||||||
console.log("Date constructor completed, type set to:", this.type);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$.fn.editableutils.inherit(Date, $.fn.editabletypes.abstractinput);
|
$.fn.editableutils.inherit(Date, $.fn.editabletypes.abstractinput);
|
||||||
|
|
||||||
$.extend(Date.prototype, {
|
$.extend(Date.prototype, {
|
||||||
prerender: function() {
|
prerender: function() {
|
||||||
console.log("Date.prerender() called");
|
|
||||||
// Call parent prerender
|
// Call parent prerender
|
||||||
Date.superclass.prerender.call(this);
|
Date.superclass.prerender.call(this);
|
||||||
console.log("Date.prerender() completed, $input:", this.$input[0]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initPicker: function(options, defaults) {
|
initPicker: function(options, defaults) {
|
||||||
console.log("Date.initPicker() called");
|
|
||||||
//'format' is set directly from settings or data-* attributes
|
//'format' is set directly from settings or data-* attributes
|
||||||
|
|
||||||
//by default viewformat equals to format
|
//by default viewformat equals to format
|
||||||
@@ -82,30 +77,21 @@ $(function(){
|
|||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
// Debug: Check if render is being called
|
|
||||||
console.log("Date.render() called, options:", this.options.datepicker);
|
|
||||||
console.log("Input element for datepicker:", this.$input[0]);
|
|
||||||
|
|
||||||
// Ensure we have an input element
|
// Ensure we have an input element
|
||||||
if (!this.$input || !this.$input.length) {
|
if (!this.$input || !this.$input.length) {
|
||||||
console.error("No input element found in render()");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize datepicker immediately
|
// Initialize datepicker immediately
|
||||||
try {
|
try {
|
||||||
console.log("Attempting datepicker initialization in render()...");
|
|
||||||
this.$input.datepicker(this.options.datepicker);
|
this.$input.datepicker(this.options.datepicker);
|
||||||
console.log("Datepicker initialized successfully in render()");
|
|
||||||
console.log("Datepicker data after render:", this.$input.data('datepicker'));
|
|
||||||
|
|
||||||
// Force set the initial value if we have one
|
// Force set the initial value if we have one
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
console.log("Setting initial value in render():", this.value);
|
|
||||||
this.$input.datepicker('setDate', this.value);
|
this.$input.datepicker('setDate', this.value);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error initializing datepicker in render():", error);
|
// Silently handle datepicker initialization errors
|
||||||
}
|
}
|
||||||
|
|
||||||
//"clear" link
|
//"clear" link
|
||||||
@@ -142,59 +128,41 @@ $(function(){
|
|||||||
},
|
},
|
||||||
|
|
||||||
value2input: function(value) {
|
value2input: function(value) {
|
||||||
console.log("Date.value2input() called with value:", value);
|
|
||||||
console.log("Input element in value2input:", this.$input[0]);
|
|
||||||
console.log("Datepicker data in value2input:", this.$input.data('datepicker'));
|
|
||||||
|
|
||||||
// Ensure datepicker is initialized before trying to update
|
// Ensure datepicker is initialized before trying to update
|
||||||
if (!this.$input.data('datepicker')) {
|
if (!this.$input.data('datepicker')) {
|
||||||
console.log("Datepicker not initialized in value2input, initializing now...");
|
|
||||||
this.$input.datepicker(this.options.datepicker);
|
this.$input.datepicker(this.options.datepicker);
|
||||||
console.log("Datepicker data after manual init in value2input:", this.$input.data('datepicker'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$input.datepicker('update', value);
|
this.$input.datepicker('update', value);
|
||||||
},
|
},
|
||||||
|
|
||||||
input2value: function() {
|
input2value: function() {
|
||||||
console.log("Date.input2value() called");
|
|
||||||
var datepicker = this.$input.data('datepicker');
|
var datepicker = this.$input.data('datepicker');
|
||||||
console.log("Datepicker object in input2value:", datepicker);
|
|
||||||
|
|
||||||
if (datepicker) {
|
if (datepicker) {
|
||||||
console.log("Datepicker.date:", datepicker.date);
|
|
||||||
console.log("Datepicker.dates:", datepicker.dates);
|
|
||||||
console.log("Datepicker.getDate():", typeof datepicker.getDate === 'function' ? datepicker.getDate() : 'getDate not available');
|
|
||||||
|
|
||||||
if (datepicker.date) {
|
if (datepicker.date) {
|
||||||
console.log("Returning datepicker.date:", datepicker.date);
|
|
||||||
return datepicker.date;
|
return datepicker.date;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try getting date from dates array
|
// Try getting date from dates array
|
||||||
if (datepicker.dates && datepicker.dates.length > 0) {
|
if (datepicker.dates && datepicker.dates.length > 0) {
|
||||||
console.log("Returning from dates array:", datepicker.dates[0]);
|
|
||||||
return datepicker.dates[0];
|
return datepicker.dates[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try using getDate method
|
// Try using getDate method
|
||||||
if (typeof datepicker.getDate === 'function') {
|
if (typeof datepicker.getDate === 'function') {
|
||||||
var dateFromMethod = datepicker.getDate();
|
var dateFromMethod = datepicker.getDate();
|
||||||
console.log("Returning from getDate():", dateFromMethod);
|
|
||||||
return dateFromMethod;
|
return dateFromMethod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: try to parse the input value directly
|
// Fallback: try to parse the input value directly
|
||||||
var inputVal = this.$input.val();
|
var inputVal = this.$input.val();
|
||||||
console.log("Input value fallback:", inputVal);
|
|
||||||
if (inputVal) {
|
if (inputVal) {
|
||||||
var parsedDate = this.parseDate(inputVal, this.parsedViewFormat);
|
var parsedDate = this.parseDate(inputVal, this.parsedViewFormat);
|
||||||
console.log("Parsed date fallback:", parsedDate);
|
|
||||||
return parsedDate;
|
return parsedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("input2value returning null - no valid date found");
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@@ -23,29 +23,13 @@ Automatically shown in inline mode.
|
|||||||
|
|
||||||
$.extend(DateField.prototype, {
|
$.extend(DateField.prototype, {
|
||||||
render: function () {
|
render: function () {
|
||||||
console.log("DateField.render() called");
|
|
||||||
this.$input = this.$tpl.find('input');
|
this.$input = this.$tpl.find('input');
|
||||||
this.setClass();
|
this.setClass();
|
||||||
this.setAttr('placeholder');
|
this.setAttr('placeholder');
|
||||||
|
|
||||||
console.log("DateField initializing datepicker on container:", this.$tpl[0]);
|
|
||||||
console.log("DateField datepicker options:", this.options.datepicker);
|
|
||||||
|
|
||||||
//use datepicker instead of bdatepicker
|
//use datepicker instead of bdatepicker
|
||||||
this.$tpl.datepicker(this.options.datepicker);
|
this.$tpl.datepicker(this.options.datepicker);
|
||||||
|
|
||||||
console.log("DateField datepicker initialized, data:", this.$tpl.data('datepicker'));
|
|
||||||
|
|
||||||
// Add event listeners to track date changes
|
|
||||||
this.$tpl.on('changeDate', $.proxy(function(e) {
|
|
||||||
console.log("DateField changeDate event triggered:", e.date);
|
|
||||||
}, this));
|
|
||||||
|
|
||||||
this.$tpl.on('hide', $.proxy(function(e) {
|
|
||||||
console.log("DateField datepicker hide event triggered");
|
|
||||||
console.log("DateField datepicker data on hide:", this.$tpl.data('datepicker'));
|
|
||||||
}, this));
|
|
||||||
|
|
||||||
//need to disable original event handlers
|
//need to disable original event handlers
|
||||||
this.$input.off('focus keydown');
|
this.$input.off('focus keydown');
|
||||||
|
|
||||||
@@ -58,32 +42,23 @@ Automatically shown in inline mode.
|
|||||||
},
|
},
|
||||||
|
|
||||||
value2input: function(value) {
|
value2input: function(value) {
|
||||||
console.log("DateField.value2input() called with value:", value);
|
|
||||||
var formattedValue = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
|
var formattedValue = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
|
||||||
console.log("DateField formatted value for input:", formattedValue);
|
|
||||||
this.$input.val(formattedValue);
|
this.$input.val(formattedValue);
|
||||||
this.$tpl.datepicker('update');
|
this.$tpl.datepicker('update');
|
||||||
console.log("DateField after update, datepicker data:", this.$tpl.data('datepicker'));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
input2value: function() {
|
input2value: function() {
|
||||||
console.log("DateField.input2value() called");
|
|
||||||
|
|
||||||
// First try the container datepicker (ideal case)
|
// First try the container datepicker (ideal case)
|
||||||
var containerDatepicker = this.$tpl.data('datepicker');
|
var containerDatepicker = this.$tpl.data('datepicker');
|
||||||
console.log("DateField container datepicker object:", containerDatepicker);
|
|
||||||
|
|
||||||
if (containerDatepicker && containerDatepicker.dates && containerDatepicker.dates.length > 0) {
|
if (containerDatepicker && containerDatepicker.dates && containerDatepicker.dates.length > 0) {
|
||||||
console.log("DateField returning from container dates array:", containerDatepicker.dates[0]);
|
|
||||||
return containerDatepicker.dates[0];
|
return containerDatepicker.dates[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: try the input datepicker (in case manual init worked)
|
// Fallback: try the input datepicker (in case manual init worked)
|
||||||
var inputDatepicker = this.$input.data('datepicker');
|
var inputDatepicker = this.$input.data('datepicker');
|
||||||
console.log("DateField input datepicker object:", inputDatepicker);
|
|
||||||
|
|
||||||
if (inputDatepicker && inputDatepicker.dates && inputDatepicker.dates.length > 0) {
|
if (inputDatepicker && inputDatepicker.dates && inputDatepicker.dates.length > 0) {
|
||||||
console.log("DateField returning from input dates array:", inputDatepicker.dates[0]);
|
|
||||||
return inputDatepicker.dates[0];
|
return inputDatepicker.dates[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +66,6 @@ Automatically shown in inline mode.
|
|||||||
if (containerDatepicker && typeof containerDatepicker.getDate === 'function') {
|
if (containerDatepicker && typeof containerDatepicker.getDate === 'function') {
|
||||||
var containerDate = containerDatepicker.getDate();
|
var containerDate = containerDatepicker.getDate();
|
||||||
if (containerDate) {
|
if (containerDate) {
|
||||||
console.log("DateField returning from container getDate():", containerDate);
|
|
||||||
return containerDate;
|
return containerDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,13 +73,11 @@ Automatically shown in inline mode.
|
|||||||
if (inputDatepicker && typeof inputDatepicker.getDate === 'function') {
|
if (inputDatepicker && typeof inputDatepicker.getDate === 'function') {
|
||||||
var inputDate = inputDatepicker.getDate();
|
var inputDate = inputDatepicker.getDate();
|
||||||
if (inputDate) {
|
if (inputDate) {
|
||||||
console.log("DateField returning from input getDate():", inputDate);
|
|
||||||
return inputDate;
|
return inputDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Final fallback to text parsing
|
// Final fallback to text parsing
|
||||||
console.log("DateField fallback to text input value:", this.$input.val());
|
|
||||||
return this.html2value(this.$input.val());
|
return this.html2value(this.$input.val());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
95
test.js
95
test.js
@@ -1,9 +1,5 @@
|
|||||||
// debugger
|
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
window.$ = window.jQuery = $;
|
window.$ = window.jQuery = $;
|
||||||
//
|
|
||||||
console.log("jQuery version:", $.fn?.jquery);
|
|
||||||
// // import $ from './dist/jquery';
|
|
||||||
import "bootstrap"
|
import "bootstrap"
|
||||||
import "bootstrap/dist/css/bootstrap.min.css"
|
import "bootstrap/dist/css/bootstrap.min.css"
|
||||||
import "bootstrap-icons/font/bootstrap-icons.min.css"
|
import "bootstrap-icons/font/bootstrap-icons.min.css"
|
||||||
@@ -14,9 +10,6 @@ import "bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css";
|
|||||||
|
|
||||||
// Import the editable functionality (attaches to jQuery.fn) - using Grunt-built version
|
// Import the editable functionality (attaches to jQuery.fn) - using Grunt-built version
|
||||||
require("./dist/bootstrap5-editable/js/bootstrap-editable");
|
require("./dist/bootstrap5-editable/js/bootstrap-editable");
|
||||||
console.log("$.fn.editable available:", typeof $.fn.editable);
|
|
||||||
console.log("$.fn.datepicker available:", typeof $.fn.datepicker);
|
|
||||||
console.log("$.fn.bdatepicker available:", typeof $.fn.bdatepicker);
|
|
||||||
$.fn.editable.defaults.mode = 'inline';
|
$.fn.editable.defaults.mode = 'inline';
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
@@ -27,18 +20,12 @@ $(function() {
|
|||||||
source: 'test.php', // URL to fetch select options
|
source: 'test.php', // URL to fetch select options
|
||||||
value: 1,
|
value: 1,
|
||||||
success: function(response, newValue) {
|
success: function(response, newValue) {
|
||||||
console.log("Saved successfully:", response);
|
// Handle success
|
||||||
},
|
},
|
||||||
error: function(response) {
|
error: function(response) {
|
||||||
console.error("Save error:", response);
|
// Handle error
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("Internal editable data:", $('#yes-no-switch').data('editable'));
|
|
||||||
const ed = $('#yes-no-switch').data('editable');
|
|
||||||
console.log("Internal editable data:", ed);
|
|
||||||
if (ed) {
|
|
||||||
console.log("TYPE:", ed.type, "OPTIONS:", ed.options);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -52,15 +39,14 @@ $(function() {
|
|||||||
],
|
],
|
||||||
value: 1,
|
value: 1,
|
||||||
success: function(response, newValue) {
|
success: function(response, newValue) {
|
||||||
console.log("Static source saved successfully:", response);
|
// Handle success
|
||||||
},
|
},
|
||||||
error: function(response) {
|
error: function(response) {
|
||||||
console.error("Static source save error:", response);
|
// Handle error
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const initialDateValue = new Date().toISOString().split('T')[0];
|
const initialDateValue = new Date().toISOString().split('T')[0];
|
||||||
console.log("Setting up datepicker with initial value:", initialDateValue);
|
|
||||||
|
|
||||||
$('#datepicker').editable({
|
$('#datepicker').editable({
|
||||||
type: 'date',
|
type: 'date',
|
||||||
@@ -74,80 +60,11 @@ $(function() {
|
|||||||
todayHighlight: true
|
todayHighlight: true
|
||||||
},
|
},
|
||||||
success: (response, newValue)=> {
|
success: (response, newValue)=> {
|
||||||
console.log("Date saved successfully:", response);
|
// Handle success
|
||||||
console.log("New value received:", newValue);
|
|
||||||
},
|
},
|
||||||
error: (response) => {
|
error: (response) => {
|
||||||
console.error("Date save error:", response);
|
// Handle error
|
||||||
}
|
}
|
||||||
}).on('save', function(e, params) {
|
|
||||||
console.log("Date save event:", params);
|
|
||||||
console.log("Value being saved:", params.newValue);
|
|
||||||
console.log("Submit value:", params.submitValue);
|
|
||||||
}).on('nochange', function(e) {
|
|
||||||
console.log("Date nochange event fired - values are considered equal");
|
|
||||||
}).on('shown', function(e, editable) {
|
|
||||||
console.log("Datepicker shown event fired", editable);
|
|
||||||
|
|
||||||
// Check if the type is now set
|
|
||||||
if (editable && editable.input) {
|
|
||||||
console.log("Input type after shown:", editable.input.type);
|
|
||||||
console.log("Editable type after shown:", editable.type);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Debug: Check if datepicker elements exist in DOM
|
|
||||||
console.log("Looking for datepicker in DOM...");
|
|
||||||
console.log("Datepicker elements found:", $('.datepicker').length);
|
|
||||||
console.log("Bootstrap datepicker elements found:", $('.bootstrap-datepicker').length);
|
|
||||||
console.log("All datepicker classes:", $('[class*="datepicker"]').length);
|
|
||||||
|
|
||||||
// Check if any datepicker elements are visible
|
|
||||||
$('.datepicker, .bootstrap-datepicker, [class*="datepicker"]').each(function(i, el) {
|
|
||||||
console.log(`Datepicker element ${i}:`, {
|
|
||||||
class: el.className,
|
|
||||||
visible: $(el).is(':visible'),
|
|
||||||
display: $(el).css('display'),
|
|
||||||
position: $(el).css('position'),
|
|
||||||
zIndex: $(el).css('z-index')
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Debug the input element that should have datepicker
|
|
||||||
if (editable && editable.input && editable.input.$input) {
|
|
||||||
console.log("Input element:", editable.input.$input[0]);
|
|
||||||
console.log("Input datepicker data:", editable.input.$input.data('datepicker'));
|
|
||||||
|
|
||||||
// Check if bootstrap-datepicker functions are available on the input
|
|
||||||
console.log("Input $input.datepicker available:", typeof editable.input.$input.datepicker);
|
|
||||||
console.log("Input $input.bdatepicker available:", typeof editable.input.$input.bdatepicker);
|
|
||||||
|
|
||||||
// Check if the datepicker is properly initialized (no manual override)
|
|
||||||
console.log("Checking if datepicker is properly initialized without manual intervention");
|
|
||||||
}
|
|
||||||
}).on('hidden', function(e, reason) {
|
|
||||||
console.log("Datepicker hidden event fired, reason:", reason);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Datepicker element setup complete:", $('#datepicker').data('editable'));
|
|
||||||
|
|
||||||
// Wait a bit for initialization and then check again
|
|
||||||
setTimeout(function() {
|
|
||||||
console.log("=== CHECKING DATEPICKER AFTER TIMEOUT ===");
|
|
||||||
const datepickerEd = $('#datepicker').data('editable');
|
|
||||||
if (datepickerEd) {
|
|
||||||
console.log("DATEPICKER TYPE:", datepickerEd.type, "OPTIONS:", datepickerEd.options);
|
|
||||||
console.log("DATEPICKER INPUT:", datepickerEd.input);
|
|
||||||
if (datepickerEd.input) {
|
|
||||||
console.log("DATEPICKER INPUT TYPE:", typeof datepickerEd.input);
|
|
||||||
console.log("DATEPICKER INPUT CONSTRUCTOR:", datepickerEd.input.constructor.name);
|
|
||||||
console.log("DATEPICKER INPUT internal type:", datepickerEd.input.type);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log("NO DATEPICKER EDITABLE DATA FOUND!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Also check available input types
|
|
||||||
console.log("Available input types:", Object.keys($.fn.editabletypes || {}));
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user