@alaarab/ogrid-js 2.4.1 → 2.4.2

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.
package/dist/esm/index.js CHANGED
@@ -10867,6 +10867,7 @@ var InlineCellEditor = class {
10867
10867
  this.onCommit = null;
10868
10868
  this.onCancel = null;
10869
10869
  this.onAfterCommit = null;
10870
+ this.scrollCleanup = null;
10870
10871
  this.container = container;
10871
10872
  }
10872
10873
  startEdit(rowId, columnId, item, column, cell, onCommit, onCancel, onAfterCommit) {
@@ -10905,6 +10906,14 @@ var InlineCellEditor = class {
10905
10906
  } else {
10906
10907
  dropdownEl.style.top = `${rect.bottom}px`;
10907
10908
  }
10909
+ const scrollParent = editor.closest(".ogrid-table-wrapper") ?? editor.closest('[style*="overflow"]');
10910
+ const handleScroll = () => this.closeEditor();
10911
+ if (scrollParent) scrollParent.addEventListener("scroll", handleScroll, { passive: true });
10912
+ window.addEventListener("scroll", handleScroll, { passive: true });
10913
+ this.scrollCleanup = () => {
10914
+ if (scrollParent) scrollParent.removeEventListener("scroll", handleScroll);
10915
+ window.removeEventListener("scroll", handleScroll);
10916
+ };
10908
10917
  }
10909
10918
  }
10910
10919
  /** Returns the cell currently being edited, or null if no editor is open. */
@@ -10912,6 +10921,8 @@ var InlineCellEditor = class {
10912
10921
  return this.editingCell;
10913
10922
  }
10914
10923
  closeEditor() {
10924
+ this.scrollCleanup?.();
10925
+ this.scrollCleanup = null;
10915
10926
  if (this.editingCell && this.container.isConnected) {
10916
10927
  const { rowId, columnId } = this.editingCell;
10917
10928
  const row = this.container.querySelector(`tr[data-row-id="${rowId}"]`);
@@ -8,6 +8,7 @@ export declare class InlineCellEditor<T> {
8
8
  private onCommit;
9
9
  private onCancel;
10
10
  private onAfterCommit;
11
+ private scrollCleanup;
11
12
  constructor(container: HTMLElement);
12
13
  startEdit(rowId: RowId, columnId: string, item: T, column: IColumnDef<T>, cell: HTMLTableCellElement, onCommit: (rowId: RowId, columnId: string, value: unknown) => void, onCancel: () => void, onAfterCommit?: () => void): void;
13
14
  /** Returns the cell currently being edited, or null if no editor is open. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-js",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "OGrid vanilla JS – framework-free data grid with sorting, filtering, pagination, and spreadsheet-style editing.",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -36,7 +36,7 @@
36
36
  "node": ">=18"
37
37
  },
38
38
  "dependencies": {
39
- "@alaarab/ogrid-core": "2.4.1"
39
+ "@alaarab/ogrid-core": "2.4.2"
40
40
  },
41
41
  "sideEffects": [
42
42
  "**/*.css"