@gp-grid/core 0.22.0 → 0.23.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/dist/index.d.ts +218 -1118
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -577,102 +577,11 @@ interface DataErrorInstruction {
|
|
|
577
577
|
type: "DATA_ERROR";
|
|
578
578
|
error: string;
|
|
579
579
|
}
|
|
580
|
-
/** Rows added instruction */
|
|
581
|
-
interface RowsAddedInstruction {
|
|
582
|
-
type: "ROWS_ADDED";
|
|
583
|
-
indices: number[];
|
|
584
|
-
count: number;
|
|
585
|
-
totalRows: number;
|
|
586
|
-
}
|
|
587
|
-
/** Rows removed instruction */
|
|
588
|
-
interface RowsRemovedInstruction {
|
|
589
|
-
type: "ROWS_REMOVED";
|
|
590
|
-
indices: number[];
|
|
591
|
-
totalRows: number;
|
|
592
|
-
}
|
|
593
|
-
/** Rows updated instruction */
|
|
594
|
-
interface RowsUpdatedInstruction {
|
|
595
|
-
type: "ROWS_UPDATED";
|
|
596
|
-
indices: number[];
|
|
597
|
-
}
|
|
598
|
-
/** Transaction processed instruction */
|
|
599
|
-
interface TransactionProcessedInstruction {
|
|
600
|
-
type: "TRANSACTION_PROCESSED";
|
|
601
|
-
added: number;
|
|
602
|
-
removed: number;
|
|
603
|
-
updated: number;
|
|
604
|
-
}
|
|
605
580
|
/** Columns changed (after resize, reorder, etc.) */
|
|
606
581
|
interface ColumnsChangedInstruction {
|
|
607
582
|
type: "COLUMNS_CHANGED";
|
|
608
583
|
columns: ColumnDefinition[];
|
|
609
584
|
}
|
|
610
|
-
/** Column resize started */
|
|
611
|
-
interface StartColumnResizeInstruction {
|
|
612
|
-
type: "START_COLUMN_RESIZE";
|
|
613
|
-
colIndex: number;
|
|
614
|
-
initialWidth: number;
|
|
615
|
-
}
|
|
616
|
-
/** Column resize in progress */
|
|
617
|
-
interface UpdateColumnResizeInstruction {
|
|
618
|
-
type: "UPDATE_COLUMN_RESIZE";
|
|
619
|
-
colIndex: number;
|
|
620
|
-
currentWidth: number;
|
|
621
|
-
}
|
|
622
|
-
/** Column resize committed */
|
|
623
|
-
interface CommitColumnResizeInstruction {
|
|
624
|
-
type: "COMMIT_COLUMN_RESIZE";
|
|
625
|
-
colIndex: number;
|
|
626
|
-
newWidth: number;
|
|
627
|
-
}
|
|
628
|
-
/** Column resize cancelled */
|
|
629
|
-
interface CancelColumnResizeInstruction {
|
|
630
|
-
type: "CANCEL_COLUMN_RESIZE";
|
|
631
|
-
}
|
|
632
|
-
/** Column move started */
|
|
633
|
-
interface StartColumnMoveInstruction {
|
|
634
|
-
type: "START_COLUMN_MOVE";
|
|
635
|
-
sourceColIndex: number;
|
|
636
|
-
}
|
|
637
|
-
/** Column move position updated */
|
|
638
|
-
interface UpdateColumnMoveInstruction {
|
|
639
|
-
type: "UPDATE_COLUMN_MOVE";
|
|
640
|
-
currentX: number;
|
|
641
|
-
currentY: number;
|
|
642
|
-
dropTargetIndex: number | null;
|
|
643
|
-
}
|
|
644
|
-
/** Column move committed */
|
|
645
|
-
interface CommitColumnMoveInstruction {
|
|
646
|
-
type: "COMMIT_COLUMN_MOVE";
|
|
647
|
-
sourceColIndex: number;
|
|
648
|
-
targetColIndex: number;
|
|
649
|
-
}
|
|
650
|
-
/** Column move cancelled */
|
|
651
|
-
interface CancelColumnMoveInstruction {
|
|
652
|
-
type: "CANCEL_COLUMN_MOVE";
|
|
653
|
-
}
|
|
654
|
-
/** Row drag started */
|
|
655
|
-
interface StartRowDragInstruction {
|
|
656
|
-
type: "START_ROW_DRAG";
|
|
657
|
-
sourceRowIndex: number;
|
|
658
|
-
}
|
|
659
|
-
/** Row drag position updated */
|
|
660
|
-
interface UpdateRowDragInstruction {
|
|
661
|
-
type: "UPDATE_ROW_DRAG";
|
|
662
|
-
currentX: number;
|
|
663
|
-
currentY: number;
|
|
664
|
-
dropTargetIndex: number | null;
|
|
665
|
-
}
|
|
666
|
-
/** Row drag committed */
|
|
667
|
-
interface CommitRowDragInstruction {
|
|
668
|
-
type: "COMMIT_ROW_DRAG";
|
|
669
|
-
sourceRowIndex: number;
|
|
670
|
-
targetRowIndex: number;
|
|
671
|
-
}
|
|
672
|
-
/** Row drag cancelled */
|
|
673
|
-
interface CancelRowDragInstruction {
|
|
674
|
-
type: "CANCEL_ROW_DRAG";
|
|
675
|
-
}
|
|
676
585
|
/** Union type of all instructions */
|
|
677
586
|
type GridInstruction =
|
|
678
587
|
/** Slot lifecycle */
|
|
@@ -695,16 +604,8 @@ OpenFilterPopupInstruction | CloseFilterPopupInstruction |
|
|
|
695
604
|
StartFillInstruction | UpdateFillInstruction | CommitFillInstruction | CancelFillInstruction |
|
|
696
605
|
/** Data */
|
|
697
606
|
DataLoadingInstruction | DataLoadedInstruction | DataErrorInstruction |
|
|
698
|
-
/** Transactions */
|
|
699
|
-
RowsAddedInstruction | RowsRemovedInstruction | RowsUpdatedInstruction | TransactionProcessedInstruction |
|
|
700
607
|
/** Column changes */
|
|
701
|
-
ColumnsChangedInstruction
|
|
702
|
-
/** Column resize */
|
|
703
|
-
StartColumnResizeInstruction | UpdateColumnResizeInstruction | CommitColumnResizeInstruction | CancelColumnResizeInstruction |
|
|
704
|
-
/** Column move */
|
|
705
|
-
StartColumnMoveInstruction | UpdateColumnMoveInstruction | CommitColumnMoveInstruction | CancelColumnMoveInstruction |
|
|
706
|
-
/** Row drag */
|
|
707
|
-
StartRowDragInstruction | UpdateRowDragInstruction | CommitRowDragInstruction | CancelRowDragInstruction;
|
|
608
|
+
ColumnsChangedInstruction;
|
|
708
609
|
/** Instruction listener: Single instruction Listener that receives a single instruction, used by frameworks to update their state */
|
|
709
610
|
type InstructionListener = (instruction: GridInstruction) => void;
|
|
710
611
|
/** Batch instruction listener: Batch instruction Listener that receives an array of instructions, used by frameworks to update their state */
|
|
@@ -757,8 +658,6 @@ interface GridCoreOptions<TData = unknown> {
|
|
|
757
658
|
rowLoading?: RowLoadingOptions;
|
|
758
659
|
/** Enable/disable sorting globally. Default: true */
|
|
759
660
|
sortingEnabled?: boolean;
|
|
760
|
-
/** Debounce time for transactions in ms. Default 50. Set to 0 for sync. */
|
|
761
|
-
transactionDebounceMs?: number;
|
|
762
661
|
/** Function to extract unique ID from row. Required for mutations. */
|
|
763
662
|
getRowId?: (row: TData) => RowId;
|
|
764
663
|
/** Row/column/cell highlighting configuration */
|
|
@@ -1079,17 +978,11 @@ declare class ColumnResizeDrag<TData = unknown> {
|
|
|
1079
978
|
//#endregion
|
|
1080
979
|
//#region src/input/column-move-drag.d.ts
|
|
1081
980
|
declare class ColumnMoveDrag<TData = unknown> {
|
|
1082
|
-
private
|
|
981
|
+
private readonly gesture;
|
|
1083
982
|
private sourceColIndex;
|
|
1084
|
-
private startX;
|
|
1085
|
-
private startY;
|
|
1086
|
-
private thresholdMet;
|
|
1087
983
|
private shiftKey;
|
|
1088
984
|
private ghostWidth;
|
|
1089
985
|
private ghostHeight;
|
|
1090
|
-
private currentX;
|
|
1091
|
-
private currentY;
|
|
1092
|
-
private dropTargetIndex;
|
|
1093
986
|
private readonly core;
|
|
1094
987
|
private deps;
|
|
1095
988
|
constructor(core: GridCore<TData>, deps: InputHandlerDeps);
|
|
@@ -1107,14 +1000,8 @@ declare class ColumnMoveDrag<TData = unknown> {
|
|
|
1107
1000
|
//#endregion
|
|
1108
1001
|
//#region src/input/row-drag.d.ts
|
|
1109
1002
|
declare class RowDrag<TData = unknown> {
|
|
1110
|
-
private
|
|
1003
|
+
private readonly gesture;
|
|
1111
1004
|
private sourceRowIndex;
|
|
1112
|
-
private startX;
|
|
1113
|
-
private startY;
|
|
1114
|
-
private thresholdMet;
|
|
1115
|
-
private currentX;
|
|
1116
|
-
private currentY;
|
|
1117
|
-
private dropTargetIndex;
|
|
1118
1005
|
private readonly core;
|
|
1119
1006
|
private deps;
|
|
1120
1007
|
constructor(core: GridCore<TData>, deps: InputHandlerDeps);
|
|
@@ -1300,199 +1187,6 @@ declare class HighlightManager<TData = Record<string, unknown>> {
|
|
|
1300
1187
|
destroy(): void;
|
|
1301
1188
|
}
|
|
1302
1189
|
//#endregion
|
|
1303
|
-
//#region src/managers/row-mutation-manager.d.ts
|
|
1304
|
-
interface RowMutationManagerOptions<TData> {
|
|
1305
|
-
/** Get the cached rows map */
|
|
1306
|
-
getCachedRows: () => Map<number, TData>;
|
|
1307
|
-
/** Set the cached rows map (for bulk operations) */
|
|
1308
|
-
setCachedRows: (rows: Map<number, TData>) => void;
|
|
1309
|
-
/** Get total row count */
|
|
1310
|
-
getTotalRows: () => number;
|
|
1311
|
-
/** Set total row count */
|
|
1312
|
-
setTotalRows: (count: number) => void;
|
|
1313
|
-
/** Update a single slot after row change */
|
|
1314
|
-
updateSlot: (rowIndex: number) => void;
|
|
1315
|
-
/** Refresh all slots after bulk changes */
|
|
1316
|
-
refreshAllSlots: () => void;
|
|
1317
|
-
/** Emit content size change */
|
|
1318
|
-
emitContentSize: () => void;
|
|
1319
|
-
/** Clear selection if it references invalid rows */
|
|
1320
|
-
clearSelectionIfInvalid: (maxValidRow: number) => void;
|
|
1321
|
-
}
|
|
1322
|
-
/**
|
|
1323
|
-
* Manages row CRUD operations and cache management.
|
|
1324
|
-
*/
|
|
1325
|
-
declare class RowMutationManager<TData = unknown> {
|
|
1326
|
-
private readonly options;
|
|
1327
|
-
private readonly emitter;
|
|
1328
|
-
onInstruction: (listener: InstructionListener) => () => void;
|
|
1329
|
-
private readonly emit;
|
|
1330
|
-
constructor(options: RowMutationManagerOptions<TData>);
|
|
1331
|
-
/**
|
|
1332
|
-
* Get a row by index.
|
|
1333
|
-
*/
|
|
1334
|
-
getRow(index: number): TData | undefined;
|
|
1335
|
-
/**
|
|
1336
|
-
* Add rows to the grid at the specified index.
|
|
1337
|
-
* If no index is provided, rows are added at the end.
|
|
1338
|
-
*/
|
|
1339
|
-
addRows(rows: TData[], index?: number): void;
|
|
1340
|
-
/**
|
|
1341
|
-
* Update existing rows with partial data.
|
|
1342
|
-
*/
|
|
1343
|
-
updateRows(updates: Array<{
|
|
1344
|
-
index: number;
|
|
1345
|
-
data: Partial<TData>;
|
|
1346
|
-
}>): void;
|
|
1347
|
-
/**
|
|
1348
|
-
* Delete rows at the specified indices.
|
|
1349
|
-
*/
|
|
1350
|
-
deleteRows(indices: number[]): void;
|
|
1351
|
-
/**
|
|
1352
|
-
* Set a complete row at the specified index.
|
|
1353
|
-
* Use this for complete row replacement. For partial updates, use updateRows.
|
|
1354
|
-
*/
|
|
1355
|
-
setRow(index: number, data: TData): void;
|
|
1356
|
-
destroy(): void;
|
|
1357
|
-
}
|
|
1358
|
-
//#endregion
|
|
1359
|
-
//#region src/managers/instruction-batcher.d.ts
|
|
1360
|
-
declare class InstructionBatcher {
|
|
1361
|
-
private listeners;
|
|
1362
|
-
private buffer;
|
|
1363
|
-
/**
|
|
1364
|
-
* Subscribe to batched instructions. Returns an unsubscribe function.
|
|
1365
|
-
* Batch listeners receive arrays of instructions instead of individual ones.
|
|
1366
|
-
*/
|
|
1367
|
-
subscribe(listener: BatchInstructionListener): () => void;
|
|
1368
|
-
/**
|
|
1369
|
-
* Begin buffering. `emit`/`emitBatch` accumulate into an internal buffer
|
|
1370
|
-
* until `flush()` is called. Supports nested semantics at the caller's
|
|
1371
|
-
* level (first startBatch "wins"; nested calls are no-ops by design).
|
|
1372
|
-
*/
|
|
1373
|
-
start(): void;
|
|
1374
|
-
/** Flush buffered instructions to listeners as one batch and stop buffering. */
|
|
1375
|
-
flush(): void;
|
|
1376
|
-
emit(instruction: GridInstruction): void;
|
|
1377
|
-
emitBatch(instructions: GridInstruction[]): void;
|
|
1378
|
-
clearListeners(): void;
|
|
1379
|
-
private notify;
|
|
1380
|
-
}
|
|
1381
|
-
//#endregion
|
|
1382
|
-
//#region src/managers/row-data-manager.d.ts
|
|
1383
|
-
interface RowDataManagerOptions<TData> {
|
|
1384
|
-
dataSource: DataSource<TData>;
|
|
1385
|
-
rowLoading: RowLoadingOptions | undefined;
|
|
1386
|
-
batcher: InstructionBatcher;
|
|
1387
|
-
getColumns: () => ColumnDefinition[];
|
|
1388
|
-
getSortModel: () => SortModel[];
|
|
1389
|
-
getFilterModel: () => FilterModel;
|
|
1390
|
-
getRowHeight: () => number;
|
|
1391
|
-
getOverscan: () => number;
|
|
1392
|
-
getScrollTop: () => number;
|
|
1393
|
-
getViewportHeight: () => number;
|
|
1394
|
-
onCellValueChanged?: (event: CellValueChangedEvent<TData>) => void;
|
|
1395
|
-
getRowId?: (row: TData) => RowId;
|
|
1396
|
-
syncSlots: () => void;
|
|
1397
|
-
emitVisibleRange: () => void;
|
|
1398
|
-
emitContentSize: () => void;
|
|
1399
|
-
}
|
|
1400
|
-
declare class RowDataManager<TData = unknown> {
|
|
1401
|
-
private dataSource;
|
|
1402
|
-
private readonly options;
|
|
1403
|
-
private readonly rowLoading;
|
|
1404
|
-
private readonly rowWindowLoader;
|
|
1405
|
-
private cachedRows;
|
|
1406
|
-
private totalRows;
|
|
1407
|
-
private isDataLoading;
|
|
1408
|
-
constructor(options: RowDataManagerOptions<TData>);
|
|
1409
|
-
getCachedRows(): Map<number, TData>;
|
|
1410
|
-
setCachedRows(rows: Map<number, TData>): void;
|
|
1411
|
-
getTotalRows(): number;
|
|
1412
|
-
setTotalRows(count: number): void;
|
|
1413
|
-
getDataSource(): DataSource<TData>;
|
|
1414
|
-
getRowData(rowIndex: number): TData | undefined;
|
|
1415
|
-
isLoading(): boolean;
|
|
1416
|
-
getCellValue(row: number, col: number): CellValue;
|
|
1417
|
-
setCellValue(row: number, col: number, value: CellValue): void;
|
|
1418
|
-
loadInitial(): Promise<void>;
|
|
1419
|
-
requestVisibleRows(): void;
|
|
1420
|
-
refreshFromTransaction(): Promise<void>;
|
|
1421
|
-
setDataSource(dataSource: DataSource<TData>): void;
|
|
1422
|
-
destroy(): void;
|
|
1423
|
-
private fetchAllData;
|
|
1424
|
-
private fetchPaginatedData;
|
|
1425
|
-
private emitDataError;
|
|
1426
|
-
private isPaginatedLoading;
|
|
1427
|
-
private getInitialPaginatedRange;
|
|
1428
|
-
private getPaginatedLoadRange;
|
|
1429
|
-
}
|
|
1430
|
-
//#endregion
|
|
1431
|
-
//#region src/managers/scroll-virtualization-manager.d.ts
|
|
1432
|
-
interface ScrollVirtualizationManagerOptions {
|
|
1433
|
-
getRowHeight: () => number;
|
|
1434
|
-
getHeaderHeight: () => number;
|
|
1435
|
-
getTotalRows: () => number;
|
|
1436
|
-
getScrollTop: () => number;
|
|
1437
|
-
getViewportHeight: () => number;
|
|
1438
|
-
}
|
|
1439
|
-
declare class ScrollVirtualizationManager {
|
|
1440
|
-
private naturalContentHeight;
|
|
1441
|
-
private virtualContentHeight;
|
|
1442
|
-
private scrollRatio;
|
|
1443
|
-
private readonly options;
|
|
1444
|
-
constructor(options: ScrollVirtualizationManagerOptions);
|
|
1445
|
-
/**
|
|
1446
|
-
* Update scroll virtualization state based on current row count.
|
|
1447
|
-
* Should be called whenever totalRows changes.
|
|
1448
|
-
*/
|
|
1449
|
-
updateContentSize(): {
|
|
1450
|
-
naturalHeight: number;
|
|
1451
|
-
virtualHeight: number;
|
|
1452
|
-
scrollRatio: number;
|
|
1453
|
-
};
|
|
1454
|
-
/**
|
|
1455
|
-
* Check if scroll scaling is active (large datasets exceeding browser scroll limits).
|
|
1456
|
-
* When scaling is active, scrollRatio < 1 and scroll positions are compressed.
|
|
1457
|
-
*/
|
|
1458
|
-
isScalingActive(): boolean;
|
|
1459
|
-
/**
|
|
1460
|
-
* Get the natural (uncapped) content height.
|
|
1461
|
-
* Useful for debugging or displaying actual content size.
|
|
1462
|
-
*/
|
|
1463
|
-
getNaturalHeight(): number;
|
|
1464
|
-
/**
|
|
1465
|
-
* Get the virtual (capped) content height for DOM use.
|
|
1466
|
-
*/
|
|
1467
|
-
getVirtualHeight(): number;
|
|
1468
|
-
/**
|
|
1469
|
-
* Get the scroll ratio used for scroll virtualization.
|
|
1470
|
-
* Returns 1 when no virtualization is needed, < 1 when content exceeds browser limits.
|
|
1471
|
-
*/
|
|
1472
|
-
getScrollRatio(): number;
|
|
1473
|
-
/**
|
|
1474
|
-
* Get the visible row range (excluding overscan).
|
|
1475
|
-
* Returns the first and last row indices that are actually visible in the viewport.
|
|
1476
|
-
* Includes partially visible rows to avoid false positives when clicking on edge rows.
|
|
1477
|
-
*/
|
|
1478
|
-
getVisibleRowRange(): {
|
|
1479
|
-
start: number;
|
|
1480
|
-
end: number;
|
|
1481
|
-
};
|
|
1482
|
-
/**
|
|
1483
|
-
* Get the scroll position needed to bring a row into view.
|
|
1484
|
-
* Accounts for scroll scaling when active.
|
|
1485
|
-
*/
|
|
1486
|
-
getScrollTopForRow(rowIndex: number): number;
|
|
1487
|
-
/**
|
|
1488
|
-
* Get the row index at a given viewport Y position.
|
|
1489
|
-
* Accounts for scroll scaling when active.
|
|
1490
|
-
* @param viewportY Y position in viewport (physical pixels below header, NOT including scroll)
|
|
1491
|
-
* @param virtualScrollTop Current scroll position from container.scrollTop (virtual/scaled)
|
|
1492
|
-
*/
|
|
1493
|
-
getRowIndexAtDisplayY(viewportY: number, virtualScrollTop: number): number;
|
|
1494
|
-
}
|
|
1495
|
-
//#endregion
|
|
1496
1190
|
//#region src/managers/sort-filter-manager.d.ts
|
|
1497
1191
|
interface SortFilterManagerOptions<TData> {
|
|
1498
1192
|
/** Get all columns */
|
|
@@ -1620,189 +1314,48 @@ interface IndexedDataStoreOptions<TData> {
|
|
|
1620
1314
|
getRowId: (row: TData) => RowId;
|
|
1621
1315
|
/** Custom field accessor for nested properties */
|
|
1622
1316
|
getFieldValue?: (row: TData, field: string) => CellValue;
|
|
1623
|
-
/**
|
|
1624
|
-
* Lookup for a field's valueFormatter. Lets free-text filter conditions
|
|
1625
|
-
* compare against the displayed (formatted) value. Values-mode
|
|
1626
|
-
* `selectedValues` compare raw values and never use it.
|
|
1627
|
-
*/
|
|
1628
|
-
getValueFormatter?: (field: string) => ((v: CellValue) => string) | undefined;
|
|
1629
|
-
}
|
|
1630
|
-
/** Hash cache for a single row */
|
|
1631
|
-
interface RowSortCache {
|
|
1632
|
-
/** Map: sortModelHash -> computed hashes for that sort configuration */
|
|
1633
|
-
hashes: Map<string, number[]>;
|
|
1634
1317
|
}
|
|
1635
1318
|
/**
|
|
1636
|
-
*
|
|
1637
|
-
*
|
|
1638
|
-
*
|
|
1639
|
-
* -
|
|
1640
|
-
*
|
|
1641
|
-
* - Hash caching for fast sorted comparisons
|
|
1319
|
+
* Row registry backing the mutable client data source.
|
|
1320
|
+
*
|
|
1321
|
+
* Holds rows in insertion order with an id → index map for O(1) lookup and a
|
|
1322
|
+
* refcounted distinct-value index per field (for filter UIs). Sorting and
|
|
1323
|
+
* filtering are applied by the data source on top of `getAllRows()`.
|
|
1642
1324
|
*/
|
|
1643
1325
|
declare class IndexedDataStore<TData = unknown> {
|
|
1644
1326
|
private rows;
|
|
1645
1327
|
private readonly rowById;
|
|
1646
|
-
private sortedIndices;
|
|
1647
|
-
private sortModel;
|
|
1648
|
-
private sortModelHash;
|
|
1649
|
-
private filterModel;
|
|
1650
|
-
private filteredIndices;
|
|
1651
1328
|
private readonly distinctValues;
|
|
1652
|
-
private rowSortCache;
|
|
1653
1329
|
private readonly options;
|
|
1654
1330
|
constructor(options: IndexedDataStoreOptions<TData>, initialData?: TData[]);
|
|
1655
|
-
/**
|
|
1656
|
-
* Clear all data and internal caches.
|
|
1657
|
-
* Used for proper memory cleanup when the store is no longer needed.
|
|
1658
|
-
*/
|
|
1331
|
+
/** Clear all data and internal indexes. */
|
|
1659
1332
|
clear(): void;
|
|
1660
|
-
/**
|
|
1661
|
-
* Replace all data (used for initial load or full refresh).
|
|
1662
|
-
*/
|
|
1333
|
+
/** Replace all data (used for initial load or full refresh). */
|
|
1663
1334
|
setData(data: TData[]): void;
|
|
1664
|
-
/**
|
|
1665
|
-
* Query data with sorting, filtering, and row-range slicing.
|
|
1666
|
-
* Compatible with DataSource.query() interface.
|
|
1667
|
-
*/
|
|
1668
|
-
query(request: DataSourceRequest): DataSourceResponse<TData>;
|
|
1669
|
-
/**
|
|
1670
|
-
* Get row by ID.
|
|
1671
|
-
*/
|
|
1672
1335
|
getRowById(id: RowId): TData | undefined;
|
|
1673
|
-
/**
|
|
1674
|
-
* Get row by index.
|
|
1675
|
-
*/
|
|
1676
|
-
getRowByIndex(index: number): TData | undefined;
|
|
1677
|
-
/**
|
|
1678
|
-
* Get total row count (unfiltered).
|
|
1679
|
-
*/
|
|
1680
1336
|
getTotalRowCount(): number;
|
|
1681
|
-
/**
|
|
1682
|
-
* Get all rows as a new array.
|
|
1683
|
-
* Used for direct data access when bypassing store's query system.
|
|
1684
|
-
*/
|
|
1337
|
+
/** All rows, in storage order, as a new array. */
|
|
1685
1338
|
getAllRows(): TData[];
|
|
1686
|
-
/**
|
|
1687
|
-
* Move a row from one position to another in the raw data array.
|
|
1688
|
-
* This reorders the underlying data; when no sort is active, the new order
|
|
1689
|
-
* is reflected immediately on the next fetch.
|
|
1690
|
-
*/
|
|
1691
|
-
moveRow(fromIndex: number, toIndex: number): void;
|
|
1692
|
-
/**
|
|
1693
|
-
* Get visible row count (after filtering).
|
|
1694
|
-
*/
|
|
1695
|
-
getVisibleRowCount(): number;
|
|
1696
|
-
/**
|
|
1697
|
-
* Get distinct values for a field (for filter UI).
|
|
1698
|
-
*/
|
|
1339
|
+
/** Distinct values for a field (for filter UI). */
|
|
1699
1340
|
getDistinctValues(field: string): CellValue[];
|
|
1700
|
-
/**
|
|
1701
|
-
* Add rows to the store.
|
|
1702
|
-
* Rows are inserted at their correct sorted position.
|
|
1703
|
-
*/
|
|
1341
|
+
/** Append rows. Rows whose id already exists are skipped with a warning. */
|
|
1704
1342
|
addRows(rows: TData[]): void;
|
|
1705
|
-
/**
|
|
1706
|
-
* Add a single row.
|
|
1707
|
-
*/
|
|
1708
1343
|
private addRow;
|
|
1709
1344
|
/**
|
|
1710
|
-
* Remove rows by ID. Returns the number of rows actually
|
|
1711
|
-
* ids are ignored).
|
|
1345
|
+
* Remove rows by ID in a single pass. Returns the number of rows actually
|
|
1346
|
+
* removed (unknown ids are ignored).
|
|
1712
1347
|
*/
|
|
1713
1348
|
removeRows(ids: RowId[]): number;
|
|
1714
|
-
/**
|
|
1715
|
-
* Remove a single row by index.
|
|
1716
|
-
*/
|
|
1717
|
-
private removeRowByIndex;
|
|
1718
|
-
/**
|
|
1719
|
-
* Update indices after a row removal.
|
|
1720
|
-
*/
|
|
1721
|
-
private reindexAfterRemoval;
|
|
1722
|
-
/**
|
|
1723
|
-
* Update a cell value.
|
|
1724
|
-
*/
|
|
1349
|
+
/** Update a single field on a row, keeping the distinct-value index in sync. */
|
|
1725
1350
|
updateCell(id: RowId, field: string, value: CellValue): void;
|
|
1726
|
-
/**
|
|
1727
|
-
* Update multiple fields on a row.
|
|
1728
|
-
*/
|
|
1351
|
+
/** Update multiple fields on a row. */
|
|
1729
1352
|
updateRow(id: RowId, data: Partial<TData>): void;
|
|
1730
1353
|
/**
|
|
1731
|
-
*
|
|
1732
|
-
|
|
1733
|
-
setSortModel(model: SortModel[]): void;
|
|
1734
|
-
/**
|
|
1735
|
-
* Get current sort model.
|
|
1736
|
-
*/
|
|
1737
|
-
getSortModel(): SortModel[];
|
|
1738
|
-
/**
|
|
1739
|
-
* Set the filter model.
|
|
1740
|
-
*/
|
|
1741
|
-
setFilterModel(model: FilterModel): void;
|
|
1742
|
-
/**
|
|
1743
|
-
* Get current filter model.
|
|
1744
|
-
*/
|
|
1745
|
-
getFilterModel(): FilterModel;
|
|
1746
|
-
/**
|
|
1747
|
-
* Rebuild sorted indices (full re-sort).
|
|
1748
|
-
*/
|
|
1749
|
-
private rebuildSortedIndices;
|
|
1750
|
-
/**
|
|
1751
|
-
* Rebuild hash cache for all rows.
|
|
1752
|
-
*/
|
|
1753
|
-
private rebuildHashCache;
|
|
1754
|
-
/**
|
|
1755
|
-
* Compute and cache sort hashes for a row.
|
|
1756
|
-
*/
|
|
1757
|
-
private computeRowHashes;
|
|
1758
|
-
/**
|
|
1759
|
-
* Compare two rows using cached hashes.
|
|
1760
|
-
*/
|
|
1761
|
-
private compareRows;
|
|
1762
|
-
/**
|
|
1763
|
-
* Binary search for insertion position in sortedIndices.
|
|
1764
|
-
*/
|
|
1765
|
-
private binarySearchInsertPosition;
|
|
1766
|
-
/**
|
|
1767
|
-
* Rebuild filtered indices.
|
|
1768
|
-
*/
|
|
1769
|
-
private rebuildFilteredIndices;
|
|
1770
|
-
/**
|
|
1771
|
-
* Check if a row passes the current filter.
|
|
1772
|
-
*/
|
|
1773
|
-
private rowPassesFilter;
|
|
1774
|
-
/**
|
|
1775
|
-
* Get visible indices (filtered + sorted).
|
|
1776
|
-
*/
|
|
1777
|
-
private getVisibleIndices;
|
|
1778
|
-
/**
|
|
1779
|
-
* Rebuild distinct values cache for all fields.
|
|
1780
|
-
*/
|
|
1781
|
-
private rebuildDistinctValues;
|
|
1782
|
-
/**
|
|
1783
|
-
* Update distinct-value refcounts when a row is added or removed.
|
|
1784
|
-
* Skips null/undefined cell values — they never enter the filter popup.
|
|
1785
|
-
*/
|
|
1786
|
-
private updateDistinctValuesForRow;
|
|
1787
|
-
/**
|
|
1788
|
-
* Update distinct-value refcounts when a cell value changes: decrement
|
|
1789
|
-
* the old value's count (evicting it if this was the last reference)
|
|
1790
|
-
* and increment the new value's count.
|
|
1791
|
-
*/
|
|
1792
|
-
private updateDistinctValueForField;
|
|
1793
|
-
/**
|
|
1794
|
-
* Add a value (scalar or array) to the distinct-value refcount map.
|
|
1795
|
-
* Creates the field's count map lazily. For arrays, each non-null item
|
|
1796
|
-
* is counted individually so tag-column filters see element-level
|
|
1797
|
-
* distinct values.
|
|
1798
|
-
*/
|
|
1799
|
-
private addToDistinctValues;
|
|
1800
|
-
/**
|
|
1801
|
-
* Decrement refcount(s) for a value (scalar or array). When a count
|
|
1802
|
-
* reaches zero the key is deleted so getDistinctValues() no longer
|
|
1803
|
-
* returns stale values after the last holder is removed.
|
|
1354
|
+
* Move a row from one position to another in storage order. When no sort
|
|
1355
|
+
* is active the new order is reflected on the next fetch.
|
|
1804
1356
|
*/
|
|
1805
|
-
|
|
1357
|
+
moveRow(fromIndex: number, toIndex: number): void;
|
|
1358
|
+
private rebuildIdIndex;
|
|
1806
1359
|
}
|
|
1807
1360
|
//#endregion
|
|
1808
1361
|
//#region src/indexed-data-store/field-helpers.d.ts
|
|
@@ -1822,23 +1375,6 @@ declare function getFieldValue<TData>(row: TData, field: string): CellValue;
|
|
|
1822
1375
|
*/
|
|
1823
1376
|
declare function setFieldValue<TData>(row: TData, field: string, value: CellValue): void;
|
|
1824
1377
|
//#endregion
|
|
1825
|
-
//#region src/indexed-data-store/sorting.d.ts
|
|
1826
|
-
/**
|
|
1827
|
-
* Convert a string to a sortable number using first 10 characters.
|
|
1828
|
-
* Uses base-36 encoding (a-z = 0-25, 0-9 = 26-35).
|
|
1829
|
-
*/
|
|
1830
|
-
declare function stringToSortableNumber(str: string): number;
|
|
1831
|
-
/**
|
|
1832
|
-
* Compare two cell values for sorting.
|
|
1833
|
-
* Handles null/undefined, arrays, numbers, dates, and strings.
|
|
1834
|
-
*/
|
|
1835
|
-
declare function compareValues(a: CellValue, b: CellValue): number;
|
|
1836
|
-
/**
|
|
1837
|
-
* Compute a sortable hash for a cell value.
|
|
1838
|
-
* Used for fast comparisons in sorted indices.
|
|
1839
|
-
*/
|
|
1840
|
-
declare function computeValueHash(value: CellValue): number;
|
|
1841
|
-
//#endregion
|
|
1842
1378
|
//#region src/filtering/index.d.ts
|
|
1843
1379
|
/**
|
|
1844
1380
|
* Check if two dates are on the same day.
|
|
@@ -1969,18 +1505,10 @@ declare class TransactionManager<TData = unknown> {
|
|
|
1969
1505
|
//#endregion
|
|
1970
1506
|
//#region src/grid-core.d.ts
|
|
1971
1507
|
declare class GridCore<TData = unknown> {
|
|
1508
|
+
private readonly config;
|
|
1972
1509
|
private columns;
|
|
1973
|
-
private
|
|
1974
|
-
private readonly
|
|
1975
|
-
private readonly overscan;
|
|
1976
|
-
private readonly maxFlingVelocity;
|
|
1977
|
-
private readonly sortingEnabled;
|
|
1978
|
-
private readonly getRowId?;
|
|
1979
|
-
private readonly onCellValueChanged?;
|
|
1980
|
-
private readonly rowDragEntireRow;
|
|
1981
|
-
private readonly onRowDragEnd?;
|
|
1982
|
-
private readonly onColumnResized?;
|
|
1983
|
-
private readonly onColumnMoved?;
|
|
1510
|
+
private columnPositions;
|
|
1511
|
+
private readonly batcher;
|
|
1984
1512
|
private readonly viewport;
|
|
1985
1513
|
private scrollTopOverride;
|
|
1986
1514
|
private readonly rowData;
|
|
@@ -1989,14 +1517,11 @@ declare class GridCore<TData = unknown> {
|
|
|
1989
1517
|
readonly input: InputHandler<TData>;
|
|
1990
1518
|
readonly highlight: HighlightManager<TData> | null;
|
|
1991
1519
|
readonly sortFilter: SortFilterManager<TData>;
|
|
1992
|
-
readonly rowMutation: RowMutationManager<TData>;
|
|
1993
1520
|
private readonly slotPool;
|
|
1994
1521
|
private readonly editManager;
|
|
1995
|
-
private columnPositions;
|
|
1996
|
-
private readonly batcher;
|
|
1997
1522
|
private readonly scrollVirtualization;
|
|
1523
|
+
private readonly view;
|
|
1998
1524
|
private isDestroyed;
|
|
1999
|
-
private hasWarnedAboutScaledOverscan;
|
|
2000
1525
|
constructor(options: GridCoreOptions<TData>);
|
|
2001
1526
|
/**
|
|
2002
1527
|
* Subscribe to batched instructions for efficient React/Vue state updates.
|
|
@@ -2015,7 +1540,6 @@ declare class GridCore<TData = unknown> {
|
|
|
2015
1540
|
setSort(colId: string, direction: SortDirection | null, addToExisting?: boolean): Promise<void>;
|
|
2016
1541
|
setFilter(colId: string, filter: ColumnFilterModel | string | null): Promise<void>;
|
|
2017
1542
|
hasActiveFilter(colId: string): boolean;
|
|
2018
|
-
getDistinctValuesForColumn(colId: string, maxValues?: number): CellValue[];
|
|
2019
1543
|
/**
|
|
2020
1544
|
* Open a column filter popup.
|
|
2021
1545
|
* Adapters can skip distinct-value computation when their popup only uses
|
|
@@ -2053,15 +1577,7 @@ declare class GridCore<TData = unknown> {
|
|
|
2053
1577
|
setCellValue(row: number, col: number, value: CellValue): void;
|
|
2054
1578
|
private clearSelectionIfInvalid;
|
|
2055
1579
|
private computeColumnPositions;
|
|
2056
|
-
private
|
|
2057
|
-
/**
|
|
2058
|
-
* One-time advisory when scroll virtualization kicks in with a small
|
|
2059
|
-
* overscan: momentum flings move several rows per frame at that scale,
|
|
2060
|
-
* and a small overscan shows blank rows behind the fling.
|
|
2061
|
-
*/
|
|
2062
|
-
private warnIfOverscanTooLowForScaling;
|
|
2063
|
-
private emitHeaders;
|
|
2064
|
-
private emitVisibleRange;
|
|
1580
|
+
private columnOperationDeps;
|
|
2065
1581
|
/**
|
|
2066
1582
|
* Set the displayed width of a column and recompute layout. `width` is the
|
|
2067
1583
|
* post-redistribution displayed width — the stored `column.width` is
|
|
@@ -2098,12 +1614,12 @@ declare class GridCore<TData = unknown> {
|
|
|
2098
1614
|
* synthetic scroller while scroll virtualization is active.
|
|
2099
1615
|
*/
|
|
2100
1616
|
getMaxFlingVelocity(): number;
|
|
2101
|
-
getNaturalHeight(): number;
|
|
2102
1617
|
getScrollRatio(): number;
|
|
2103
1618
|
getVisibleRowRange(): {
|
|
2104
1619
|
start: number;
|
|
2105
1620
|
end: number;
|
|
2106
1621
|
};
|
|
1622
|
+
/** Used structurally by `scrollCellIntoView` in the framework wrappers. */
|
|
2107
1623
|
getScrollTopForRow(rowIndex: number): number;
|
|
2108
1624
|
getRowIndexAtDisplayY(viewportY: number, virtualScrollTop: number): number;
|
|
2109
1625
|
/**
|
|
@@ -2127,31 +1643,6 @@ declare class GridCore<TData = unknown> {
|
|
|
2127
1643
|
* Useful after in-place data modifications like fill operations.
|
|
2128
1644
|
*/
|
|
2129
1645
|
refreshSlotData(): void;
|
|
2130
|
-
/**
|
|
2131
|
-
* Add rows to the grid at the specified index.
|
|
2132
|
-
* If no index is provided, rows are added at the end.
|
|
2133
|
-
*/
|
|
2134
|
-
addRows(rows: TData[], index?: number): void;
|
|
2135
|
-
/**
|
|
2136
|
-
* Update existing rows with partial data.
|
|
2137
|
-
*/
|
|
2138
|
-
updateRows(updates: Array<{
|
|
2139
|
-
index: number;
|
|
2140
|
-
data: Partial<TData>;
|
|
2141
|
-
}>): void;
|
|
2142
|
-
/**
|
|
2143
|
-
* Delete rows at the specified indices.
|
|
2144
|
-
*/
|
|
2145
|
-
deleteRows(indices: number[]): void;
|
|
2146
|
-
/**
|
|
2147
|
-
* Get a row by index.
|
|
2148
|
-
*/
|
|
2149
|
-
getRow(index: number): TData | undefined;
|
|
2150
|
-
/**
|
|
2151
|
-
* Set a complete row at the specified index.
|
|
2152
|
-
* Use this for complete row replacement. For partial updates, use updateRows.
|
|
2153
|
-
*/
|
|
2154
|
-
setRow(index: number, data: TData): void;
|
|
2155
1646
|
/**
|
|
2156
1647
|
* Update the data source and refresh.
|
|
2157
1648
|
* Preserves grid state (sort, filter, scroll position).
|
|
@@ -2170,17 +1661,173 @@ declare class GridCore<TData = unknown> {
|
|
|
2170
1661
|
destroy(): void;
|
|
2171
1662
|
}
|
|
2172
1663
|
//#endregion
|
|
2173
|
-
//#region src/
|
|
1664
|
+
//#region src/sorting/parallel-sort-manager.d.ts
|
|
1665
|
+
interface ParallelSortOptions {
|
|
1666
|
+
/** Maximum number of workers (default: navigator.hardwareConcurrency || 4) */
|
|
1667
|
+
maxWorkers?: number;
|
|
1668
|
+
/** Threshold for parallel sorting (default: 400000) */
|
|
1669
|
+
parallelThreshold?: number;
|
|
1670
|
+
/** Minimum chunk size (default: 50000) */
|
|
1671
|
+
minChunkSize?: number;
|
|
1672
|
+
}
|
|
1673
|
+
//#endregion
|
|
1674
|
+
//#region src/data-source/client-data-source.d.ts
|
|
1675
|
+
interface ClientDataSourceOptions<TData> {
|
|
1676
|
+
/** Custom field accessor for nested properties */
|
|
1677
|
+
getFieldValue?: (row: TData, field: string) => CellValue;
|
|
1678
|
+
/**
|
|
1679
|
+
* Lookup for a field's valueFormatter. Lets free-text filter conditions
|
|
1680
|
+
* compare against the displayed (formatted) value the user typed against.
|
|
1681
|
+
* Values-mode `selectedValues` compare raw values and never use it.
|
|
1682
|
+
*/
|
|
1683
|
+
getValueFormatter?: (field: string) => ((v: CellValue) => string) | undefined;
|
|
1684
|
+
/** Use Web Worker for sorting large datasets (default: true) */
|
|
1685
|
+
useWorker?: boolean;
|
|
1686
|
+
/** Options for parallel sorting (only used when useWorker is true) */
|
|
1687
|
+
parallelSort?: ParallelSortOptions | false;
|
|
1688
|
+
}
|
|
2174
1689
|
/**
|
|
2175
|
-
*
|
|
2176
|
-
*
|
|
2177
|
-
*
|
|
1690
|
+
* Creates a client-side data source that holds all data in memory.
|
|
1691
|
+
* Sorting and filtering are performed client-side.
|
|
1692
|
+
* For large datasets, sorting is automatically offloaded to a Web Worker.
|
|
2178
1693
|
*/
|
|
2179
|
-
declare
|
|
1694
|
+
declare function createClientDataSource<TData = unknown>(data: TData[], options?: ClientDataSourceOptions<TData>): DataSource<TData>;
|
|
2180
1695
|
/**
|
|
2181
|
-
*
|
|
1696
|
+
* Convenience function to create a data source from an array.
|
|
1697
|
+
* This provides backwards compatibility with the old `rowData` prop.
|
|
2182
1698
|
*/
|
|
2183
|
-
declare
|
|
1699
|
+
declare function createDataSourceFromArray<TData = unknown>(data: TData[]): DataSource<TData>;
|
|
1700
|
+
//#endregion
|
|
1701
|
+
//#region src/data-source/server-data-source.d.ts
|
|
1702
|
+
type ServerQueryFunction<TData> = (request: DataSourceRequest) => Promise<DataSourceResponse<TData>>;
|
|
1703
|
+
interface ServerDataSourceOptions {
|
|
1704
|
+
/** Server data sources use paginated loading by default. */
|
|
1705
|
+
loadMode?: DataSourceLoadMode;
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* Creates a server-side data source that delegates all operations to the server.
|
|
1709
|
+
* The query function receives sort/filter/range params to pass to the API.
|
|
1710
|
+
*/
|
|
1711
|
+
declare function createServerDataSource<TData = unknown>(queryFn: ServerQueryFunction<TData>, options?: ServerDataSourceOptions): DataSource<TData>;
|
|
1712
|
+
//#endregion
|
|
1713
|
+
//#region src/data-source/mutable-data-source.d.ts
|
|
1714
|
+
/** Callback for data change notifications */
|
|
1715
|
+
type DataChangeListener = (result: TransactionResult) => void;
|
|
1716
|
+
/**
|
|
1717
|
+
* Data source with mutation capabilities.
|
|
1718
|
+
* Extends DataSource with add, remove, and update operations.
|
|
1719
|
+
*/
|
|
1720
|
+
interface MutableDataSource<TData = unknown> extends DataSource<TData> {
|
|
1721
|
+
/** Add rows to the data source. Queued and processed after debounce. */
|
|
1722
|
+
addRows(rows: TData[]): void;
|
|
1723
|
+
/** Remove rows by ID. Queued and processed after debounce. */
|
|
1724
|
+
removeRows(ids: RowId[]): void;
|
|
1725
|
+
/** Update a cell value. Queued and processed after debounce. */
|
|
1726
|
+
updateCell(id: RowId, field: string, value: CellValue): void;
|
|
1727
|
+
/** Update multiple fields on a row. Queued and processed after debounce. */
|
|
1728
|
+
updateRow(id: RowId, data: Partial<TData>): void;
|
|
1729
|
+
/** Force immediate processing of queued transactions. */
|
|
1730
|
+
flushTransactions(): Promise<void>;
|
|
1731
|
+
/** Check if there are pending transactions. */
|
|
1732
|
+
hasPendingTransactions(): boolean;
|
|
1733
|
+
/** Get distinct values for a field (for filter UI). */
|
|
1734
|
+
getDistinctValues(field: string): CellValue[];
|
|
1735
|
+
/** Get a row by ID. */
|
|
1736
|
+
getRowById(id: RowId): TData | undefined;
|
|
1737
|
+
/** Get total row count. */
|
|
1738
|
+
getTotalRowCount(): number;
|
|
1739
|
+
/** Subscribe to data change notifications. Returns unsubscribe function. */
|
|
1740
|
+
subscribe(listener: DataChangeListener): () => void;
|
|
1741
|
+
/** Clear all data from the data source. */
|
|
1742
|
+
clear(): void;
|
|
1743
|
+
/** Move a row from one display position to another. */
|
|
1744
|
+
moveRow(fromIndex: number, toIndex: number): void;
|
|
1745
|
+
}
|
|
1746
|
+
interface MutableClientDataSourceOptions<TData> {
|
|
1747
|
+
/** Function to extract unique ID from row. Required. */
|
|
1748
|
+
getRowId: (row: TData) => RowId;
|
|
1749
|
+
/** Custom field accessor for nested properties. */
|
|
1750
|
+
getFieldValue?: (row: TData, field: string) => CellValue;
|
|
1751
|
+
/**
|
|
1752
|
+
* Lookup for a field's valueFormatter. Lets free-text filter conditions
|
|
1753
|
+
* compare against the displayed (formatted) value. Values-mode
|
|
1754
|
+
* `selectedValues` compare raw values and never use it.
|
|
1755
|
+
*/
|
|
1756
|
+
getValueFormatter?: (field: string) => ((v: CellValue) => string) | undefined;
|
|
1757
|
+
/** Debounce time for transactions in ms. Default 50. Set to 0 for sync. */
|
|
1758
|
+
debounceMs?: number;
|
|
1759
|
+
/** Callback when transactions are processed. */
|
|
1760
|
+
onTransactionProcessed?: (result: TransactionResult) => void;
|
|
1761
|
+
/** Use Web Worker for sorting large datasets (default: true) */
|
|
1762
|
+
useWorker?: boolean;
|
|
1763
|
+
/** Options for parallel sorting (only used when useWorker is true) */
|
|
1764
|
+
parallelSort?: ParallelSortOptions | false;
|
|
1765
|
+
}
|
|
1766
|
+
/**
|
|
1767
|
+
* Creates a mutable client-side data source with transaction support.
|
|
1768
|
+
* Uses IndexedDataStore for efficient incremental operations.
|
|
1769
|
+
* For large datasets, sorting is automatically offloaded to a Web Worker.
|
|
1770
|
+
*/
|
|
1771
|
+
declare function createMutableClientDataSource<TData = unknown>(data: TData[], options: MutableClientDataSourceOptions<TData>): MutableDataSource<TData>;
|
|
1772
|
+
//#endregion
|
|
1773
|
+
//#region src/filtering/distinct-entries.d.ts
|
|
1774
|
+
/** One checkbox row in the values-mode filter popup. */
|
|
1775
|
+
interface DistinctValueEntry {
|
|
1776
|
+
/** Formatted display string shown next to the checkbox. */
|
|
1777
|
+
label: string;
|
|
1778
|
+
/** All raw values that format to this label. Ticking the label selects them all. */
|
|
1779
|
+
values: CellValue[];
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* Canonical identity key for a raw cell value, used to compare values-mode
|
|
1783
|
+
* selections against cell values without ever consulting a formatter.
|
|
1784
|
+
*
|
|
1785
|
+
* Type-prefixed so raw `5` and raw `"5"` never collide. Arrays are sorted by
|
|
1786
|
+
* their elements' own keys first so element order is irrelevant (same rule as
|
|
1787
|
+
* the distinct-value scan). Objects rely on JSON.stringify, so key order matters
|
|
1788
|
+
* for them — a pre-existing limitation of distinct-value identity.
|
|
1789
|
+
*/
|
|
1790
|
+
declare const rawValueKey: (value: CellValue) => string;
|
|
1791
|
+
/**
|
|
1792
|
+
* Whether a cell value counts as blank for filtering purposes: null,
|
|
1793
|
+
* undefined, empty string, or empty array (e.g. a tags column with no tags).
|
|
1794
|
+
* Blank cells are matched via `TextFilterCondition.includeBlank` — the
|
|
1795
|
+
* popup's "(Blanks)" checkbox — never via `selectedValues`.
|
|
1796
|
+
*/
|
|
1797
|
+
declare const isBlankCellValue: (value: CellValue) => boolean;
|
|
1798
|
+
/**
|
|
1799
|
+
* Group raw distinct values by their display label.
|
|
1800
|
+
*
|
|
1801
|
+
* Multiple raw values can format to the same label; the returned entry keeps
|
|
1802
|
+
* every one of them so that applying the filter selects all rows rendering
|
|
1803
|
+
* that label. Blank values are skipped (the popup exposes them through the
|
|
1804
|
+
* dedicated "include blanks" checkbox), arrays are normalized to sorted
|
|
1805
|
+
* copies, and raws are deduplicated within a group by {@link rawValueKey}.
|
|
1806
|
+
*/
|
|
1807
|
+
declare const groupDistinctValues: (values: readonly CellValue[], formatter?: (v: CellValue) => string) => DistinctValueEntry[];
|
|
1808
|
+
/**
|
|
1809
|
+
* Map a filter model's raw `selectedValues` back to the popup labels that
|
|
1810
|
+
* should render as ticked. A label is ticked when at least one of its raw
|
|
1811
|
+
* values is selected (data may have changed since the filter was applied).
|
|
1812
|
+
*/
|
|
1813
|
+
declare const labelsForSelectedValues: (entries: readonly DistinctValueEntry[], selectedValues: ReadonlySet<CellValue>) => Set<string>;
|
|
1814
|
+
/**
|
|
1815
|
+
* Collect the raw values behind the ticked labels — the set to store in
|
|
1816
|
+
* `TextFilterCondition.selectedValues` on apply.
|
|
1817
|
+
*/
|
|
1818
|
+
declare const rawValuesForLabels: (entries: readonly DistinctValueEntry[], labels: ReadonlySet<string>) => Set<CellValue>;
|
|
1819
|
+
//#endregion
|
|
1820
|
+
//#region src/utils/positioning.d.ts
|
|
1821
|
+
/**
|
|
1822
|
+
* Calculate cumulative column positions (prefix sums)
|
|
1823
|
+
* Returns an array where positions[i] is the left position of column i
|
|
1824
|
+
* positions[columns.length] is the total width
|
|
1825
|
+
*/
|
|
1826
|
+
declare const calculateColumnPositions: (columns: ColumnDefinition[]) => number[];
|
|
1827
|
+
/**
|
|
1828
|
+
* Get total width from column positions
|
|
1829
|
+
*/
|
|
1830
|
+
declare const getTotalWidth: (columnPositions: number[]) => number;
|
|
2184
1831
|
/**
|
|
2185
1832
|
* Calculate scaled column positions when container is wider than total column widths.
|
|
2186
1833
|
* Columns expand proportionally based on their original width ratios.
|
|
@@ -2232,20 +1879,6 @@ declare const isCellInFillPreview: (row: number, col: number, isDraggingFill: bo
|
|
|
2232
1879
|
* Build cell CSS classes based on state
|
|
2233
1880
|
*/
|
|
2234
1881
|
declare const buildCellClasses: (isActive: boolean, isSelected: boolean, isEditing: boolean, inFillPreview: boolean) => string;
|
|
2235
|
-
/**
|
|
2236
|
-
* Check if a row overlaps the selection range
|
|
2237
|
-
*/
|
|
2238
|
-
declare const isRowInSelectionRange: (rowIndex: number, range: CellRange | null) => boolean;
|
|
2239
|
-
/**
|
|
2240
|
-
* Check if a column overlaps the selection range
|
|
2241
|
-
*/
|
|
2242
|
-
declare const isColumnInSelectionRange: (colIndex: number, range: CellRange | null) => boolean;
|
|
2243
|
-
//#endregion
|
|
2244
|
-
//#region src/utils/event-emitter.d.ts
|
|
2245
|
-
/**
|
|
2246
|
-
* Batch instruction listener for efficient state updates
|
|
2247
|
-
*/
|
|
2248
|
-
type BatchInstructionListener$1 = (instructions: GridInstruction[]) => void;
|
|
2249
1882
|
//#endregion
|
|
2250
1883
|
//#region src/types/ui-state.d.ts
|
|
2251
1884
|
interface SlotData<TData = unknown> {
|
|
@@ -2315,11 +1948,16 @@ interface GridState<TData = unknown> {
|
|
|
2315
1948
|
pendingScrollTop: number | null;
|
|
2316
1949
|
}
|
|
2317
1950
|
//#endregion
|
|
2318
|
-
//#region src/
|
|
1951
|
+
//#region src/state-reducer.d.ts
|
|
2319
1952
|
/**
|
|
2320
|
-
*
|
|
1953
|
+
* Apply a single instruction to mutable slot/header Maps and return
|
|
1954
|
+
* other state changes as a partial object.
|
|
1955
|
+
*
|
|
1956
|
+
* Returns `null` when only the Maps were mutated (no primitive field changes).
|
|
2321
1957
|
*/
|
|
2322
|
-
declare const
|
|
1958
|
+
declare const applyInstruction: <TData = unknown>(instruction: GridInstruction, slots: Map<string, SlotData<TData>>, headers: Map<number, HeaderData>) => Partial<GridState<TData>> | null;
|
|
1959
|
+
//#endregion
|
|
1960
|
+
//#region src/utils/scroll-helpers.d.ts
|
|
2323
1961
|
/**
|
|
2324
1962
|
* Column geometry needed to scroll a cell horizontally into view.
|
|
2325
1963
|
* Columns are not scroll-virtualized, so positions map 1:1 to scrollLeft.
|
|
@@ -2427,500 +2065,6 @@ declare const calculateFilterPopupPosition: (headerCell: HTMLElement, popupEl: H
|
|
|
2427
2065
|
*/
|
|
2428
2066
|
declare const bindPeekSelectAll: (overlay: HTMLElement) => (() => void);
|
|
2429
2067
|
//#endregion
|
|
2430
|
-
//#region src/slot-pool.d.ts
|
|
2431
|
-
interface SlotPoolManagerOptions {
|
|
2432
|
-
/** Get current row height */
|
|
2433
|
-
getRowHeight: () => number;
|
|
2434
|
-
/** Get current header height */
|
|
2435
|
-
getHeaderHeight: () => number;
|
|
2436
|
-
/** Get overscan count */
|
|
2437
|
-
getOverscan: () => number;
|
|
2438
|
-
/** Get current scroll top position (natural, not virtual) */
|
|
2439
|
-
getScrollTop: () => number;
|
|
2440
|
-
/** Get viewport height */
|
|
2441
|
-
getViewportHeight: () => number;
|
|
2442
|
-
/** Get total row count */
|
|
2443
|
-
getTotalRows: () => number;
|
|
2444
|
-
/** Get scroll ratio for virtualization (1 = no virtualization) */
|
|
2445
|
-
getScrollRatio: () => number;
|
|
2446
|
-
/** Get virtual content height */
|
|
2447
|
-
getVirtualContentHeight: () => number;
|
|
2448
|
-
/** Get row data by index */
|
|
2449
|
-
getRowData: (rowIndex: number) => unknown;
|
|
2450
|
-
}
|
|
2451
|
-
/**
|
|
2452
|
-
* Manages the slot pool for virtual scrolling.
|
|
2453
|
-
* Handles slot creation, recycling, positioning, and destruction.
|
|
2454
|
-
*/
|
|
2455
|
-
declare class SlotPoolManager {
|
|
2456
|
-
private readonly state;
|
|
2457
|
-
private readonly options;
|
|
2458
|
-
private readonly emitter;
|
|
2459
|
-
private isDestroyed;
|
|
2460
|
-
onInstruction: (listener: InstructionListener) => () => void;
|
|
2461
|
-
onBatchInstruction: (listener: BatchInstructionListener$1) => () => void;
|
|
2462
|
-
private readonly emit;
|
|
2463
|
-
private readonly emitBatch;
|
|
2464
|
-
constructor(options: SlotPoolManagerOptions);
|
|
2465
|
-
/**
|
|
2466
|
-
* Get the slot ID for a given row index.
|
|
2467
|
-
*/
|
|
2468
|
-
getSlotForRow(rowIndex: number): string | undefined;
|
|
2469
|
-
/**
|
|
2470
|
-
* Get all current slots.
|
|
2471
|
-
*/
|
|
2472
|
-
getSlots(): Map<string, SlotState>;
|
|
2473
|
-
/**
|
|
2474
|
-
* Synchronize slots with current viewport position.
|
|
2475
|
-
* This implements the slot recycling strategy.
|
|
2476
|
-
*/
|
|
2477
|
-
syncSlots(): void;
|
|
2478
|
-
/**
|
|
2479
|
-
* Partition existing slots into recyclable and still-needed.
|
|
2480
|
-
* Mutates requiredRows: rows that already have a slot are removed.
|
|
2481
|
-
*/
|
|
2482
|
-
private partitionSlots;
|
|
2483
|
-
/**
|
|
2484
|
-
* Assign a row to a recycled or newly created slot.
|
|
2485
|
-
*/
|
|
2486
|
-
private assignSlotToRow;
|
|
2487
|
-
/**
|
|
2488
|
-
* Push MOVE_SLOT instructions for slots whose position has drifted.
|
|
2489
|
-
*/
|
|
2490
|
-
private updateSlotPositions;
|
|
2491
|
-
/**
|
|
2492
|
-
* Destroy all slots.
|
|
2493
|
-
*/
|
|
2494
|
-
destroyAllSlots(): void;
|
|
2495
|
-
/**
|
|
2496
|
-
* Clean up resources for garbage collection.
|
|
2497
|
-
* This method is idempotent - safe to call multiple times.
|
|
2498
|
-
*/
|
|
2499
|
-
destroy(): void;
|
|
2500
|
-
/**
|
|
2501
|
-
* Refresh all slot data without changing which rows are displayed.
|
|
2502
|
-
* Used after filtering/sorting when data changes.
|
|
2503
|
-
*/
|
|
2504
|
-
refreshAllSlots(): void;
|
|
2505
|
-
/**
|
|
2506
|
-
* Update a single slot's data.
|
|
2507
|
-
*/
|
|
2508
|
-
updateSlot(rowIndex: number): void;
|
|
2509
|
-
/**
|
|
2510
|
-
* Calculate the translateY position for a row.
|
|
2511
|
-
* Handles scroll virtualization for very large datasets.
|
|
2512
|
-
*
|
|
2513
|
-
* When virtualization is active (scrollRatio < 1), we use viewport-relative
|
|
2514
|
-
* positioning to keep translateY values small. This prevents browser rendering
|
|
2515
|
-
* issues that occur at extreme pixel values (millions of pixels).
|
|
2516
|
-
*
|
|
2517
|
-
* Note: The header is rendered outside the content sizer, so row positions
|
|
2518
|
-
* start at 0 (not headerHeight) within the rows container.
|
|
2519
|
-
*/
|
|
2520
|
-
private getRowTranslateY;
|
|
2521
|
-
/**
|
|
2522
|
-
* Get the translateY position for a row inside the rows wrapper.
|
|
2523
|
-
* Public accessor for use by input handler (e.g., drop indicator positioning).
|
|
2524
|
-
*/
|
|
2525
|
-
getRowTranslateYForIndex(rowIndex: number): number;
|
|
2526
|
-
/**
|
|
2527
|
-
* Get the Y offset for the rows wrapper container.
|
|
2528
|
-
* When virtualization is active, this positions the wrapper so rows
|
|
2529
|
-
* with small translateY values appear at the correct scroll position.
|
|
2530
|
-
*/
|
|
2531
|
-
getRowsWrapperOffset(): number;
|
|
2532
|
-
}
|
|
2533
|
-
//#endregion
|
|
2534
|
-
//#region src/edit-manager.d.ts
|
|
2535
|
-
interface EditManagerOptions {
|
|
2536
|
-
/** Get column definition by index */
|
|
2537
|
-
getColumn: (colIndex: number) => ColumnDefinition | undefined;
|
|
2538
|
-
/** Get cell value */
|
|
2539
|
-
getCellValue: (row: number, col: number) => CellValue;
|
|
2540
|
-
/** Set cell value */
|
|
2541
|
-
setCellValue: (row: number, col: number, value: CellValue) => void;
|
|
2542
|
-
/** Callback when edit is committed (to update slot display) */
|
|
2543
|
-
onCommit?: (row: number, col: number, value: CellValue) => void;
|
|
2544
|
-
}
|
|
2545
|
-
/**
|
|
2546
|
-
* Manages cell editing state and operations.
|
|
2547
|
-
*/
|
|
2548
|
-
declare class EditManager {
|
|
2549
|
-
private editState;
|
|
2550
|
-
private peekState;
|
|
2551
|
-
private readonly options;
|
|
2552
|
-
private readonly emitter;
|
|
2553
|
-
onInstruction: (listener: InstructionListener) => () => void;
|
|
2554
|
-
private readonly emit;
|
|
2555
|
-
constructor(options: EditManagerOptions);
|
|
2556
|
-
/**
|
|
2557
|
-
* Get the current edit state.
|
|
2558
|
-
*/
|
|
2559
|
-
getState(): EditState | null;
|
|
2560
|
-
/**
|
|
2561
|
-
* Check if currently editing.
|
|
2562
|
-
*/
|
|
2563
|
-
isEditing(): boolean;
|
|
2564
|
-
/**
|
|
2565
|
-
* Check if a specific cell is being edited.
|
|
2566
|
-
*/
|
|
2567
|
-
isEditingCell(row: number, col: number): boolean;
|
|
2568
|
-
/**
|
|
2569
|
-
* Start editing a cell.
|
|
2570
|
-
* Returns true if edit was started, false if cell is not editable.
|
|
2571
|
-
*/
|
|
2572
|
-
startEdit(row: number, col: number): boolean;
|
|
2573
|
-
/**
|
|
2574
|
-
* Get the cell currently shown in a peek overlay, or null.
|
|
2575
|
-
*/
|
|
2576
|
-
getPeekState(): CellPosition | null;
|
|
2577
|
-
/**
|
|
2578
|
-
* Open a peek overlay on a cell. Caller is responsible for guarding on
|
|
2579
|
-
* `column.peekable` — the manager only refuses when an edit is in progress
|
|
2580
|
-
* (edit and peek are mutually exclusive).
|
|
2581
|
-
* Returns true if the peek was opened.
|
|
2582
|
-
*/
|
|
2583
|
-
startPeek(row: number, col: number): boolean;
|
|
2584
|
-
/**
|
|
2585
|
-
* Close any active peek overlay. No-op if none is open.
|
|
2586
|
-
*/
|
|
2587
|
-
stopPeek(): void;
|
|
2588
|
-
/**
|
|
2589
|
-
* Update the current edit value.
|
|
2590
|
-
*/
|
|
2591
|
-
updateValue(value: CellValue): void;
|
|
2592
|
-
/**
|
|
2593
|
-
* Commit the current edit.
|
|
2594
|
-
* Saves the value and closes the editor.
|
|
2595
|
-
*/
|
|
2596
|
-
commit(): void;
|
|
2597
|
-
/**
|
|
2598
|
-
* Cancel the current edit.
|
|
2599
|
-
* Discards changes and closes the editor.
|
|
2600
|
-
*/
|
|
2601
|
-
cancel(): void;
|
|
2602
|
-
/**
|
|
2603
|
-
* Clean up resources for garbage collection.
|
|
2604
|
-
*/
|
|
2605
|
-
destroy(): void;
|
|
2606
|
-
}
|
|
2607
|
-
//#endregion
|
|
2608
|
-
//#region src/sorting/parallel-sort-manager.d.ts
|
|
2609
|
-
interface ParallelSortOptions {
|
|
2610
|
-
/** Maximum number of workers (default: navigator.hardwareConcurrency || 4) */
|
|
2611
|
-
maxWorkers?: number;
|
|
2612
|
-
/** Threshold for parallel sorting (default: 400000) */
|
|
2613
|
-
parallelThreshold?: number;
|
|
2614
|
-
/** Minimum chunk size (default: 50000) */
|
|
2615
|
-
minChunkSize?: number;
|
|
2616
|
-
}
|
|
2617
|
-
/**
|
|
2618
|
-
* Manages parallel sorting operations using a worker pool.
|
|
2619
|
-
* Automatically decides between single-worker and parallel sorting based on data size.
|
|
2620
|
-
*/
|
|
2621
|
-
declare class ParallelSortManager {
|
|
2622
|
-
private readonly pool;
|
|
2623
|
-
private readonly parallelThreshold;
|
|
2624
|
-
private readonly minChunkSize;
|
|
2625
|
-
private isTerminated;
|
|
2626
|
-
constructor(options?: ParallelSortOptions);
|
|
2627
|
-
isAvailable(): boolean;
|
|
2628
|
-
terminate(): void;
|
|
2629
|
-
sortIndices(values: number[], direction: "asc" | "desc"): Promise<Uint32Array>;
|
|
2630
|
-
sortStringHashes(hashChunks: Float64Array[], direction: "asc" | "desc", originalStrings: string[]): Promise<Uint32Array>;
|
|
2631
|
-
sortMultiColumn(columns: number[][], directions: ("asc" | "desc")[]): Promise<Uint32Array>;
|
|
2632
|
-
private assertNotTerminated;
|
|
2633
|
-
private sortIndicesSingle;
|
|
2634
|
-
private sortStringHashesSingle;
|
|
2635
|
-
private sortMultiColumnSingle;
|
|
2636
|
-
private boundariesFor;
|
|
2637
|
-
private runChunks;
|
|
2638
|
-
private sortIndicesParallel;
|
|
2639
|
-
private sortStringHashesParallel;
|
|
2640
|
-
private sortMultiColumnParallel;
|
|
2641
|
-
}
|
|
2642
|
-
//#endregion
|
|
2643
|
-
//#region src/sorting/worker-pool.d.ts
|
|
2644
|
-
interface WorkerPoolOptions {
|
|
2645
|
-
/** Maximum number of workers (default: navigator.hardwareConcurrency ?? 4) */
|
|
2646
|
-
maxWorkers?: number;
|
|
2647
|
-
/** Whether to pre-warm workers on initialization */
|
|
2648
|
-
preWarm?: boolean;
|
|
2649
|
-
}
|
|
2650
|
-
/**
|
|
2651
|
-
* Manages a pool of Web Workers for parallel task execution.
|
|
2652
|
-
* Workers are created lazily and reused across operations.
|
|
2653
|
-
*/
|
|
2654
|
-
declare class WorkerPool {
|
|
2655
|
-
private readonly workerCode;
|
|
2656
|
-
private readonly maxWorkers;
|
|
2657
|
-
private workers;
|
|
2658
|
-
private workerUrl;
|
|
2659
|
-
private nextRequestId;
|
|
2660
|
-
private isTerminated;
|
|
2661
|
-
constructor(workerCode: string, options?: WorkerPoolOptions);
|
|
2662
|
-
/**
|
|
2663
|
-
* Get the current pool size (number of active workers).
|
|
2664
|
-
*/
|
|
2665
|
-
getPoolSize(): number;
|
|
2666
|
-
/**
|
|
2667
|
-
* Get the maximum pool size.
|
|
2668
|
-
*/
|
|
2669
|
-
getMaxWorkers(): number;
|
|
2670
|
-
/**
|
|
2671
|
-
* Check if the pool is available for use.
|
|
2672
|
-
*/
|
|
2673
|
-
isAvailable(): boolean;
|
|
2674
|
-
/**
|
|
2675
|
-
* Execute a single task on an available worker.
|
|
2676
|
-
* Returns the worker's response.
|
|
2677
|
-
*/
|
|
2678
|
-
execute<TRequest extends {
|
|
2679
|
-
id?: number;
|
|
2680
|
-
}, TResponse>(request: TRequest, transferables?: Transferable[]): Promise<TResponse>;
|
|
2681
|
-
/**
|
|
2682
|
-
* Execute multiple tasks in parallel across available workers.
|
|
2683
|
-
* Each task is assigned to a different worker if possible.
|
|
2684
|
-
* Returns results in the same order as the input requests.
|
|
2685
|
-
*/
|
|
2686
|
-
executeParallel<TRequest extends {
|
|
2687
|
-
id?: number;
|
|
2688
|
-
}, TResponse>(tasks: Array<{
|
|
2689
|
-
request: TRequest;
|
|
2690
|
-
transferables?: Transferable[];
|
|
2691
|
-
}>): Promise<TResponse[]>;
|
|
2692
|
-
/**
|
|
2693
|
-
* Terminate all workers and clean up resources.
|
|
2694
|
-
*/
|
|
2695
|
-
terminate(): void;
|
|
2696
|
-
/**
|
|
2697
|
-
* Pre-warm workers by creating them ahead of time.
|
|
2698
|
-
*/
|
|
2699
|
-
private preWarmWorkers;
|
|
2700
|
-
/**
|
|
2701
|
-
* Ensure at least `count` workers exist in the pool.
|
|
2702
|
-
*/
|
|
2703
|
-
private ensureWorkers;
|
|
2704
|
-
/**
|
|
2705
|
-
* Get an available worker, creating one if needed.
|
|
2706
|
-
*/
|
|
2707
|
-
private getAvailableWorker;
|
|
2708
|
-
/**
|
|
2709
|
-
* Create a new worker and add it to the pool.
|
|
2710
|
-
*/
|
|
2711
|
-
private createWorker;
|
|
2712
|
-
/**
|
|
2713
|
-
* Respawn a failed worker.
|
|
2714
|
-
*/
|
|
2715
|
-
private respawnWorker;
|
|
2716
|
-
}
|
|
2717
|
-
//#endregion
|
|
2718
|
-
//#region src/sorting/k-way-merge.d.ts
|
|
2719
|
-
/**
|
|
2720
|
-
* Represents a sorted chunk with its values and offset in the original array.
|
|
2721
|
-
*/
|
|
2722
|
-
interface SortedChunk {
|
|
2723
|
-
/** Sorted indices (local to this chunk) */
|
|
2724
|
-
indices: Uint32Array;
|
|
2725
|
-
/** Values for comparison (in same order as indices) */
|
|
2726
|
-
values: Float64Array;
|
|
2727
|
-
/** Offset of this chunk in the original array */
|
|
2728
|
-
offset: number;
|
|
2729
|
-
}
|
|
2730
|
-
/**
|
|
2731
|
-
* Represents a sorted chunk for multi-column sorting.
|
|
2732
|
-
*/
|
|
2733
|
-
interface MultiColumnSortedChunk {
|
|
2734
|
-
/** Sorted indices (local to this chunk) */
|
|
2735
|
-
indices: Uint32Array;
|
|
2736
|
-
/** Values for comparison - array of columns, each in same order as indices */
|
|
2737
|
-
columns: Float64Array[];
|
|
2738
|
-
/** Sort directions for each column (1 = asc, -1 = desc) */
|
|
2739
|
-
directions: Int8Array;
|
|
2740
|
-
/** Offset of this chunk in the original array */
|
|
2741
|
-
offset: number;
|
|
2742
|
-
}
|
|
2743
|
-
/**
|
|
2744
|
-
* Merge multiple sorted chunks into a single sorted result.
|
|
2745
|
-
* Uses a min-heap for O(n log k) time complexity.
|
|
2746
|
-
*
|
|
2747
|
-
* @param chunks - Array of sorted chunks to merge
|
|
2748
|
-
* @param direction - Sort direction ('asc' or 'desc')
|
|
2749
|
-
* @returns Uint32Array of globally sorted indices
|
|
2750
|
-
*/
|
|
2751
|
-
declare function kWayMerge(chunks: SortedChunk[], direction: SortDirection): Uint32Array;
|
|
2752
|
-
/**
|
|
2753
|
-
* Merge multiple sorted chunks for multi-column sorting.
|
|
2754
|
-
*
|
|
2755
|
-
* @param chunks - Array of multi-column sorted chunks
|
|
2756
|
-
* @returns Uint32Array of globally sorted indices
|
|
2757
|
-
*/
|
|
2758
|
-
declare function kWayMergeMultiColumn(chunks: MultiColumnSortedChunk[]): Uint32Array;
|
|
2759
|
-
/**
|
|
2760
|
-
* Detect collision runs at chunk boundaries after merge.
|
|
2761
|
-
* This is used for string sorting where hashes may collide across chunks.
|
|
2762
|
-
*
|
|
2763
|
-
* @param chunks - Original sorted chunks with their hash values
|
|
2764
|
-
* @param _direction - Sort direction
|
|
2765
|
-
* @returns Array of boundary collision positions [start1, end1, start2, end2, ...]
|
|
2766
|
-
*/
|
|
2767
|
-
declare function detectBoundaryCollisions(chunks: SortedChunk[], _direction: SortDirection): Uint32Array;
|
|
2768
|
-
//#endregion
|
|
2769
|
-
//#region src/data-source/client-data-source.d.ts
|
|
2770
|
-
interface ClientDataSourceOptions<TData> {
|
|
2771
|
-
/** Custom field accessor for nested properties */
|
|
2772
|
-
getFieldValue?: (row: TData, field: string) => CellValue;
|
|
2773
|
-
/**
|
|
2774
|
-
* Lookup for a field's valueFormatter. Lets free-text filter conditions
|
|
2775
|
-
* compare against the displayed (formatted) value the user typed against.
|
|
2776
|
-
* Values-mode `selectedValues` compare raw values and never use it.
|
|
2777
|
-
*/
|
|
2778
|
-
getValueFormatter?: (field: string) => ((v: CellValue) => string) | undefined;
|
|
2779
|
-
/** Use Web Worker for sorting large datasets (default: true) */
|
|
2780
|
-
useWorker?: boolean;
|
|
2781
|
-
/** Options for parallel sorting (only used when useWorker is true) */
|
|
2782
|
-
parallelSort?: ParallelSortOptions | false;
|
|
2783
|
-
}
|
|
2784
|
-
/**
|
|
2785
|
-
* Creates a client-side data source that holds all data in memory.
|
|
2786
|
-
* Sorting and filtering are performed client-side.
|
|
2787
|
-
* For large datasets, sorting is automatically offloaded to a Web Worker.
|
|
2788
|
-
*/
|
|
2789
|
-
declare function createClientDataSource<TData = unknown>(data: TData[], options?: ClientDataSourceOptions<TData>): DataSource<TData>;
|
|
2790
|
-
/**
|
|
2791
|
-
* Convenience function to create a data source from an array.
|
|
2792
|
-
* This provides backwards compatibility with the old `rowData` prop.
|
|
2793
|
-
*/
|
|
2794
|
-
declare function createDataSourceFromArray<TData = unknown>(data: TData[]): DataSource<TData>;
|
|
2795
|
-
//#endregion
|
|
2796
|
-
//#region src/data-source/server-data-source.d.ts
|
|
2797
|
-
type ServerQueryFunction<TData> = (request: DataSourceRequest) => Promise<DataSourceResponse<TData>>;
|
|
2798
|
-
interface ServerDataSourceOptions {
|
|
2799
|
-
/** Server data sources use paginated loading by default. */
|
|
2800
|
-
loadMode?: DataSourceLoadMode;
|
|
2801
|
-
}
|
|
2802
|
-
/**
|
|
2803
|
-
* Creates a server-side data source that delegates all operations to the server.
|
|
2804
|
-
* The query function receives sort/filter/range params to pass to the API.
|
|
2805
|
-
*/
|
|
2806
|
-
declare function createServerDataSource<TData = unknown>(queryFn: ServerQueryFunction<TData>, options?: ServerDataSourceOptions): DataSource<TData>;
|
|
2807
|
-
//#endregion
|
|
2808
|
-
//#region src/data-source/mutable-data-source.d.ts
|
|
2809
|
-
/** Callback for data change notifications */
|
|
2810
|
-
type DataChangeListener = (result: TransactionResult) => void;
|
|
2811
|
-
/**
|
|
2812
|
-
* Data source with mutation capabilities.
|
|
2813
|
-
* Extends DataSource with add, remove, and update operations.
|
|
2814
|
-
*/
|
|
2815
|
-
interface MutableDataSource<TData = unknown> extends DataSource<TData> {
|
|
2816
|
-
/** Add rows to the data source. Queued and processed after debounce. */
|
|
2817
|
-
addRows(rows: TData[]): void;
|
|
2818
|
-
/** Remove rows by ID. Queued and processed after debounce. */
|
|
2819
|
-
removeRows(ids: RowId[]): void;
|
|
2820
|
-
/** Update a cell value. Queued and processed after debounce. */
|
|
2821
|
-
updateCell(id: RowId, field: string, value: CellValue): void;
|
|
2822
|
-
/** Update multiple fields on a row. Queued and processed after debounce. */
|
|
2823
|
-
updateRow(id: RowId, data: Partial<TData>): void;
|
|
2824
|
-
/** Force immediate processing of queued transactions. */
|
|
2825
|
-
flushTransactions(): Promise<void>;
|
|
2826
|
-
/** Check if there are pending transactions. */
|
|
2827
|
-
hasPendingTransactions(): boolean;
|
|
2828
|
-
/** Get distinct values for a field (for filter UI). */
|
|
2829
|
-
getDistinctValues(field: string): CellValue[];
|
|
2830
|
-
/** Get a row by ID. */
|
|
2831
|
-
getRowById(id: RowId): TData | undefined;
|
|
2832
|
-
/** Get total row count. */
|
|
2833
|
-
getTotalRowCount(): number;
|
|
2834
|
-
/** Subscribe to data change notifications. Returns unsubscribe function. */
|
|
2835
|
-
subscribe(listener: DataChangeListener): () => void;
|
|
2836
|
-
/** Clear all data from the data source. */
|
|
2837
|
-
clear(): void;
|
|
2838
|
-
/** Move a row from one display position to another. */
|
|
2839
|
-
moveRow(fromIndex: number, toIndex: number): void;
|
|
2840
|
-
}
|
|
2841
|
-
interface MutableClientDataSourceOptions<TData> {
|
|
2842
|
-
/** Function to extract unique ID from row. Required. */
|
|
2843
|
-
getRowId: (row: TData) => RowId;
|
|
2844
|
-
/** Custom field accessor for nested properties. */
|
|
2845
|
-
getFieldValue?: (row: TData, field: string) => CellValue;
|
|
2846
|
-
/**
|
|
2847
|
-
* Lookup for a field's valueFormatter. Lets free-text filter conditions
|
|
2848
|
-
* compare against the displayed (formatted) value. Values-mode
|
|
2849
|
-
* `selectedValues` compare raw values and never use it.
|
|
2850
|
-
*/
|
|
2851
|
-
getValueFormatter?: (field: string) => ((v: CellValue) => string) | undefined;
|
|
2852
|
-
/** Debounce time for transactions in ms. Default 50. Set to 0 for sync. */
|
|
2853
|
-
debounceMs?: number;
|
|
2854
|
-
/** Callback when transactions are processed. */
|
|
2855
|
-
onTransactionProcessed?: (result: TransactionResult) => void;
|
|
2856
|
-
/** Use Web Worker for sorting large datasets (default: true) */
|
|
2857
|
-
useWorker?: boolean;
|
|
2858
|
-
/** Options for parallel sorting (only used when useWorker is true) */
|
|
2859
|
-
parallelSort?: ParallelSortOptions | false;
|
|
2860
|
-
}
|
|
2861
|
-
/**
|
|
2862
|
-
* Creates a mutable client-side data source with transaction support.
|
|
2863
|
-
* Uses IndexedDataStore for efficient incremental operations.
|
|
2864
|
-
* For large datasets, sorting is automatically offloaded to a Web Worker.
|
|
2865
|
-
*/
|
|
2866
|
-
declare function createMutableClientDataSource<TData = unknown>(data: TData[], options: MutableClientDataSourceOptions<TData>): MutableDataSource<TData>;
|
|
2867
|
-
//#endregion
|
|
2868
|
-
//#region src/filtering/distinct-entries.d.ts
|
|
2869
|
-
/** One checkbox row in the values-mode filter popup. */
|
|
2870
|
-
interface DistinctValueEntry {
|
|
2871
|
-
/** Formatted display string shown next to the checkbox. */
|
|
2872
|
-
label: string;
|
|
2873
|
-
/** All raw values that format to this label. Ticking the label selects them all. */
|
|
2874
|
-
values: CellValue[];
|
|
2875
|
-
}
|
|
2876
|
-
/**
|
|
2877
|
-
* Canonical identity key for a raw cell value, used to compare values-mode
|
|
2878
|
-
* selections against cell values without ever consulting a formatter.
|
|
2879
|
-
*
|
|
2880
|
-
* Type-prefixed so raw `5` and raw `"5"` never collide. Arrays are sorted by
|
|
2881
|
-
* their elements' own keys first so element order is irrelevant (same rule as
|
|
2882
|
-
* the distinct-value scan). Objects rely on JSON.stringify, so key order matters
|
|
2883
|
-
* for them — a pre-existing limitation of distinct-value identity.
|
|
2884
|
-
*/
|
|
2885
|
-
declare const rawValueKey: (value: CellValue) => string;
|
|
2886
|
-
/**
|
|
2887
|
-
* Whether a cell value counts as blank for filtering purposes: null,
|
|
2888
|
-
* undefined, empty string, or empty array (e.g. a tags column with no tags).
|
|
2889
|
-
* Blank cells are matched via `TextFilterCondition.includeBlank` — the
|
|
2890
|
-
* popup's "(Blanks)" checkbox — never via `selectedValues`.
|
|
2891
|
-
*/
|
|
2892
|
-
declare const isBlankCellValue: (value: CellValue) => boolean;
|
|
2893
|
-
/**
|
|
2894
|
-
* Group raw distinct values by their display label.
|
|
2895
|
-
*
|
|
2896
|
-
* Multiple raw values can format to the same label; the returned entry keeps
|
|
2897
|
-
* every one of them so that applying the filter selects all rows rendering
|
|
2898
|
-
* that label. Blank values are skipped (the popup exposes them through the
|
|
2899
|
-
* dedicated "include blanks" checkbox), arrays are normalized to sorted
|
|
2900
|
-
* copies, and raws are deduplicated within a group by {@link rawValueKey}.
|
|
2901
|
-
*/
|
|
2902
|
-
declare const groupDistinctValues: (values: readonly CellValue[], formatter?: (v: CellValue) => string) => DistinctValueEntry[];
|
|
2903
|
-
/**
|
|
2904
|
-
* Map a filter model's raw `selectedValues` back to the popup labels that
|
|
2905
|
-
* should render as ticked. A label is ticked when at least one of its raw
|
|
2906
|
-
* values is selected (data may have changed since the filter was applied).
|
|
2907
|
-
*/
|
|
2908
|
-
declare const labelsForSelectedValues: (entries: readonly DistinctValueEntry[], selectedValues: ReadonlySet<CellValue>) => Set<string>;
|
|
2909
|
-
/**
|
|
2910
|
-
* Collect the raw values behind the ticked labels — the set to store in
|
|
2911
|
-
* `TextFilterCondition.selectedValues` on apply.
|
|
2912
|
-
*/
|
|
2913
|
-
declare const rawValuesForLabels: (entries: readonly DistinctValueEntry[], labels: ReadonlySet<string>) => Set<CellValue>;
|
|
2914
|
-
//#endregion
|
|
2915
|
-
//#region src/state-reducer.d.ts
|
|
2916
|
-
/**
|
|
2917
|
-
* Apply a single instruction to mutable slot/header Maps and return
|
|
2918
|
-
* other state changes as a partial object.
|
|
2919
|
-
*
|
|
2920
|
-
* Returns `null` when only the Maps were mutated (no primitive field changes).
|
|
2921
|
-
*/
|
|
2922
|
-
declare const applyInstruction: <TData = unknown>(instruction: GridInstruction, slots: Map<string, SlotData<TData>>, headers: Map<number, HeaderData>) => Partial<GridState<TData>> | null;
|
|
2923
|
-
//#endregion
|
|
2924
2068
|
//#region src/i18n.d.ts
|
|
2925
2069
|
/** Labels for the filter operator dropdowns, keyed by semantic meaning. */
|
|
2926
2070
|
interface GridFilterOperatorLabels {
|
|
@@ -3143,93 +2287,49 @@ interface TouchScrollDeps<TData = unknown> {
|
|
|
3143
2287
|
* touchmove and the end listeners are attached per-gesture, and only when
|
|
3144
2288
|
* scaling is active — small grids keep fully native, compositor-driven
|
|
3145
2289
|
* scrolling with zero added cost.
|
|
2290
|
+
*
|
|
2291
|
+
* Collaborators: `TouchPolicy` owns the element's touch-action policy,
|
|
2292
|
+
* `SyntheticScroll` bridges the fractional position to the core, and
|
|
2293
|
+
* `FlingAnimator` runs the release momentum.
|
|
3146
2294
|
*/
|
|
3147
2295
|
declare class TouchScrollController<TData = unknown> {
|
|
3148
2296
|
private readonly deps;
|
|
2297
|
+
private readonly scroll;
|
|
2298
|
+
private readonly fling;
|
|
3149
2299
|
private attachedEl;
|
|
2300
|
+
private policy;
|
|
3150
2301
|
private gesture;
|
|
3151
2302
|
private gestureCleanup;
|
|
3152
|
-
private flingFrame;
|
|
3153
|
-
private flingVelocity;
|
|
3154
2303
|
private dragFrame;
|
|
3155
2304
|
private pendingDragTarget;
|
|
3156
|
-
private savedOverscrollBehavior;
|
|
3157
|
-
private savedTouchAction;
|
|
3158
|
-
private overrideActive;
|
|
3159
|
-
/** Core whose batch instructions currently drive eager policy syncs */
|
|
3160
|
-
private subscribedCore;
|
|
3161
|
-
private contentSizeUnsubscribe;
|
|
3162
|
-
/** Timestamp of the last slot/render pipeline run (drag or fling) */
|
|
3163
|
-
private lastPipelineRunMs;
|
|
3164
|
-
/** Smoothed interval between pipeline runs — the device's render pace */
|
|
3165
|
-
private pipelineIntervalEmaMs;
|
|
3166
|
-
/** Smoothed rAF frame interval measured while a fling ticks */
|
|
3167
|
-
private frameIntervalEmaMs;
|
|
3168
|
-
/** Latched when measured frames prove per-frame rendering unsustainable */
|
|
3169
|
-
private flingThrottled;
|
|
3170
2305
|
constructor(deps: TouchScrollDeps<TData>);
|
|
3171
2306
|
attach(): void;
|
|
3172
2307
|
detach(): void;
|
|
3173
2308
|
/** Rebind policy updates after the host replaces its GridCore instance. */
|
|
3174
2309
|
syncCore(): void;
|
|
3175
|
-
/**
|
|
3176
|
-
* Keep the eager policy sync subscribed to the current core. Browsers —
|
|
3177
|
-
* iOS Safari especially — sample `touch-action` at gesture start, so a
|
|
3178
|
-
* policy applied inside touchstart only takes effect from the NEXT
|
|
3179
|
-
* gesture. Subscribing to the core's content-size instructions applies
|
|
3180
|
-
* the policy the moment scaling flips, before any finger goes down.
|
|
3181
|
-
* Re-invoked through syncCore when the wrapper rebuilds the core, and from
|
|
3182
|
-
* the permanent listeners as a fallback.
|
|
3183
|
-
*/
|
|
3184
|
-
private syncPolicySubscription;
|
|
3185
|
-
/**
|
|
3186
|
-
* While scroll scaling is active, panning must never be native: declare
|
|
3187
|
-
* `touch-action: none` so the browser cannot start a (ratio-amplified)
|
|
3188
|
-
* native scroll at all, and contain overscroll so synthetic flings do not
|
|
3189
|
-
* chain to the page. Non-scaled grids keep their original native policy.
|
|
3190
|
-
*/
|
|
3191
|
-
private syncTouchPolicy;
|
|
3192
2310
|
/** Cancel an in-flight fling (call before programmatic scrollTop writes). */
|
|
3193
2311
|
stop(): void;
|
|
3194
|
-
|
|
3195
|
-
* Drive the grid from the synthetic (fractional) scroll position. The DOM
|
|
3196
|
-
* scrollTop write is quantized by the browser and only keeps the scrollbar
|
|
3197
|
-
* in sync; the override + direct setViewport carry the sub-pixel position,
|
|
3198
|
-
* so rows glide instead of stepping one DOM-pixel's worth of rows at a
|
|
3199
|
-
* time under high compression.
|
|
3200
|
-
*/
|
|
3201
|
-
private applySyntheticScrollTop;
|
|
3202
|
-
/**
|
|
3203
|
-
* Decide whether a fast fling must fall back to throttled rendering.
|
|
3204
|
-
* The default is a full pipeline run every frame — a reduced cadence at
|
|
3205
|
-
* low speed reads as rows locking and snapping. Only when the measured
|
|
3206
|
-
* frame pace shows the device cannot sustain per-frame renders does the
|
|
3207
|
-
* fling latch onto the throttled cadence, and it stays latched until the
|
|
3208
|
-
* fling slows below the row-flux threshold so the cadence never
|
|
3209
|
-
* oscillates.
|
|
3210
|
-
*/
|
|
3211
|
-
private updateFlingThrottle;
|
|
3212
|
-
private isFlingPipelineDue;
|
|
3213
|
-
/** Hand scroll-position ownership back to native scroll events. */
|
|
3214
|
-
private releaseScrollOverride;
|
|
2312
|
+
private resolveContext;
|
|
3215
2313
|
private readonly onWheel;
|
|
3216
2314
|
private readonly onTouchStart;
|
|
3217
|
-
private
|
|
2315
|
+
private startTouchGesture;
|
|
3218
2316
|
private attachGestureListeners;
|
|
3219
2317
|
private clearGesture;
|
|
3220
|
-
|
|
2318
|
+
/** Drop the gesture and hand scrolling back to the browser. */
|
|
2319
|
+
private abandonGesture;
|
|
2320
|
+
private trackedTouch;
|
|
3221
2321
|
private readonly onTouchMove;
|
|
3222
|
-
/**
|
|
3223
|
-
* True when the scroll position no longer matches what this controller
|
|
3224
|
-
* wrote: a native scroller is moving the element between our frames. Our
|
|
3225
|
-
* own writes only diverge by browser rounding, well under the threshold.
|
|
3226
|
-
*/
|
|
3227
|
-
private hasNativeScrollTakenOver;
|
|
3228
2322
|
private scheduleDragApply;
|
|
3229
2323
|
private flushPendingDrag;
|
|
2324
|
+
/**
|
|
2325
|
+
* Render a drag position. While the finger is down the workload is
|
|
2326
|
+
* self-limiting (content moves at most one screen per gesture), so every
|
|
2327
|
+
* coalesced frame runs the full pipeline — throttling under the finger
|
|
2328
|
+
* reads as jank, not speed.
|
|
2329
|
+
*/
|
|
2330
|
+
private applyDragTarget;
|
|
3230
2331
|
private readonly onTouchEnd;
|
|
3231
2332
|
private readonly onTouchCancel;
|
|
3232
|
-
private startFling;
|
|
3233
2333
|
}
|
|
3234
2334
|
//#endregion
|
|
3235
2335
|
//#region src/adapter/batch-applier.d.ts
|
|
@@ -3370,4 +2470,4 @@ declare class InputEventAdapter<TData = unknown> {
|
|
|
3370
2470
|
private dispatchCellDragStart;
|
|
3371
2471
|
}
|
|
3372
2472
|
//#endregion
|
|
3373
|
-
export { type AssignSlotInstruction, AutoScrollDriver, type BatchChangeSetters, type BatchInstructionListener, type CalculateFillHandlePositionParams, type
|
|
2473
|
+
export { type AssignSlotInstruction, AutoScrollDriver, type BatchChangeSetters, type BatchInstructionListener, type CalculateFillHandlePositionParams, type CancelFillInstruction, 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 CommitEditInstruction, type CommitFillInstruction, 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 DistinctValueEntry, type DragEndResult, type DragMoveResult, type DragState, type EditRendererParams, type EditState, type FillHandlePosition, type FillHandleState, type FillPointerAction, type FilterCombination, type FilterCondition, type FilterModel, type FilterOperatorOption, type FilterPopupState, GridCore, type GridCoreOptions, type GridFilterOperatorLabels, type GridInstruction, type GridLabels, type GridState, type HeaderData, type HeaderRendererParams, type HighlightContext, type HighlightingOptions, IndexedDataStore, type IndexedDataStoreOptions, type InitialStateArgs, InputEventAdapter, type InputEventAdapterDeps, InputHandler, type InputHandlerDeps, type InputResult, type InstructionListener, type KeyEventData, type KeyboardResult, type MoveSlotInstruction, type MutableClientDataSourceOptions, type MutableDataSource, type NumberFilterCondition, type NumberFilterOperator, type OpenFilterPopupInstruction, type ParallelSortOptions, PendingCellTapController, type PendingCellTapDeps, PendingRowDragController, type PendingRowDragDeps, type PointerEventData, type PopupPosition, ROW_DRAG_HOLD_MS, type RowCacheEviction, type RowCacheOptions, type RowDragState, type RowId, type RowLoadingMode, type RowLoadingOptions, type SelectionState, type ServerDataSourceOptions, type SetActiveCellInstruction, type SetContentSizeInstruction, type SetHoverPositionInstruction, type SetSelectionRangeInstruction, type SlotData, type SlotState, type SortDirection, type SortModel, type StartEditInstruction, type StartFillInstruction, type StartPeekInstruction, type StopEditInstruction, type StopPeekInstruction, TAP_SLOP_PX, type TextFilterCondition, type TextFilterOperator, TouchScrollController, type TouchScrollDeps, type Transaction, TransactionManager, type TransactionManagerOptions, type TransactionResult, type UpdateFillInstruction, type UpdateHeaderInstruction, type VisibleColumnInfo, applyBatchInstructions, applyInstruction, bindPeekSelectAll, buildCellClasses, calculateColumnPositions, calculateFillHandlePosition, calculateFilterPopupPosition, calculateScaledColumnPositions, createClientDataSource, createDataSourceFromArray, createInitialState, createMutableClientDataSource, createServerDataSource, defaultGridLabels, evaluateColumnFilter, evaluateDateCondition, evaluateNumberCondition, evaluateTextCondition, findColumnAtX, formatCellValue, formatLabel, getDateOperatorOptions, getFieldValue, getNumberOperatorOptions, getTextOperatorOptions, getTotalWidth, groupDistinctValues, isBlankCellValue, isCellActive, isCellEditing, isCellInFillPreview, isCellSelected, isRowVisible, isSameDay, labelsForSelectedValues, rawValueKey, rawValuesForLabels, resolveGridLabels, rowPassesFilter, scrollCellIntoView, setFieldValue, toPointerEventData };
|