@gp-grid/core 0.16.1 → 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.
- package/README.md +3 -3
- package/dist/index.d.ts +257 -21
- package/dist/index.js +263 -100
- package/dist/styles.css +249 -86
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
<a href="https://www.gp-grid.io">
|
|
5
5
|
<picture>
|
|
6
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://
|
|
7
|
-
<source media="(prefers-color-scheme: light)" srcset="https://
|
|
8
|
-
<img width="50%" alt="
|
|
6
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://www.gp-grid.io/logo-light.svg"/>
|
|
7
|
+
<source media="(prefers-color-scheme: light)" srcset="https://www.gp-grid.io/logo-dark.svg"/>
|
|
8
|
+
<img width="50%" alt="gp-grid Logo" src="https://www.gp-grid.io/logo-dark.svg"/>
|
|
9
9
|
</picture>
|
|
10
10
|
</a>
|
|
11
11
|
<div align="center">
|
package/dist/index.d.ts
CHANGED
|
@@ -242,6 +242,19 @@ interface ColumnDefinition {
|
|
|
242
242
|
movable?: boolean;
|
|
243
243
|
/** Whether this column acts as a drag handle for row dragging. Default: false */
|
|
244
244
|
rowDrag?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Whether double-clicking a non-editable cell opens a read-only peek overlay
|
|
247
|
+
* that wraps the value across multiple lines. Ignored when `editable` is true
|
|
248
|
+
* (double-click starts editing instead). Default: true.
|
|
249
|
+
*/
|
|
250
|
+
peekable?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Whether to set a native `title` attribute on cells in this column so the
|
|
253
|
+
* browser shows the full formatted value on hover. Useful when text is
|
|
254
|
+
* truncated by the cell width. Default: true. Set false to opt out — e.g.
|
|
255
|
+
* for cells whose custom renderer already provides its own tooltip.
|
|
256
|
+
*/
|
|
257
|
+
tooltip?: boolean;
|
|
245
258
|
/** Renderer key for adapter lookup, or inline renderer function */
|
|
246
259
|
cellRenderer?: string | ((params: CellRendererParams) => unknown);
|
|
247
260
|
editRenderer?: string | ((params: EditRendererParams) => unknown);
|
|
@@ -252,6 +265,14 @@ interface ColumnDefinition {
|
|
|
252
265
|
* default JSON.stringify may not be suitable (e.g., display a single field of an object).
|
|
253
266
|
*/
|
|
254
267
|
valueFormatter?: (value: CellValue) => string;
|
|
268
|
+
/**
|
|
269
|
+
* Pre-supplied set of all possible values for the filter popup's "values" mode.
|
|
270
|
+
* When provided, the grid skips scanning row data to discover distinct values —
|
|
271
|
+
* use this for large datasets to avoid an O(n) scan when the value domain is
|
|
272
|
+
* known up front (e.g., enums, fixed tag lists). Values are still de-duplicated
|
|
273
|
+
* and sorted by their display string.
|
|
274
|
+
*/
|
|
275
|
+
distinctValues?: CellValue[];
|
|
255
276
|
/**
|
|
256
277
|
* Per-column override for column-level highlighting.
|
|
257
278
|
* If defined, overrides grid-level computeColumnClasses for this column.
|
|
@@ -435,6 +456,16 @@ interface CommitEditInstruction {
|
|
|
435
456
|
col: number;
|
|
436
457
|
value: CellValue;
|
|
437
458
|
}
|
|
459
|
+
/** Open a peek overlay on a cell */
|
|
460
|
+
interface StartPeekInstruction {
|
|
461
|
+
type: "START_PEEK";
|
|
462
|
+
row: number;
|
|
463
|
+
col: number;
|
|
464
|
+
}
|
|
465
|
+
/** Close the active peek overlay */
|
|
466
|
+
interface StopPeekInstruction {
|
|
467
|
+
type: "STOP_PEEK";
|
|
468
|
+
}
|
|
438
469
|
/** Programmatic scroll instruction — tells the framework to set container.scrollTop */
|
|
439
470
|
interface ScrollToInstruction {
|
|
440
471
|
type: "SCROLL_TO";
|
|
@@ -617,7 +648,7 @@ interface CancelRowDragInstruction {
|
|
|
617
648
|
type: "CANCEL_ROW_DRAG";
|
|
618
649
|
}
|
|
619
650
|
/** Union type of all instructions */
|
|
620
|
-
type GridInstruction = /** Slot lifecycle */CreateSlotInstruction | DestroySlotInstruction | AssignSlotInstruction | MoveSlotInstruction /** Scroll */ | ScrollToInstruction /** Selection */ | SetActiveCellInstruction | SetSelectionRangeInstruction | UpdateVisibleRangeInstruction /** Highlighting */ | SetHoverPositionInstruction /** Editing */ | StartEditInstruction | StopEditInstruction | CommitEditInstruction /** Layout */ | SetContentSizeInstruction | UpdateHeaderInstruction /** Filter popup */ | OpenFilterPopupInstruction | CloseFilterPopupInstruction /** Fill handle */ | StartFillInstruction | UpdateFillInstruction | CommitFillInstruction | CancelFillInstruction /** Data */ | DataLoadingInstruction | DataLoadedInstruction | DataErrorInstruction /** Transactions */ | RowsAddedInstruction | RowsRemovedInstruction | RowsUpdatedInstruction | TransactionProcessedInstruction /** Column changes */ | ColumnsChangedInstruction /** Column resize */ | StartColumnResizeInstruction | UpdateColumnResizeInstruction | CommitColumnResizeInstruction | CancelColumnResizeInstruction /** Column move */ | StartColumnMoveInstruction | UpdateColumnMoveInstruction | CommitColumnMoveInstruction | CancelColumnMoveInstruction /** Row drag */ | StartRowDragInstruction | UpdateRowDragInstruction | CommitRowDragInstruction | CancelRowDragInstruction;
|
|
651
|
+
type GridInstruction = /** Slot lifecycle */CreateSlotInstruction | DestroySlotInstruction | AssignSlotInstruction | MoveSlotInstruction /** Scroll */ | ScrollToInstruction /** Selection */ | SetActiveCellInstruction | SetSelectionRangeInstruction | UpdateVisibleRangeInstruction /** Highlighting */ | SetHoverPositionInstruction /** Editing */ | StartEditInstruction | StopEditInstruction | CommitEditInstruction /** Peek (read-only expand) */ | StartPeekInstruction | StopPeekInstruction /** Layout */ | SetContentSizeInstruction | UpdateHeaderInstruction /** Filter popup */ | OpenFilterPopupInstruction | CloseFilterPopupInstruction /** Fill handle */ | StartFillInstruction | UpdateFillInstruction | CommitFillInstruction | CancelFillInstruction /** Data */ | DataLoadingInstruction | DataLoadedInstruction | DataErrorInstruction /** Transactions */ | RowsAddedInstruction | RowsRemovedInstruction | RowsUpdatedInstruction | TransactionProcessedInstruction /** Column changes */ | ColumnsChangedInstruction /** Column resize */ | StartColumnResizeInstruction | UpdateColumnResizeInstruction | CommitColumnResizeInstruction | CancelColumnResizeInstruction /** Column move */ | StartColumnMoveInstruction | UpdateColumnMoveInstruction | CommitColumnMoveInstruction | CancelColumnMoveInstruction /** Row drag */ | StartRowDragInstruction | UpdateRowDragInstruction | CommitRowDragInstruction | CancelRowDragInstruction;
|
|
621
652
|
/** Instruction listener: Single instruction Listener that receives a single instruction, used by frameworks to update their state */
|
|
622
653
|
type InstructionListener = (instruction: GridInstruction) => void;
|
|
623
654
|
/** Batch instruction listener: Batch instruction Listener that receives an array of instructions, used by frameworks to update their state */
|
|
@@ -736,6 +767,12 @@ interface InputResult {
|
|
|
736
767
|
focusContainer?: boolean;
|
|
737
768
|
/** Type of drag operation to start (framework manages global listeners) */
|
|
738
769
|
startDrag?: "selection" | "fill" | "column-resize" | "column-move" | "row-drag" | "row-drag-pending";
|
|
770
|
+
/**
|
|
771
|
+
* Whether the framework should track a pending cell tap (touch only).
|
|
772
|
+
* Selection is deferred until the tap is confirmed on pointerup within
|
|
773
|
+
* the tap slop, so scroll gestures never select a cell.
|
|
774
|
+
*/
|
|
775
|
+
startTap?: boolean;
|
|
739
776
|
}
|
|
740
777
|
/** Result from keyboard input handler */
|
|
741
778
|
interface KeyboardResult {
|
|
@@ -1057,6 +1094,15 @@ declare class FillDrag<TData = unknown> {
|
|
|
1057
1094
|
end(): void;
|
|
1058
1095
|
}
|
|
1059
1096
|
//#endregion
|
|
1097
|
+
//#region src/input/interaction-constants.d.ts
|
|
1098
|
+
/**
|
|
1099
|
+
* Maximum pointer travel (px) for a gesture to still count as a tap.
|
|
1100
|
+
* Beyond this the gesture is treated as a scroll/drag.
|
|
1101
|
+
*/
|
|
1102
|
+
declare const TAP_SLOP_PX = 10;
|
|
1103
|
+
/** Hold duration (ms) required to confirm a row drag on touch devices. */
|
|
1104
|
+
declare const ROW_DRAG_HOLD_MS = 300;
|
|
1105
|
+
//#endregion
|
|
1060
1106
|
//#region src/input-handler.d.ts
|
|
1061
1107
|
declare class InputHandler<TData = unknown> {
|
|
1062
1108
|
private readonly core;
|
|
@@ -1067,6 +1113,7 @@ declare class InputHandler<TData = unknown> {
|
|
|
1067
1113
|
readonly selectionDrag: SelectionDrag<TData>;
|
|
1068
1114
|
readonly fillDrag: FillDrag<TData>;
|
|
1069
1115
|
private readonly pendingRowDrag;
|
|
1116
|
+
private readonly pendingCellTap;
|
|
1070
1117
|
private readonly keyboard;
|
|
1071
1118
|
constructor(core: GridCore<TData>, deps: InputHandlerDeps);
|
|
1072
1119
|
/** Update dependencies (called when options change) */
|
|
@@ -1087,6 +1134,8 @@ declare class InputHandler<TData = unknown> {
|
|
|
1087
1134
|
startSelectionDrag(): void;
|
|
1088
1135
|
confirmPendingRowDrag(): boolean;
|
|
1089
1136
|
cancelPendingRowDrag(): void;
|
|
1137
|
+
confirmPendingCellTap(): boolean;
|
|
1138
|
+
cancelPendingCellTap(): void;
|
|
1090
1139
|
handleDragMove(event: PointerEventData, bounds: ContainerBounds): DragMoveResult | null;
|
|
1091
1140
|
private selectionFillMove;
|
|
1092
1141
|
handleDragEnd(): void;
|
|
@@ -1378,11 +1427,6 @@ declare class ScrollVirtualizationManager {
|
|
|
1378
1427
|
* @param virtualScrollTop Current scroll position from container.scrollTop (virtual/scaled)
|
|
1379
1428
|
*/
|
|
1380
1429
|
getRowIndexAtDisplayY(viewportY: number, virtualScrollTop: number): number;
|
|
1381
|
-
/**
|
|
1382
|
-
* Get the virtual content height for external use
|
|
1383
|
-
* @internal
|
|
1384
|
-
*/
|
|
1385
|
-
getVirtualContentHeight(): number;
|
|
1386
1430
|
}
|
|
1387
1431
|
//#endregion
|
|
1388
1432
|
//#region src/managers/sort-filter-manager.d.ts
|
|
@@ -1407,6 +1451,7 @@ declare class SortFilterManager<TData = Record<string, unknown>> {
|
|
|
1407
1451
|
private sortModel;
|
|
1408
1452
|
private filterModel;
|
|
1409
1453
|
private openFilterColIndex;
|
|
1454
|
+
private readonly scanWarnedCols;
|
|
1410
1455
|
onInstruction: (listener: InstructionListener) => () => void;
|
|
1411
1456
|
private readonly emit;
|
|
1412
1457
|
constructor(options: SortFilterManagerOptions<TData>);
|
|
@@ -1427,20 +1472,22 @@ declare class SortFilterManager<TData = Record<string, unknown>> {
|
|
|
1427
1472
|
*/
|
|
1428
1473
|
isColumnFilterable(colIndex: number): boolean;
|
|
1429
1474
|
/**
|
|
1430
|
-
* Get distinct values for a column (for filter dropdowns)
|
|
1431
|
-
* For array-type columns (like tags), each unique array combination is returned.
|
|
1432
|
-
* Arrays are sorted internally for consistent comparison.
|
|
1433
|
-
* Limited to maxValues distinct results and maxScanRows rows scanned.
|
|
1475
|
+
* Get distinct values for a column (for filter dropdowns).
|
|
1434
1476
|
*
|
|
1435
|
-
* When the
|
|
1436
|
-
*
|
|
1437
|
-
*
|
|
1438
|
-
*
|
|
1439
|
-
*
|
|
1440
|
-
* the
|
|
1441
|
-
*
|
|
1477
|
+
* When the column defines `distinctValues`, that list is used directly
|
|
1478
|
+
* (deduplicated + sorted by display string). Otherwise the manager scans
|
|
1479
|
+
* every cached row to compute the set. The previous stride-sampling
|
|
1480
|
+
* fallback was removed because the stride could share a factor with a
|
|
1481
|
+
* repeating value pool, causing some values to be unreachable (the
|
|
1482
|
+
* `bio` field in the demo dataset was a real example: stride 15 with a
|
|
1483
|
+
* pool size of 6 yielded only 2 of 6 values).
|
|
1484
|
+
*
|
|
1485
|
+
* For datasets above {@link DISTINCT_SCAN_WARN_THRESHOLD}, a one-time
|
|
1486
|
+
* console warning advises the consumer to pre-supply `distinctValues`
|
|
1487
|
+
* on the column to skip the full scan.
|
|
1442
1488
|
*/
|
|
1443
|
-
getDistinctValuesForColumn(colId: string, maxValues?: number
|
|
1489
|
+
getDistinctValuesForColumn(colId: string, maxValues?: number): CellValue[];
|
|
1490
|
+
private scanDistinctValues;
|
|
1444
1491
|
/**
|
|
1445
1492
|
* Normalize a cell value into a dedup key and the value to store.
|
|
1446
1493
|
* Arrays are sorted lexicographically so different orderings produce the same key.
|
|
@@ -1833,6 +1880,7 @@ declare class GridCore<TData = unknown> {
|
|
|
1833
1880
|
private readonly onColumnResized?;
|
|
1834
1881
|
private readonly onColumnMoved?;
|
|
1835
1882
|
private readonly viewport;
|
|
1883
|
+
private scrollTopOverride;
|
|
1836
1884
|
private readonly rowData;
|
|
1837
1885
|
readonly selection: SelectionManager;
|
|
1838
1886
|
readonly fill: FillManager;
|
|
@@ -1875,6 +1923,19 @@ declare class GridCore<TData = unknown> {
|
|
|
1875
1923
|
getSortModel(): SortModel[];
|
|
1876
1924
|
getFilterModel(): FilterModel;
|
|
1877
1925
|
startEdit(row: number, col: number): void;
|
|
1926
|
+
/**
|
|
1927
|
+
* Open a read-only peek overlay on a cell. The default cell renderer is
|
|
1928
|
+
* shown in a multi-line container so long values are fully visible.
|
|
1929
|
+
* Returns true if the peek opened (column must be `peekable !== false`
|
|
1930
|
+
* and not currently being edited).
|
|
1931
|
+
*/
|
|
1932
|
+
startPeek(row: number, col: number): boolean;
|
|
1933
|
+
/** Close any active peek overlay. */
|
|
1934
|
+
stopPeek(): void;
|
|
1935
|
+
getPeekState(): {
|
|
1936
|
+
row: number;
|
|
1937
|
+
col: number;
|
|
1938
|
+
} | null;
|
|
1878
1939
|
updateEditValue(value: CellValue): void;
|
|
1879
1940
|
commitEdit(): void;
|
|
1880
1941
|
cancelEdit(): void;
|
|
@@ -2107,6 +2168,8 @@ interface GridState<TData = unknown> {
|
|
|
2107
2168
|
col: number;
|
|
2108
2169
|
initialValue: CellValue;
|
|
2109
2170
|
} | null;
|
|
2171
|
+
/** Cell currently shown in a read-only peek overlay (multi-line expand on double-click) */
|
|
2172
|
+
peekCell: CellPosition | null;
|
|
2110
2173
|
contentWidth: number;
|
|
2111
2174
|
contentHeight: number;
|
|
2112
2175
|
/** Viewport width (container's visible width) for column scaling */
|
|
@@ -2139,7 +2202,23 @@ interface GridState<TData = unknown> {
|
|
|
2139
2202
|
*/
|
|
2140
2203
|
declare const findSlotForRow: (slots: Map<string, SlotData>, rowIndex: number) => SlotData | null;
|
|
2141
2204
|
/**
|
|
2142
|
-
*
|
|
2205
|
+
* Column geometry needed to scroll a cell horizontally into view.
|
|
2206
|
+
* Columns are not scroll-virtualized, so positions map 1:1 to scrollLeft.
|
|
2207
|
+
*/
|
|
2208
|
+
interface ColumnScrollGeometry {
|
|
2209
|
+
/** Original column index of the target cell (matches the active cell) */
|
|
2210
|
+
colIndex: number;
|
|
2211
|
+
/** Visible columns with their original indices, in render order */
|
|
2212
|
+
visibleColumns: readonly {
|
|
2213
|
+
originalIndex: number;
|
|
2214
|
+
}[];
|
|
2215
|
+
/** X positions of visible columns within the scrollable content */
|
|
2216
|
+
columnPositions: readonly number[];
|
|
2217
|
+
/** Widths of visible columns */
|
|
2218
|
+
columnWidths: readonly number[];
|
|
2219
|
+
}
|
|
2220
|
+
/**
|
|
2221
|
+
* Scroll a cell into view if needed, on both axes.
|
|
2143
2222
|
*
|
|
2144
2223
|
* The header is rendered outside the scroll container (flex column layout),
|
|
2145
2224
|
* so all coordinates are relative to the body scroll container.
|
|
@@ -2147,10 +2226,13 @@ declare const findSlotForRow: (slots: Map<string, SlotData>, rowIndex: number) =
|
|
|
2147
2226
|
* When scroll virtualization is active, slot.translateY is relative to the
|
|
2148
2227
|
* first visible row, and the rows wrapper is offset by rowsWrapperOffset.
|
|
2149
2228
|
* The actual DOM position of a row is: rowsWrapperOffset + slot.translateY.
|
|
2229
|
+
*
|
|
2230
|
+
* Horizontal scrolling only happens when column geometry is provided; the
|
|
2231
|
+
* resulting native scroll event drives header sync and setViewport as usual.
|
|
2150
2232
|
*/
|
|
2151
2233
|
declare const scrollCellIntoView: (core: {
|
|
2152
2234
|
getScrollTopForRow(row: number): number;
|
|
2153
|
-
}, container: HTMLElement, row: number, rowHeight: number, slots: Map<string, SlotData>, rowsWrapperOffset?: number) => void;
|
|
2235
|
+
}, container: HTMLElement, row: number, rowHeight: number, slots: Map<string, SlotData>, rowsWrapperOffset?: number, columns?: ColumnScrollGeometry) => void;
|
|
2154
2236
|
//#endregion
|
|
2155
2237
|
//#region src/utils/format-helpers.d.ts
|
|
2156
2238
|
/**
|
|
@@ -2210,6 +2292,22 @@ interface PopupPosition {
|
|
|
2210
2292
|
*/
|
|
2211
2293
|
declare const calculateFilterPopupPosition: (headerCell: HTMLElement, popupEl: HTMLElement, viewportPadding?: number) => PopupPosition;
|
|
2212
2294
|
//#endregion
|
|
2295
|
+
//#region src/utils/peek-select-all.d.ts
|
|
2296
|
+
/**
|
|
2297
|
+
* Scope Ctrl/Cmd+A to the peek overlay's content.
|
|
2298
|
+
*
|
|
2299
|
+
* Pure CSS (`user-select: none` outside the overlay) only hides the visual
|
|
2300
|
+
* highlight — the browser still constructs a Selection range across the whole
|
|
2301
|
+
* document, and form controls use a separate selection model that CSS does
|
|
2302
|
+
* not affect. This helper intercepts the shortcut, builds a Range covering
|
|
2303
|
+
* the overlay node, and installs it as the active Selection so only the
|
|
2304
|
+
* overlay's text is highlighted.
|
|
2305
|
+
*
|
|
2306
|
+
* Returns a cleanup function the caller invokes on unmount.
|
|
2307
|
+
* SSR-safe: no-op when `document` is undefined.
|
|
2308
|
+
*/
|
|
2309
|
+
declare const bindPeekSelectAll: (overlay: HTMLElement) => (() => void);
|
|
2310
|
+
//#endregion
|
|
2213
2311
|
//#region src/slot-pool.d.ts
|
|
2214
2312
|
interface SlotPoolManagerOptions {
|
|
2215
2313
|
/** Get current row height */
|
|
@@ -2330,6 +2428,7 @@ interface EditManagerOptions {
|
|
|
2330
2428
|
*/
|
|
2331
2429
|
declare class EditManager {
|
|
2332
2430
|
private editState;
|
|
2431
|
+
private peekState;
|
|
2333
2432
|
private readonly options;
|
|
2334
2433
|
private readonly emitter;
|
|
2335
2434
|
onInstruction: (listener: InstructionListener) => () => void;
|
|
@@ -2352,6 +2451,21 @@ declare class EditManager {
|
|
|
2352
2451
|
* Returns true if edit was started, false if cell is not editable.
|
|
2353
2452
|
*/
|
|
2354
2453
|
startEdit(row: number, col: number): boolean;
|
|
2454
|
+
/**
|
|
2455
|
+
* Get the cell currently shown in a peek overlay, or null.
|
|
2456
|
+
*/
|
|
2457
|
+
getPeekState(): CellPosition | null;
|
|
2458
|
+
/**
|
|
2459
|
+
* Open a peek overlay on a cell. Caller is responsible for guarding on
|
|
2460
|
+
* `column.peekable` — the manager only refuses when an edit is in progress
|
|
2461
|
+
* (edit and peek are mutually exclusive).
|
|
2462
|
+
* Returns true if the peek was opened.
|
|
2463
|
+
*/
|
|
2464
|
+
startPeek(row: number, col: number): boolean;
|
|
2465
|
+
/**
|
|
2466
|
+
* Close any active peek overlay. No-op if none is open.
|
|
2467
|
+
*/
|
|
2468
|
+
stopPeek(): void;
|
|
2355
2469
|
/**
|
|
2356
2470
|
* Update the current edit value.
|
|
2357
2471
|
*/
|
|
@@ -2734,12 +2848,132 @@ declare class PendingRowDragController<TData = unknown> {
|
|
|
2734
2848
|
constructor(deps: PendingRowDragDeps<TData>);
|
|
2735
2849
|
start(event: PointerEvent): void;
|
|
2736
2850
|
cancel(): void;
|
|
2851
|
+
private reset;
|
|
2737
2852
|
releaseLocks(): void;
|
|
2738
2853
|
private confirm;
|
|
2739
2854
|
private lockContainer;
|
|
2740
2855
|
private applyPointerCapture;
|
|
2741
2856
|
}
|
|
2742
2857
|
//#endregion
|
|
2858
|
+
//#region src/adapter/pending-cell-tap.d.ts
|
|
2859
|
+
interface PendingCellTapDeps<TData = unknown> {
|
|
2860
|
+
getCore: () => GridCore<TData> | null;
|
|
2861
|
+
isBrowser: boolean;
|
|
2862
|
+
/** Called after a tap confirmed selection (wrapper focuses the container). */
|
|
2863
|
+
onTapConfirmed: () => void;
|
|
2864
|
+
}
|
|
2865
|
+
/**
|
|
2866
|
+
* Tap confirmation state machine for touch cell selection. On touch,
|
|
2867
|
+
* selection is deferred from pointerdown to a confirmed tap so a scroll
|
|
2868
|
+
* gesture never selects a cell (and never shows the fill handle).
|
|
2869
|
+
*
|
|
2870
|
+
* Algorithm:
|
|
2871
|
+
* - start() listens for pointermove/up/cancel on document.
|
|
2872
|
+
* - If the pointer moves beyond the tap slop → cancel (it is a scroll;
|
|
2873
|
+
* covers scaled mode where the synthetic scroller keeps pointermove alive).
|
|
2874
|
+
* - On pointercancel → cancel (native scroll claimed the gesture in
|
|
2875
|
+
* non-scaled mode, or a system gesture took over).
|
|
2876
|
+
* - On pointerup within the slop → confirm: core applies the selection.
|
|
2877
|
+
*
|
|
2878
|
+
* Framework-agnostic: accepts plain getter/callback deps and touches only
|
|
2879
|
+
* the document DOM APIs. Wrappers gate construction on browser.
|
|
2880
|
+
*/
|
|
2881
|
+
declare class PendingCellTapController<TData = unknown> {
|
|
2882
|
+
private cleanup;
|
|
2883
|
+
private readonly deps;
|
|
2884
|
+
constructor(deps: PendingCellTapDeps<TData>);
|
|
2885
|
+
start(event: PointerEvent): void;
|
|
2886
|
+
cancel(): void;
|
|
2887
|
+
private detachListeners;
|
|
2888
|
+
}
|
|
2889
|
+
//#endregion
|
|
2890
|
+
//#region src/adapter/touch-scroll.d.ts
|
|
2891
|
+
interface TouchScrollDeps<TData = unknown> {
|
|
2892
|
+
getCore: () => GridCore<TData> | null;
|
|
2893
|
+
/** The overflow:auto body element that owns the grid scrollbars. */
|
|
2894
|
+
getScrollEl: () => HTMLElement | null;
|
|
2895
|
+
isBrowser: boolean;
|
|
2896
|
+
}
|
|
2897
|
+
/**
|
|
2898
|
+
* Synthetic touch scrolling for scaled grids. When scroll virtualization
|
|
2899
|
+
* compresses the DOM scroll space (scrollRatio < 1), native touch scrolling
|
|
2900
|
+
* gets amplified through the ratio and the fling momentum no longer matches
|
|
2901
|
+
* the finger. This controller takes over touch gestures in that regime:
|
|
2902
|
+
* content tracks the finger 1:1 in logical space and release flings decay
|
|
2903
|
+
* with a consistent, platform-independent curve.
|
|
2904
|
+
*
|
|
2905
|
+
* Performance contract: only a passive touchstart (plus a passive wheel
|
|
2906
|
+
* listener that cancels flings) is attached permanently. The non-passive
|
|
2907
|
+
* touchmove and the end listeners are attached per-gesture, and only when
|
|
2908
|
+
* scaling is active — small grids keep fully native, compositor-driven
|
|
2909
|
+
* scrolling with zero added cost.
|
|
2910
|
+
*/
|
|
2911
|
+
declare class TouchScrollController<TData = unknown> {
|
|
2912
|
+
private readonly deps;
|
|
2913
|
+
private attachedEl;
|
|
2914
|
+
private gesture;
|
|
2915
|
+
private gestureCleanup;
|
|
2916
|
+
private flingFrame;
|
|
2917
|
+
private flingVelocity;
|
|
2918
|
+
private dragFrame;
|
|
2919
|
+
private pendingDragTarget;
|
|
2920
|
+
private savedOverscrollBehavior;
|
|
2921
|
+
private savedTouchAction;
|
|
2922
|
+
private overrideActive;
|
|
2923
|
+
/** Timestamp of the last slot/render pipeline run (drag or fling) */
|
|
2924
|
+
private lastPipelineRunMs;
|
|
2925
|
+
/** Smoothed interval between pipeline runs — the device's render pace */
|
|
2926
|
+
private pipelineIntervalEmaMs;
|
|
2927
|
+
/** Smoothed rAF frame interval measured while a fling ticks */
|
|
2928
|
+
private frameIntervalEmaMs;
|
|
2929
|
+
/** Latched when measured frames prove per-frame rendering unsustainable */
|
|
2930
|
+
private flingThrottled;
|
|
2931
|
+
constructor(deps: TouchScrollDeps<TData>);
|
|
2932
|
+
attach(): void;
|
|
2933
|
+
detach(): void;
|
|
2934
|
+
/**
|
|
2935
|
+
* While scroll scaling is active, panning must never be native: declare
|
|
2936
|
+
* `touch-action: none` so the browser cannot start a (ratio-amplified)
|
|
2937
|
+
* native scroll at all, and contain overscroll so synthetic flings do not
|
|
2938
|
+
* chain to the page. Non-scaled grids keep their original native policy.
|
|
2939
|
+
*/
|
|
2940
|
+
private syncTouchPolicy;
|
|
2941
|
+
/** Cancel an in-flight fling (call before programmatic scrollTop writes). */
|
|
2942
|
+
stop(): void;
|
|
2943
|
+
/**
|
|
2944
|
+
* Drive the grid from the synthetic (fractional) scroll position. The DOM
|
|
2945
|
+
* scrollTop write is quantized by the browser and only keeps the scrollbar
|
|
2946
|
+
* in sync; the override + direct setViewport carry the sub-pixel position,
|
|
2947
|
+
* so rows glide instead of stepping one DOM-pixel's worth of rows at a
|
|
2948
|
+
* time under high compression.
|
|
2949
|
+
*/
|
|
2950
|
+
private applySyntheticScrollTop;
|
|
2951
|
+
/**
|
|
2952
|
+
* Decide whether a fast fling must fall back to throttled rendering.
|
|
2953
|
+
* The default is a full pipeline run every frame — a reduced cadence at
|
|
2954
|
+
* medium speed reads as freeze-and-jump stutter. Only when the measured
|
|
2955
|
+
* frame pace shows the device cannot sustain per-frame renders does the
|
|
2956
|
+
* fling latch onto the throttled cadence, and it stays latched until the
|
|
2957
|
+
* fling slows below the threshold so the cadence never oscillates.
|
|
2958
|
+
*/
|
|
2959
|
+
private updateFlingThrottle;
|
|
2960
|
+
private isFlingPipelineDue;
|
|
2961
|
+
/** Hand scroll-position ownership back to native scroll events. */
|
|
2962
|
+
private releaseScrollOverride;
|
|
2963
|
+
private readonly onWheel;
|
|
2964
|
+
private readonly onTouchStart;
|
|
2965
|
+
private readonly startTouchGesture;
|
|
2966
|
+
private attachGestureListeners;
|
|
2967
|
+
private clearGesture;
|
|
2968
|
+
private findTrackedTouch;
|
|
2969
|
+
private readonly onTouchMove;
|
|
2970
|
+
private scheduleDragApply;
|
|
2971
|
+
private flushPendingDrag;
|
|
2972
|
+
private readonly onTouchEnd;
|
|
2973
|
+
private readonly onTouchCancel;
|
|
2974
|
+
private startFling;
|
|
2975
|
+
}
|
|
2976
|
+
//#endregion
|
|
2743
2977
|
//#region src/adapter/batch-applier.d.ts
|
|
2744
2978
|
type EditingCell = {
|
|
2745
2979
|
row: number;
|
|
@@ -2763,6 +2997,7 @@ interface BatchChangeSetters {
|
|
|
2763
2997
|
setSelectionRange: (v: CellRange | null) => void;
|
|
2764
2998
|
setEditingCell: (v: EditingCell) => void;
|
|
2765
2999
|
setHoverPosition: (v: CellPosition | null) => void;
|
|
3000
|
+
setPeekCell: (v: CellPosition | null) => void;
|
|
2766
3001
|
setColumnsOverride: (v: ColumnDefinition[]) => void;
|
|
2767
3002
|
onFilterPopupChange: (v: FilterPopupState | null) => void;
|
|
2768
3003
|
}
|
|
@@ -2822,6 +3057,7 @@ interface InputEventAdapterDeps<TData = unknown> {
|
|
|
2822
3057
|
getBodyEl: () => HTMLElement | null;
|
|
2823
3058
|
autoScroll: AutoScrollDriver;
|
|
2824
3059
|
pendingRowDrag: PendingRowDragController<TData>;
|
|
3060
|
+
pendingCellTap: PendingCellTapController<TData>;
|
|
2825
3061
|
onDragStateChange: (state: DragState) => void;
|
|
2826
3062
|
}
|
|
2827
3063
|
interface CellPointerAction {
|
|
@@ -2876,4 +3112,4 @@ declare class InputEventAdapter<TData = unknown> {
|
|
|
2876
3112
|
private dispatchCellDragStart;
|
|
2877
3113
|
}
|
|
2878
3114
|
//#endregion
|
|
2879
|
-
export { type AssignSlotInstruction, AutoScrollDriver, type BatchChangeSetters, type BatchInstructionListener, type CalculateFillHandlePositionParams, type CancelColumnMoveInstruction, type CancelColumnResizeInstruction, type CancelFillInstruction, type CancelRowDragInstruction, type CellDataType, type CellPointerAction, type CellPosition, type CellRange, type CellRendererParams, type CellValue, type CellValueChangedEvent, type CloseFilterPopupInstruction, type ColumnDefinition, type ColumnFilterModel, type ColumnMoveDragState, type ColumnResizeDragState, type ColumnsChangedInstruction, type CommitColumnMoveInstruction, type CommitColumnResizeInstruction, type CommitEditInstruction, type CommitFillInstruction, type CommitRowDragInstruction, type ContainerBounds, type CreateSlotInstruction, type DataChangeListener, type DataErrorInstruction, type DataLoadedInstruction, type DataLoadingInstruction, type DataSource, type DataSourceLoadMode, DataSourceOwner, type DataSourceRange, type DataSourceRequest, type DataSourceResponse, type DateFilterCondition, type DateFilterOperator, type DestroySlotInstruction, type Direction, type DragEndResult, type DragMoveResult, type DragState, EditManager, type EditManagerOptions, type EditRendererParams, type EditState, type FillHandlePosition, type FillHandleState, FillManager, type FillPointerAction, type FilterCombination, type FilterCondition, type FilterModel, type FilterPopupState, GridCore, type GridCoreOptions, type GridInstruction, type GridState, type HeaderData, type HeaderRendererParams, type HighlightContext, HighlightManager, type HighlightingOptions, IndexedDataStore, type IndexedDataStoreOptions, type InitialStateArgs, InputEventAdapter, type InputEventAdapterDeps, InputHandler, type InputHandlerDeps, type InputResult, type InstructionListener, type KeyEventData, type KeyboardResult, type MoveSlotInstruction, type MultiColumnSortedChunk, type MutableClientDataSourceOptions, type MutableDataSource, type NumberFilterCondition, type NumberFilterOperator, type OpenFilterPopupInstruction, ParallelSortManager, type ParallelSortOptions, PendingRowDragController, type PendingRowDragDeps, type PointerEventData, type PopupPosition, type RowCacheEviction, type RowCacheOptions, RowDataManager, type RowDataManagerOptions, type RowDragState, type RowId, type RowLoadingMode, type RowLoadingOptions, RowMutationManager, type RowMutationManagerOptions, type RowSortCache, type RowsAddedInstruction, type RowsRemovedInstruction, type RowsUpdatedInstruction, ScrollVirtualizationManager, type ScrollVirtualizationManagerOptions, SelectionManager, type SelectionState, type ServerDataSourceOptions, type SetActiveCellInstruction, type SetContentSizeInstruction, type SetHoverPositionInstruction, type SetSelectionRangeInstruction, type SlotData, type BatchInstructionListener$1 as SlotPoolBatchListener, SlotPoolManager, type SlotPoolManagerOptions, type SlotState, type SortDirection, SortFilterManager, type SortFilterManagerOptions, type SortModel, type SortedChunk, type StartColumnMoveInstruction, type StartColumnResizeInstruction, type StartEditInstruction, type StartFillInstruction, type StartRowDragInstruction, type StopEditInstruction, type TextFilterCondition, type TextFilterOperator, type Transaction, TransactionManager, type TransactionManagerOptions, type TransactionProcessedInstruction, type TransactionResult, type UpdateColumnMoveInstruction, type UpdateColumnResizeInstruction, type UpdateFillInstruction, type UpdateHeaderInstruction, type UpdateRowDragInstruction, type VisibleColumnInfo, WorkerPool, type WorkerPoolOptions, applyBatchInstructions, applyInstruction, buildCellClasses, calculateColumnPositions, calculateFillHandlePosition, calculateFilterPopupPosition, calculateScaledColumnPositions, cellStyles, compareValues, computeValueHash, containerStyles, createClientDataSource, createDataSourceFromArray, createInitialState, createMutableClientDataSource, createServerDataSource, detectBoundaryCollisions, evaluateColumnFilter, evaluateDateCondition, evaluateNumberCondition, evaluateTextCondition, filtersStyles, findColumnAtX, findSlotForRow, formatCellValue, getFieldValue, getTotalWidth, gridStyles, headerStyles, isCellActive, isCellEditing, isCellInFillPreview, isCellSelected, isColumnInSelectionRange, isRowInSelectionRange, isRowVisible, isSameDay, kWayMerge, kWayMergeMultiColumn, rowDragStyles, rowPassesFilter, scrollCellIntoView, scrollbarStyles, setFieldValue, statesStyles, stringToSortableNumber, toPointerEventData, variablesStyles };
|
|
3115
|
+
export { type AssignSlotInstruction, AutoScrollDriver, type BatchChangeSetters, type BatchInstructionListener, type CalculateFillHandlePositionParams, type CancelColumnMoveInstruction, type CancelColumnResizeInstruction, type CancelFillInstruction, type CancelRowDragInstruction, type CellDataType, type CellPointerAction, type CellPosition, type CellRange, type CellRendererParams, type CellValue, type CellValueChangedEvent, type CloseFilterPopupInstruction, type ColumnDefinition, type ColumnFilterModel, type ColumnMoveDragState, type ColumnResizeDragState, type ColumnScrollGeometry, type ColumnsChangedInstruction, type CommitColumnMoveInstruction, type CommitColumnResizeInstruction, type CommitEditInstruction, type CommitFillInstruction, type CommitRowDragInstruction, type ContainerBounds, type CreateSlotInstruction, type DataChangeListener, type DataErrorInstruction, type DataLoadedInstruction, type DataLoadingInstruction, type DataSource, type DataSourceLoadMode, DataSourceOwner, type DataSourceRange, type DataSourceRequest, type DataSourceResponse, type DateFilterCondition, type DateFilterOperator, type DestroySlotInstruction, type Direction, type DragEndResult, type DragMoveResult, type DragState, EditManager, type EditManagerOptions, type EditRendererParams, type EditState, type FillHandlePosition, type FillHandleState, FillManager, type FillPointerAction, type FilterCombination, type FilterCondition, type FilterModel, type FilterPopupState, GridCore, type GridCoreOptions, type GridInstruction, type GridState, type HeaderData, type HeaderRendererParams, type HighlightContext, HighlightManager, type HighlightingOptions, IndexedDataStore, type IndexedDataStoreOptions, type InitialStateArgs, InputEventAdapter, type InputEventAdapterDeps, InputHandler, type InputHandlerDeps, type InputResult, type InstructionListener, type KeyEventData, type KeyboardResult, type MoveSlotInstruction, type MultiColumnSortedChunk, type MutableClientDataSourceOptions, type MutableDataSource, type NumberFilterCondition, type NumberFilterOperator, type OpenFilterPopupInstruction, ParallelSortManager, type ParallelSortOptions, PendingCellTapController, type PendingCellTapDeps, PendingRowDragController, type PendingRowDragDeps, type PointerEventData, type PopupPosition, ROW_DRAG_HOLD_MS, type RowCacheEviction, type RowCacheOptions, RowDataManager, type RowDataManagerOptions, type RowDragState, type RowId, type RowLoadingMode, type RowLoadingOptions, RowMutationManager, type RowMutationManagerOptions, type RowSortCache, type RowsAddedInstruction, type RowsRemovedInstruction, type RowsUpdatedInstruction, ScrollVirtualizationManager, type ScrollVirtualizationManagerOptions, SelectionManager, type SelectionState, type ServerDataSourceOptions, type SetActiveCellInstruction, type SetContentSizeInstruction, type SetHoverPositionInstruction, type SetSelectionRangeInstruction, type SlotData, type BatchInstructionListener$1 as SlotPoolBatchListener, SlotPoolManager, type SlotPoolManagerOptions, type SlotState, type SortDirection, SortFilterManager, type SortFilterManagerOptions, type SortModel, type SortedChunk, type StartColumnMoveInstruction, type StartColumnResizeInstruction, type StartEditInstruction, type StartFillInstruction, type StartPeekInstruction, type StartRowDragInstruction, type StopEditInstruction, type StopPeekInstruction, TAP_SLOP_PX, type TextFilterCondition, type TextFilterOperator, TouchScrollController, type TouchScrollDeps, type Transaction, TransactionManager, type TransactionManagerOptions, type TransactionProcessedInstruction, type TransactionResult, type UpdateColumnMoveInstruction, type UpdateColumnResizeInstruction, type UpdateFillInstruction, type UpdateHeaderInstruction, type UpdateRowDragInstruction, type VisibleColumnInfo, WorkerPool, type WorkerPoolOptions, applyBatchInstructions, applyInstruction, bindPeekSelectAll, buildCellClasses, calculateColumnPositions, calculateFillHandlePosition, calculateFilterPopupPosition, calculateScaledColumnPositions, cellStyles, compareValues, computeValueHash, containerStyles, createClientDataSource, createDataSourceFromArray, createInitialState, createMutableClientDataSource, createServerDataSource, detectBoundaryCollisions, evaluateColumnFilter, evaluateDateCondition, evaluateNumberCondition, evaluateTextCondition, filtersStyles, findColumnAtX, findSlotForRow, formatCellValue, getFieldValue, getTotalWidth, gridStyles, headerStyles, isCellActive, isCellEditing, isCellInFillPreview, isCellSelected, isColumnInSelectionRange, isRowInSelectionRange, isRowVisible, isSameDay, kWayMerge, kWayMergeMultiColumn, rowDragStyles, rowPassesFilter, scrollCellIntoView, scrollbarStyles, setFieldValue, statesStyles, stringToSortableNumber, toPointerEventData, variablesStyles };
|