cloud-ide-element 1.0.27 → 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
- if (this.portals.size === 1) {
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
- if (this.portals.size === 0) {
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
  }
@@ -938,7 +942,9 @@ class CideInputComponent {
938
942
  */
939
943
  formatDate(date) {
940
944
  if (typeof date === 'string') {
941
- date = new Date(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
942
948
  }
943
949
  if (date instanceof Date && !isNaN(date.getTime())) {
944
950
  const year = date.getFullYear();
@@ -953,7 +959,9 @@ class CideInputComponent {
953
959
  */
954
960
  formatDateForDisplay(date) {
955
961
  if (typeof date === 'string') {
956
- date = new Date(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
957
965
  }
958
966
  if (date instanceof Date && !isNaN(date.getTime())) {
959
967
  const day = date.getDate().toString().padStart(2, '0');
@@ -980,7 +988,9 @@ class CideInputComponent {
980
988
  initializeDatePicker() {
981
989
  // Set selected date from current value
982
990
  if (this.ngModel && typeof this.ngModel === 'string') {
983
- this.selectedDate = new Date(this.ngModel);
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
984
994
  if (!isNaN(this.selectedDate.getTime())) {
985
995
  this.currentMonth = this.selectedDate.getMonth();
986
996
  this.currentYear = this.selectedDate.getFullYear();
@@ -1120,8 +1130,11 @@ class CideInputComponent {
1120
1130
  return;
1121
1131
  // Set the selected date
1122
1132
  this.selectedDate = dayInfo.date;
1123
- // Update the input value
1124
- const formattedDate = dayInfo.date.toISOString().split('T')[0]; // YYYY-MM-DD format
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
1125
1138
  this.ngModel = formattedDate;
1126
1139
  this.ngModelChange?.emit(formattedDate);
1127
1140
  this.onChange(formattedDate);
@@ -1594,6 +1607,7 @@ class CideSelectComponent {
1594
1607
  isValid = true;
1595
1608
  searchTerm = '';
1596
1609
  filteredOptions = [];
1610
+ searchDebounceTimeout = null;
1597
1611
  dropdownPosition = 'bottom';
1598
1612
  isDropdownInteraction = false;
1599
1613
  // Debug tracking properties
@@ -1705,6 +1719,11 @@ class CideSelectComponent {
1705
1719
  // Cleanup method to prevent memory leaks
1706
1720
  ngOnDestroy() {
1707
1721
  this.clearTimeouts();
1722
+ // Clear search debounce timeout
1723
+ if (this.searchDebounceTimeout) {
1724
+ clearTimeout(this.searchDebounceTimeout);
1725
+ this.searchDebounceTimeout = null;
1726
+ }
1708
1727
  window.removeEventListener('resize', this.onWindowResize.bind(this));
1709
1728
  this.logDebug('Component destroyed, timeouts cleared');
1710
1729
  }
@@ -1876,10 +1895,17 @@ class CideSelectComponent {
1876
1895
  try {
1877
1896
  this.searchTerm = event.target.value;
1878
1897
  this.filterOptions();
1879
- this.searchChange.emit({
1880
- query: this.searchTerm,
1881
- value: ''
1882
- });
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);
1883
1909
  }
1884
1910
  catch (error) {
1885
1911
  console.error(`💥 SELECT [${this.debugId}] onSearchInput error:`, error);