@gridengine/angular-datagrid-enterprise 0.2.0 → 0.4.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.
|
@@ -276,5 +276,227 @@ declare class UndoRedoManager {
|
|
|
276
276
|
private _notifyChange;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
|
|
280
|
-
|
|
279
|
+
/**
|
|
280
|
+
* FormulaEngine — evaluates Excel-like formula strings against row data.
|
|
281
|
+
* Formulas start with '=' and reference other columns by field name.
|
|
282
|
+
*
|
|
283
|
+
* Functions: SUM, AVG, MIN, MAX, COUNT, IF, CONCAT, ROUND, ABS, FLOOR, CEIL,
|
|
284
|
+
* LEN, UPPER, LOWER. Bare identifiers that aren't function names are treated as
|
|
285
|
+
* field lookups on the current row.
|
|
286
|
+
*
|
|
287
|
+
* Error values: '#ERROR!', '#DIV/0!', '#REF!', '#CIRCULAR!', '#NAME?'.
|
|
288
|
+
* A formula that directly/transitively references its own cell yields
|
|
289
|
+
* '#CIRCULAR!'.
|
|
290
|
+
*/
|
|
291
|
+
type Row = Record<string, unknown>;
|
|
292
|
+
interface FormulaEngineOptions {
|
|
293
|
+
/**
|
|
294
|
+
* Fields that contain formula definitions. Key = field name, value = formula
|
|
295
|
+
* string (e.g. '=SUM(price, tax)'). The row's field value is replaced by the
|
|
296
|
+
* evaluation result.
|
|
297
|
+
*/
|
|
298
|
+
formulaFields: Record<string, string>;
|
|
299
|
+
}
|
|
300
|
+
declare class FormulaEngine {
|
|
301
|
+
private readonly _formulaFields;
|
|
302
|
+
constructor(options: FormulaEngineOptions);
|
|
303
|
+
/** Evaluate all formula fields for a row, returning a new (unmutated) row. */
|
|
304
|
+
evaluateRow(row: Row): Row;
|
|
305
|
+
/** Evaluate a single formula string against a row. */
|
|
306
|
+
evaluateFormula(formula: string, row: Row, selfField?: string): unknown;
|
|
307
|
+
/** Whether a formula string is parseable (no evaluation). */
|
|
308
|
+
isValidFormula(formula: string): boolean;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** A grid row — an arbitrary keyed record. Alias used across the Pro engines. */
|
|
312
|
+
type GridRow = Record<string, unknown>;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* SSRMEngine — Server-Side Row Model: a block-based LRU cache for server-driven
|
|
316
|
+
* datasets of arbitrary size. Pure logic; the caller supplies a datasource with
|
|
317
|
+
* a single async `getRows()` method. Filter/sort/group models are forwarded to
|
|
318
|
+
* the server. Failed fetches retry up to 3 times with exponential backoff.
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
interface SSRMGetRowsParams {
|
|
322
|
+
startRow: number;
|
|
323
|
+
endRow: number;
|
|
324
|
+
filterModel: Record<string, unknown>;
|
|
325
|
+
sortModel: {
|
|
326
|
+
field: string;
|
|
327
|
+
direction: 'asc' | 'desc';
|
|
328
|
+
}[];
|
|
329
|
+
groupKeys: string[];
|
|
330
|
+
}
|
|
331
|
+
interface SSRMGetRowsResult {
|
|
332
|
+
rows: GridRow[];
|
|
333
|
+
totalCount: number;
|
|
334
|
+
}
|
|
335
|
+
interface SSRMDataSource {
|
|
336
|
+
getRows(params: SSRMGetRowsParams): Promise<SSRMGetRowsResult>;
|
|
337
|
+
}
|
|
338
|
+
type BlockState = 'idle' | 'loading' | 'loaded' | 'error';
|
|
339
|
+
interface Block {
|
|
340
|
+
/** Zero-based block index (index * blockSize = startRow). */
|
|
341
|
+
index: number;
|
|
342
|
+
state: BlockState;
|
|
343
|
+
rows: GridRow[];
|
|
344
|
+
error?: Error;
|
|
345
|
+
/** Monotonically increasing access counter — higher = more recently used. */
|
|
346
|
+
lastAccessed: number;
|
|
347
|
+
}
|
|
348
|
+
interface SSRMEngineOptions {
|
|
349
|
+
dataSource: SSRMDataSource;
|
|
350
|
+
/** Rows per block. Default: 100 */
|
|
351
|
+
blockSize?: number;
|
|
352
|
+
/** Maximum blocks to keep in memory (LRU eviction). Default: 10 */
|
|
353
|
+
maxBlocksInCache?: number;
|
|
354
|
+
}
|
|
355
|
+
declare class SSRMEngine {
|
|
356
|
+
private readonly _dataSource;
|
|
357
|
+
readonly blockSize: number;
|
|
358
|
+
readonly maxBlocksInCache: number;
|
|
359
|
+
private readonly _blocks;
|
|
360
|
+
private _accessClock;
|
|
361
|
+
private _totalCount;
|
|
362
|
+
private _filterModel;
|
|
363
|
+
private _sortModel;
|
|
364
|
+
private _groupKeys;
|
|
365
|
+
private _onChange?;
|
|
366
|
+
constructor(options: SSRMEngineOptions);
|
|
367
|
+
subscribe(listener: () => void): () => void;
|
|
368
|
+
setFilterModel(model: Record<string, unknown>): void;
|
|
369
|
+
setSortModel(model: {
|
|
370
|
+
field: string;
|
|
371
|
+
direction: 'asc' | 'desc';
|
|
372
|
+
}[]): void;
|
|
373
|
+
setGroupKeys(keys: string[]): void;
|
|
374
|
+
/** Total row count from the last server response (null = not yet known). */
|
|
375
|
+
getTotalCount(): number | null;
|
|
376
|
+
/**
|
|
377
|
+
* Get the row at an absolute zero-based index, fetching the containing block
|
|
378
|
+
* if needed. Returns null while the block is loading.
|
|
379
|
+
*/
|
|
380
|
+
getRow(rowIndex: number): GridRow | null;
|
|
381
|
+
/** Rows for the viewport [startRow, endRow); missing slots are null. */
|
|
382
|
+
getRowSlice(startRow: number, endRow: number): (GridRow | null)[];
|
|
383
|
+
getBlockState(blockIndex: number): BlockState;
|
|
384
|
+
getBlocks(): ReadonlyMap<number, Block>;
|
|
385
|
+
/** Evict all cached blocks and reset total count. */
|
|
386
|
+
invalidateAll(): void;
|
|
387
|
+
/** Evict a specific block (e.g. after a row mutation on that page). */
|
|
388
|
+
invalidateBlock(blockIndex: number): void;
|
|
389
|
+
private _getOrCreateBlock;
|
|
390
|
+
private _fetchBlock;
|
|
391
|
+
private _evictOldest;
|
|
392
|
+
private _invalidateAll;
|
|
393
|
+
private _notify;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* TransactionEngine — stages add / update / remove operations against a row set
|
|
398
|
+
* without mutating the original array. Changes are held until commit (fires
|
|
399
|
+
* `onTransactionCommit` with the delta) or rollback (discards them). Row
|
|
400
|
+
* identity comes from `rowIdField` (default 'id').
|
|
401
|
+
*/
|
|
402
|
+
|
|
403
|
+
interface TransactionDelta {
|
|
404
|
+
added: GridRow[];
|
|
405
|
+
updated: GridRow[];
|
|
406
|
+
removedIds: (string | number)[];
|
|
407
|
+
}
|
|
408
|
+
interface TransactionEngineOptions {
|
|
409
|
+
/** Initial rows loaded from the grid. */
|
|
410
|
+
initialRows: GridRow[];
|
|
411
|
+
/** Field used as the unique row ID. Default: 'id' */
|
|
412
|
+
rowIdField?: string;
|
|
413
|
+
onTransactionCommit?: (delta: TransactionDelta) => void;
|
|
414
|
+
onTransactionRollback?: () => void;
|
|
415
|
+
}
|
|
416
|
+
declare class TransactionEngine {
|
|
417
|
+
private readonly _rowIdField;
|
|
418
|
+
private readonly _onCommit?;
|
|
419
|
+
private readonly _onRollback?;
|
|
420
|
+
private _baseRows;
|
|
421
|
+
private readonly _dirty;
|
|
422
|
+
constructor(opts: TransactionEngineOptions);
|
|
423
|
+
/** Stage new rows; an existing ID is treated as an update instead. */
|
|
424
|
+
addRows(rows: GridRow[]): void;
|
|
425
|
+
/** Stage updates for existing rows; unknown IDs are ignored with a warning. */
|
|
426
|
+
updateRows(rows: GridRow[]): void;
|
|
427
|
+
/** Stage rows for removal by ID; a still-staged add is simply cancelled. */
|
|
428
|
+
removeRows(ids: (string | number)[]): void;
|
|
429
|
+
commitTransaction(): void;
|
|
430
|
+
rollbackTransaction(): void;
|
|
431
|
+
/** True if there are any staged (uncommitted) changes. */
|
|
432
|
+
isDirty(): boolean;
|
|
433
|
+
/** All current staged changes, grouped by kind. */
|
|
434
|
+
getDirtyRows(): {
|
|
435
|
+
added: GridRow[];
|
|
436
|
+
updated: GridRow[];
|
|
437
|
+
removed: GridRow[];
|
|
438
|
+
};
|
|
439
|
+
/** The merged row list: base rows with staged changes applied. */
|
|
440
|
+
getDisplayRows(): GridRow[];
|
|
441
|
+
/** Replace the base rows (e.g. after a refresh); staged changes are kept. */
|
|
442
|
+
resetRows(rows: GridRow[]): void;
|
|
443
|
+
private _rowId;
|
|
444
|
+
private _findBase;
|
|
445
|
+
private _stageUpdate;
|
|
446
|
+
private _buildDelta;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* MasterDetailEngine — manages expand/collapse state and lazy-loaded, cached
|
|
451
|
+
* detail data for master rows. Pure logic. Detail data is fetched once per row
|
|
452
|
+
* ID on first expand; subsequent expands reuse the cache.
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
type DetailLoadState = 'idle' | 'loading' | 'loaded' | 'error';
|
|
456
|
+
interface DetailEntry {
|
|
457
|
+
state: DetailLoadState;
|
|
458
|
+
data: GridRow[];
|
|
459
|
+
error?: Error;
|
|
460
|
+
}
|
|
461
|
+
interface MasterDetailEngineOptions {
|
|
462
|
+
/** Loads detail rows for a master row; called at most once per row ID. */
|
|
463
|
+
getDetailRowData: (masterRow: GridRow) => Promise<GridRow[]>;
|
|
464
|
+
/** Called when a row's expanded state changes. */
|
|
465
|
+
onExpand?: (masterRow: GridRow, expanded: boolean) => void;
|
|
466
|
+
/** Field used as the row ID. Default: 'id' */
|
|
467
|
+
rowIdField?: string;
|
|
468
|
+
}
|
|
469
|
+
declare class MasterDetailEngine {
|
|
470
|
+
private readonly _getDetailRowData;
|
|
471
|
+
private readonly _onExpand?;
|
|
472
|
+
private readonly _rowIdField;
|
|
473
|
+
private readonly _expanded;
|
|
474
|
+
private readonly _cache;
|
|
475
|
+
private _onChange?;
|
|
476
|
+
constructor(options: MasterDetailEngineOptions);
|
|
477
|
+
/** Subscribe to state changes. Returns an unsubscribe function. */
|
|
478
|
+
subscribe(listener: () => void): () => void;
|
|
479
|
+
isExpanded(rowId: string | number): boolean;
|
|
480
|
+
getLoadState(rowId: string | number): DetailLoadState;
|
|
481
|
+
/** Cached detail rows, or an empty array if not yet loaded. */
|
|
482
|
+
getDetailData(rowId: string | number): GridRow[];
|
|
483
|
+
/** Expand a master row, triggering a load if not already cached. */
|
|
484
|
+
expand(masterRow: GridRow): void;
|
|
485
|
+
/** Collapse a master row; cached data is retained for re-expansion. */
|
|
486
|
+
collapse(masterRow: GridRow): void;
|
|
487
|
+
toggle(masterRow: GridRow): void;
|
|
488
|
+
/** Pre-fetch detail data without expanding (e.g. hover prefetch). */
|
|
489
|
+
prefetch(masterRow: GridRow): void;
|
|
490
|
+
/** Invalidate one row's cache, or the entire cache when rowId is omitted. */
|
|
491
|
+
invalidateCache(rowId?: string | number): void;
|
|
492
|
+
/** Collapse all expanded rows. Cache is preserved. */
|
|
493
|
+
collapseAll(): void;
|
|
494
|
+
/** A read-only snapshot of currently expanded row IDs. */
|
|
495
|
+
getExpandedIds(): ReadonlySet<string | number>;
|
|
496
|
+
private _rowId;
|
|
497
|
+
private _ensureLoaded;
|
|
498
|
+
private _notify;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export { ClipboardEngine, DataGridPro, FillHandleEngine, FormulaEngine, GridLicenseWatermark, LicenseManager, MasterDetailEngine, PRODUCT_ID, PURCHASE_URL, RangeSelectionEngine, SSRMEngine, TransactionEngine, UndoRedoManager, parseTSV, provideGridEngineLicense, toNumber, toTimestamp };
|
|
502
|
+
export type { Block, BlockState, CellEditCommand, CellRange, ClipboardEngineOptions, DeleteCommand, DetailEntry, DetailLoadState, FillCell, FillCommand, FillDirection, FillHandleEngineOptions, FillResult, FormulaEngineOptions, GridRow, MasterDetailEngineOptions, PasteCommand, RangeSelectionEngineOptions, SSRMDataSource, SSRMEngineOptions, SSRMGetRowsParams, SSRMGetRowsResult, TransactionDelta, TransactionEngineOptions, UndoRedoCommand, UndoRedoManagerOptions };
|