cloud-ide-element 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -217,6 +217,7 @@ class PortalService {
|
|
|
217
217
|
portal.parentNode.removeChild(portal);
|
|
218
218
|
this.portals.delete(id);
|
|
219
219
|
this.closeCallbacks.delete(id);
|
|
220
|
+
this.cleanupEventListeners();
|
|
220
221
|
return;
|
|
221
222
|
}
|
|
222
223
|
// Handle template portals
|
|
@@ -228,6 +229,7 @@ class PortalService {
|
|
|
228
229
|
templatePortal.viewRef.destroy();
|
|
229
230
|
this.templatePortals.delete(id);
|
|
230
231
|
this.closeCallbacks.delete(id);
|
|
232
|
+
this.cleanupEventListeners();
|
|
231
233
|
}
|
|
232
234
|
}
|
|
233
235
|
/**
|
|
@@ -333,8 +335,9 @@ class PortalService {
|
|
|
333
335
|
portal.style.top = `${adjustedTop}px`;
|
|
334
336
|
}
|
|
335
337
|
setupEventListeners(id, config) {
|
|
336
|
-
// Set up event listeners only once
|
|
337
|
-
|
|
338
|
+
// Set up event listeners only once when first portal is created
|
|
339
|
+
const totalPortals = this.portals.size + this.templatePortals.size;
|
|
340
|
+
if (totalPortals === 1) {
|
|
338
341
|
if (config.closeOnClickOutside) {
|
|
339
342
|
document.addEventListener('click', this.boundClickOutsideHandler);
|
|
340
343
|
}
|
|
@@ -345,7 +348,8 @@ class PortalService {
|
|
|
345
348
|
}
|
|
346
349
|
cleanupEventListeners() {
|
|
347
350
|
// Clean up event listeners when no portals exist
|
|
348
|
-
|
|
351
|
+
const totalPortals = this.portals.size + this.templatePortals.size;
|
|
352
|
+
if (totalPortals === 0) {
|
|
349
353
|
document.removeEventListener('click', this.boundClickOutsideHandler);
|
|
350
354
|
document.removeEventListener('keydown', this.boundEscapeHandler);
|
|
351
355
|
}
|
|
@@ -563,7 +567,10 @@ class CideInputComponent {
|
|
|
563
567
|
/** @description when form control change from model side this method is implemented */
|
|
564
568
|
writeValue(value) {
|
|
565
569
|
if (!this.isNgModel) {
|
|
566
|
-
|
|
570
|
+
let ngModel = this.autoCapitalizeByOption(value, this.type);
|
|
571
|
+
if (this.type === 'date') {
|
|
572
|
+
ngModel = this.processValue(ngModel, this.type);
|
|
573
|
+
}
|
|
567
574
|
console.log('writeValue', this.ngModel, ngModel);
|
|
568
575
|
this.ngModel = ngModel;
|
|
569
576
|
}
|
|
@@ -935,7 +942,9 @@ class CideInputComponent {
|
|
|
935
942
|
*/
|
|
936
943
|
formatDate(date) {
|
|
937
944
|
if (typeof date === 'string') {
|
|
938
|
-
date
|
|
945
|
+
// Parse date string in YYYY-MM-DD format to avoid timezone issues
|
|
946
|
+
const [year, month, day] = date.split('-').map(Number);
|
|
947
|
+
date = new Date(year, month - 1, day); // month is 0-indexed
|
|
939
948
|
}
|
|
940
949
|
if (date instanceof Date && !isNaN(date.getTime())) {
|
|
941
950
|
const year = date.getFullYear();
|
|
@@ -950,7 +959,9 @@ class CideInputComponent {
|
|
|
950
959
|
*/
|
|
951
960
|
formatDateForDisplay(date) {
|
|
952
961
|
if (typeof date === 'string') {
|
|
953
|
-
date
|
|
962
|
+
// Parse date string in YYYY-MM-DD format to avoid timezone issues
|
|
963
|
+
const [year, month, day] = date.split('-').map(Number);
|
|
964
|
+
date = new Date(year, month - 1, day); // month is 0-indexed
|
|
954
965
|
}
|
|
955
966
|
if (date instanceof Date && !isNaN(date.getTime())) {
|
|
956
967
|
const day = date.getDate().toString().padStart(2, '0');
|
|
@@ -977,7 +988,9 @@ class CideInputComponent {
|
|
|
977
988
|
initializeDatePicker() {
|
|
978
989
|
// Set selected date from current value
|
|
979
990
|
if (this.ngModel && typeof this.ngModel === 'string') {
|
|
980
|
-
|
|
991
|
+
// Parse date string in YYYY-MM-DD format to avoid timezone issues
|
|
992
|
+
const [year, month, day] = this.ngModel.split('-').map(Number);
|
|
993
|
+
this.selectedDate = new Date(year, month - 1, day); // month is 0-indexed
|
|
981
994
|
if (!isNaN(this.selectedDate.getTime())) {
|
|
982
995
|
this.currentMonth = this.selectedDate.getMonth();
|
|
983
996
|
this.currentYear = this.selectedDate.getFullYear();
|
|
@@ -1117,8 +1130,11 @@ class CideInputComponent {
|
|
|
1117
1130
|
return;
|
|
1118
1131
|
// Set the selected date
|
|
1119
1132
|
this.selectedDate = dayInfo.date;
|
|
1120
|
-
// Update the input value
|
|
1121
|
-
const
|
|
1133
|
+
// Update the input value - Use local date formatting to avoid timezone issues
|
|
1134
|
+
const year = dayInfo.date.getFullYear();
|
|
1135
|
+
const month = String(dayInfo.date.getMonth() + 1).padStart(2, '0');
|
|
1136
|
+
const day = String(dayInfo.date.getDate()).padStart(2, '0');
|
|
1137
|
+
const formattedDate = `${year}-${month}-${day}`; // YYYY-MM-DD format
|
|
1122
1138
|
this.ngModel = formattedDate;
|
|
1123
1139
|
this.ngModelChange?.emit(formattedDate);
|
|
1124
1140
|
this.onChange(formattedDate);
|
|
@@ -1591,6 +1607,7 @@ class CideSelectComponent {
|
|
|
1591
1607
|
isValid = true;
|
|
1592
1608
|
searchTerm = '';
|
|
1593
1609
|
filteredOptions = [];
|
|
1610
|
+
searchDebounceTimeout = null;
|
|
1594
1611
|
dropdownPosition = 'bottom';
|
|
1595
1612
|
isDropdownInteraction = false;
|
|
1596
1613
|
// Debug tracking properties
|
|
@@ -1702,6 +1719,11 @@ class CideSelectComponent {
|
|
|
1702
1719
|
// Cleanup method to prevent memory leaks
|
|
1703
1720
|
ngOnDestroy() {
|
|
1704
1721
|
this.clearTimeouts();
|
|
1722
|
+
// Clear search debounce timeout
|
|
1723
|
+
if (this.searchDebounceTimeout) {
|
|
1724
|
+
clearTimeout(this.searchDebounceTimeout);
|
|
1725
|
+
this.searchDebounceTimeout = null;
|
|
1726
|
+
}
|
|
1705
1727
|
window.removeEventListener('resize', this.onWindowResize.bind(this));
|
|
1706
1728
|
this.logDebug('Component destroyed, timeouts cleared');
|
|
1707
1729
|
}
|
|
@@ -1873,10 +1895,17 @@ class CideSelectComponent {
|
|
|
1873
1895
|
try {
|
|
1874
1896
|
this.searchTerm = event.target.value;
|
|
1875
1897
|
this.filterOptions();
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
}
|
|
1898
|
+
// Clear existing debounce timeout
|
|
1899
|
+
if (this.searchDebounceTimeout) {
|
|
1900
|
+
clearTimeout(this.searchDebounceTimeout);
|
|
1901
|
+
}
|
|
1902
|
+
// Set new debounce timeout (300ms delay)
|
|
1903
|
+
this.searchDebounceTimeout = setTimeout(() => {
|
|
1904
|
+
this.searchChange.emit({
|
|
1905
|
+
query: this.searchTerm,
|
|
1906
|
+
value: ''
|
|
1907
|
+
});
|
|
1908
|
+
}, 400);
|
|
1880
1909
|
}
|
|
1881
1910
|
catch (error) {
|
|
1882
1911
|
console.error(`💥 SELECT [${this.debugId}] onSearchInput error:`, error);
|