@gp-grid/angular 0.17.0 → 0.18.0

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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, output, computed, TemplateRef, ChangeDetectionStrategy, Component, ViewChild, signal, effect, HostListener, inject, PLATFORM_ID, InjectionToken, Injectable } from '@angular/core';
3
3
  import { NgTemplateOutlet, isPlatformBrowser } from '@angular/common';
4
- import { getFieldValue, isCellSelected, isCellActive, formatCellValue, isCellInFillPreview, buildCellClasses, isCellEditing, calculateFilterPopupPosition, bindPeekSelectAll, calculateScaledColumnPositions, getTotalWidth, calculateFillHandlePosition, DataSourceOwner, AutoScrollDriver, PendingRowDragController, InputEventAdapter, applyBatchInstructions, scrollCellIntoView, GridCore, createMutableClientDataSource } from '@gp-grid/core';
4
+ import { getFieldValue, isCellSelected, isCellActive, formatCellValue, isCellInFillPreview, buildCellClasses, isCellEditing, calculateFilterPopupPosition, bindPeekSelectAll, calculateScaledColumnPositions, getTotalWidth, calculateFillHandlePosition, DataSourceOwner, AutoScrollDriver, PendingRowDragController, PendingCellTapController, TouchScrollController, InputEventAdapter, applyBatchInstructions, scrollCellIntoView, GridCore, createMutableClientDataSource } from '@gp-grid/core';
5
5
  export { GridCore, createClientDataSource, createDataSourceFromArray, createMutableClientDataSource, createServerDataSource } from '@gp-grid/core';
6
6
 
7
7
  const TEMPLATE$2 = `
@@ -1470,6 +1470,8 @@ class GpGridBindings {
1470
1470
  dataSourceOwner = new DataSourceOwner();
1471
1471
  autoScroll;
1472
1472
  pendingRowDrag;
1473
+ pendingCellTap;
1474
+ touchScroll;
1473
1475
  input;
1474
1476
  coreRef = null;
1475
1477
  unsubscribe = null;
@@ -1483,11 +1485,22 @@ class GpGridBindings {
1483
1485
  isBrowser: this.deps.isBrowser,
1484
1486
  onDragConfirmed: (state) => this.deps.vm.dragState.set(state),
1485
1487
  });
1488
+ this.pendingCellTap = new PendingCellTapController({
1489
+ getCore: () => this.coreRef,
1490
+ isBrowser: this.deps.isBrowser,
1491
+ onTapConfirmed: () => this.deps.getContainer()?.focus(),
1492
+ });
1493
+ this.touchScroll = new TouchScrollController({
1494
+ getCore: () => this.coreRef,
1495
+ getScrollEl: this.deps.getBody,
1496
+ isBrowser: this.deps.isBrowser,
1497
+ });
1486
1498
  this.input = new InputEventAdapter({
1487
1499
  getCore: () => this.coreRef,
1488
1500
  getBodyEl: this.deps.getBody,
1489
1501
  autoScroll: this.autoScroll,
1490
1502
  pendingRowDrag: this.pendingRowDrag,
1503
+ pendingCellTap: this.pendingCellTap,
1491
1504
  onDragStateChange: (state) => this.deps.vm.dragState.set(state),
1492
1505
  });
1493
1506
  }
@@ -1517,11 +1530,16 @@ class GpGridBindings {
1517
1530
  });
1518
1531
  this.resizeObserver.observe(container);
1519
1532
  this.coreRef?.setViewport(0, 0, container.clientWidth, bodyEl.clientHeight);
1533
+ // Synthetic touch scrolling: takes over touch gestures only when scroll
1534
+ // virtualization compresses the DOM scroll space; inert otherwise.
1535
+ this.touchScroll.attach();
1520
1536
  }
1521
1537
  destroy() {
1522
1538
  this.autoScroll.stop();
1523
1539
  this.pendingRowDrag.cancel();
1524
1540
  this.pendingRowDrag.releaseLocks();
1541
+ this.pendingCellTap.cancel();
1542
+ this.touchScroll.detach();
1525
1543
  this.unsubscribe?.();
1526
1544
  this.resizeObserver?.disconnect();
1527
1545
  this.coreRef?.destroy();
@@ -1553,16 +1571,22 @@ class GpGridBindings {
1553
1571
  const top = this.deps.vm.pendingScrollTop();
1554
1572
  const body = this.deps.getBody();
1555
1573
  if (top !== null && body) {
1574
+ this.touchScroll.stop();
1556
1575
  body.scrollTop = top;
1557
1576
  this.deps.vm.pendingScrollTop.set(null);
1558
1577
  }
1559
1578
  }
1560
- scrollToRow(row) {
1579
+ scrollToCell(cell) {
1561
1580
  const core = this.coreRef;
1562
1581
  const body = this.deps.getBody();
1563
1582
  if (core === null || body === null)
1564
1583
  return;
1565
- scrollCellIntoView(core, body, row, this.deps.getRowHeight(), this.deps.vm.slots(), this.deps.vm.rowsWrapperOffset());
1584
+ scrollCellIntoView(core, body, cell.row, this.deps.getRowHeight(), this.deps.vm.slots(), this.deps.vm.rowsWrapperOffset(), {
1585
+ colIndex: cell.col,
1586
+ visibleColumns: this.deps.vm.visibleColumnWithIndices(),
1587
+ columnPositions: this.deps.vm.columnPositions(),
1588
+ columnWidths: this.deps.vm.columnWidths(),
1589
+ });
1566
1590
  }
1567
1591
  }
1568
1592
 
@@ -1762,7 +1786,7 @@ class GpGridComponent {
1762
1786
  if (result.preventDefault)
1763
1787
  event.preventDefault();
1764
1788
  if (result.scrollToCell)
1765
- this.bindings.scrollToRow(result.scrollToCell.row);
1789
+ this.bindings.scrollToCell(result.scrollToCell);
1766
1790
  }
1767
1791
  onPaste(event) {
1768
1792
  const editing = this.vm.editingCell();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gp-grid/angular",
3
3
  "description": "A high-performance Angular data grid component with virtual scrolling, cell selection, sorting, filtering, and Excel-like editing",
4
- "version": "0.17.0",
4
+ "version": "0.18.0",
5
5
  "license": "Apache-2.0",
6
6
  "module": "fesm2022/gp-grid-angular.mjs",
7
7
  "typings": "types/gp-grid-angular.d.ts",
@@ -51,7 +51,7 @@
51
51
  "@angular/core": ">=18.0.0"
52
52
  },
53
53
  "dependencies": {
54
- "@gp-grid/core": "0.17.0",
54
+ "@gp-grid/core": "0.18.0",
55
55
  "tslib": "^2.8.1"
56
56
  },
57
57
  "sideEffects": false,