ms-data-grid 0.0.145 → 0.0.147

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.
@@ -4778,10 +4778,16 @@ class DataGridComponent {
4778
4778
  setTimeout(() => {
4779
4779
  const dropdownMenu = document.querySelector('.cell-editing-dropdown-menu');
4780
4780
  if (dropdownMenu) {
4781
- const rect = dropdownMenu.getBoundingClientRect();
4782
- const windowHeight = this.dataGridContainer.nativeElement?.offsetHeight;
4783
- if (rect.bottom > windowHeight) {
4784
- dropdownMenu.style.top = `-${rect.height}px`;
4781
+ const menuHeight = dropdownMenu.offsetHeight;
4782
+ const containerRect = this.dataGridContainer.nativeElement.getBoundingClientRect();
4783
+ const menuRect = dropdownMenu.getBoundingClientRect();
4784
+ const spaceBelow = containerRect.bottom - menuRect.top;
4785
+ const spaceAbove = menuRect.top - containerRect.top - (this.showFilterRow && this.showColumnsGrouping ? this.headerRowHeight * 3 : (this.showFilterRow || this.showColumnsGrouping ? this.headerRowHeight * 2 : this.headerRowHeight)) - (this.showRowsGrouping ? this.topFilterRowHeight : 0);
4786
+ if (spaceBelow >= menuHeight) {
4787
+ dropdownMenu.style.top = '100%';
4788
+ }
4789
+ else if (spaceAbove >= menuHeight) {
4790
+ dropdownMenu.style.top = `-${menuHeight}px`;
4785
4791
  }
4786
4792
  else {
4787
4793
  dropdownMenu.style.top = '100%';
@@ -4841,7 +4847,7 @@ class DataGridComponent {
4841
4847
  this.editingKey = null;
4842
4848
  this.cdr.detectChanges();
4843
4849
  const current = this.getNestedValue(row, column?.field);
4844
- if (!current || (column.type == 'email' && !this.validateEmail(current))) {
4850
+ if ((column.type == 'email' && !this.validateEmail(current))) {
4845
4851
  const originalRow = this.originalDataSet.find(item => ((item.id && item.id == row.id) || (item.id && item.id == row._id)));
4846
4852
  const original = this.getNestedValue(originalRow, column?.field);
4847
4853
  this.setNestedValue(row, column, original);
@@ -4947,7 +4953,7 @@ class DataGridComponent {
4947
4953
  }
4948
4954
  }
4949
4955
  if (this.originalDataSet && Array.isArray(this.originalDataSet)) {
4950
- const originalRowIndex = this.originalDataSet.findIndex(r => r.id === obj.id || r._id === obj._id);
4956
+ const originalRowIndex = this.originalDataSet.findIndex(r => (r?.id && r?.id === obj?.id) || (r?._id && r._id === obj._id));
4951
4957
  if (originalRowIndex !== -1) {
4952
4958
  const originalParent = keys.reduce((acc, key) => acc[key] ??= {}, this.originalDataSet[originalRowIndex]);
4953
4959
  if (originalParent && lastKey) {