@alaarab/ogrid-angular 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
@@ -5221,6 +5221,7 @@ var BaseInlineCellEditorComponent = class {
5221
5221
  this.highlightedIndex = signal(0);
5222
5222
  this.selectOptions = signal([]);
5223
5223
  this.searchText = signal("");
5224
+ this.scrollCleanup = null;
5224
5225
  this.filteredOptions = computed(() => {
5225
5226
  const options = this.selectOptions();
5226
5227
  const search = this.searchText().trim().toLowerCase();
@@ -5260,12 +5261,14 @@ var BaseInlineCellEditorComponent = class {
5260
5261
  richSelectInput.focus();
5261
5262
  richSelectInput.select();
5262
5263
  this.positionFixedDropdown(this.richSelectWrapper, this.richSelectDropdown);
5264
+ this.attachScrollClose(this.richSelectWrapper?.nativeElement);
5263
5265
  return;
5264
5266
  }
5265
5267
  const selectWrap = this.selectWrapper?.nativeElement;
5266
5268
  if (selectWrap) {
5267
5269
  selectWrap.focus();
5268
5270
  this.positionFixedDropdown(this.selectWrapper, this.selectDropdown);
5271
+ this.attachScrollClose(selectWrap);
5269
5272
  return;
5270
5273
  }
5271
5274
  const el = this.inputEl?.nativeElement;
@@ -5282,6 +5285,21 @@ var BaseInlineCellEditorComponent = class {
5282
5285
  }
5283
5286
  });
5284
5287
  }
5288
+ ngOnDestroy() {
5289
+ this.scrollCleanup?.();
5290
+ }
5291
+ /** Attach scroll listeners to close the editor when the grid scrolls. */
5292
+ attachScrollClose(wrapper) {
5293
+ if (!wrapper) return;
5294
+ const scrollParent = wrapper.closest(".ogrid-table-wrapper") ?? wrapper.closest('[style*="overflow"]');
5295
+ const handleScroll = () => this.cancel.emit();
5296
+ if (scrollParent) scrollParent.addEventListener("scroll", handleScroll, { passive: true });
5297
+ window.addEventListener("scroll", handleScroll, { passive: true });
5298
+ this.scrollCleanup = () => {
5299
+ if (scrollParent) scrollParent.removeEventListener("scroll", handleScroll);
5300
+ window.removeEventListener("scroll", handleScroll);
5301
+ };
5302
+ }
5285
5303
  commitValue(value) {
5286
5304
  this.commit.emit(value);
5287
5305
  }
@@ -25,12 +25,16 @@ export declare abstract class BaseInlineCellEditorComponent<T = unknown> {
25
25
  readonly highlightedIndex: import("@angular/core").WritableSignal<number>;
26
26
  readonly selectOptions: import("@angular/core").WritableSignal<unknown[]>;
27
27
  readonly searchText: import("@angular/core").WritableSignal<string>;
28
+ private scrollCleanup;
28
29
  readonly filteredOptions: import("@angular/core").Signal<unknown[]>;
29
30
  private _initialized;
30
31
  ngOnInit(): void;
31
32
  ngOnChanges(): void;
32
33
  private syncFromInputs;
33
34
  ngAfterViewInit(): void;
35
+ ngOnDestroy(): void;
36
+ /** Attach scroll listeners to close the editor when the grid scrolls. */
37
+ private attachScrollClose;
34
38
  commitValue(value: unknown): void;
35
39
  onTextKeyDown(e: KeyboardEvent): void;
36
40
  getDisplayText(value: unknown): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-angular",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "OGrid Angular – Angular services, signals, and headless components for OGrid data grids.",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -35,7 +35,7 @@
35
35
  "node": ">=18"
36
36
  },
37
37
  "dependencies": {
38
- "@alaarab/ogrid-core": "2.4.1"
38
+ "@alaarab/ogrid-core": "2.4.2"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@angular/core": "^21.0.0",