@adaptabletools/adaptable 24.0.3 → 24.0.4

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.
Files changed (28) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +7 -0
  3. package/src/Api/AdaptableApi.d.ts +12 -0
  4. package/src/Api/GridApi.d.ts +13 -3
  5. package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -0
  6. package/src/Api/Implementation/AdaptableApiImpl.js +3 -0
  7. package/src/Api/Implementation/FlashingCellApiImpl.js +3 -8
  8. package/src/Api/Implementation/GridApiImpl.js +1 -1
  9. package/src/Api/Internal/AlertInternalApi.d.ts +7 -0
  10. package/src/Api/Internal/AlertInternalApi.js +42 -9
  11. package/src/Strategy/FlashingCellModule.js +2 -1
  12. package/src/Utilities/Helpers/CellValueHelper.d.ts +20 -0
  13. package/src/Utilities/Helpers/CellValueHelper.js +35 -0
  14. package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +25 -1
  15. package/src/Utilities/Services/CalculatedColumnExpressionService.js +160 -42
  16. package/src/Utilities/Services/DataService.js +10 -6
  17. package/src/Utilities/Services/FlashingCellService.d.ts +12 -0
  18. package/src/Utilities/Services/FlashingCellService.js +40 -3
  19. package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +5 -0
  20. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +5 -0
  21. package/src/Utilities/Services/QueryLanguageService.d.ts +6 -0
  22. package/src/Utilities/Services/QueryLanguageService.js +29 -1
  23. package/src/agGrid/AdaptableAgGrid.d.ts +80 -14
  24. package/src/agGrid/AdaptableAgGrid.js +468 -125
  25. package/src/agGrid/AgGridAdapter.d.ts +10 -1
  26. package/src/agGrid/AgGridAdapter.js +16 -0
  27. package/src/env.js +2 -2
  28. package/tsconfig.esm.tsbuildinfo +1 -1
@@ -1,5 +1,5 @@
1
1
  import { AdaptableOptions } from '../AdaptableOptions/AdaptableOptions';
2
- import { ChartRef, Column, GridApi, GridOptions, IRowNode, Module, RowModelType, StatusPanelDef } from 'ag-grid-enterprise';
2
+ import { CellValueChangedEvent, ChartRef, Column, GridApi, GridOptions, IRowNode, Module, RowModelType, StatusPanelDef } from 'ag-grid-enterprise';
3
3
  import { AdaptableLogger } from './AdaptableLogger';
4
4
  import { AdaptableApi, DestroyConfig } from '../Api/AdaptableApi';
5
5
  import { AdaptableVariant, GridRefreshScope, IAdaptable, NormalizeAdaptableStateOptions } from '../AdaptableInterfaces/IAdaptable';
@@ -97,11 +97,38 @@ export declare class AdaptableAgGrid implements IAdaptable {
97
97
  private ChartingService;
98
98
  private isListeningToAgGridRowNodeEvents;
99
99
  /**
100
- * Nested / overlapping `applyTransaction` updates. Rendered rows report
101
- * `dataChanged` via the monkey-patch; off-screen rows do not, and are
102
- * synthesized from the pre-transaction snapshot after the call returns.
100
+ * Row node -> the data object last reported for it, for the rows of Adaptable API transactions.
101
+ * Rendered rows report `dataChanged` via the monkey-patch; rows that are not rendered do not, and
102
+ * are diffed against the stored object after the transaction (see `reportTrackedRowUpdates`).
103
+ * Cleared when no transaction is in progress or pending.
103
104
  */
104
- private offScreenRowUpdateTrackers;
105
+ private trackedRowData;
106
+ /** rows of async Adaptable API transactions whose callback has not run yet, with a count per row */
107
+ private pendingAsyncRowNodes;
108
+ private pendingAsyncTransactions;
109
+ private syncTransactionDepth;
110
+ /** a rendered row of an async flush asked for a re-filter; done once, in the callback */
111
+ private refilterAfterAsyncFlush;
112
+ /**
113
+ * Cell changes already reported, per row node and column id, with how many times: the async
114
+ * `cellValueChanged` AG Grid fires for the same edits skips them (see `onAgGridCellValueChanged`).
115
+ */
116
+ private reportedCellChanges;
117
+ private isReportedCellChangesClearScheduled;
118
+ /**
119
+ * While `updateCell` runs: the `cellValueChanged` events AG Grid dispatched, and the cells a
120
+ * row-node `cellChanged` event reported
121
+ */
122
+ private updateCellCapture;
123
+ private postEditBatch;
124
+ /** refreshes of pinned copies that wait for AG Grid to give the copy the new row data */
125
+ private pendingPinnedCopyRefreshes;
126
+ private dataBackedColumnsCache;
127
+ /** `getRowId` was installed by AdapTable, so a row id is the primary key value */
128
+ private isRowIdPrimaryKey;
129
+ private primaryKeyLookup;
130
+ private hasLoggedPrimaryKeyLookupFallback;
131
+ private hasWarnedSameObjectUpdate;
105
132
  private debouncedSetSelectedRows;
106
133
  private debouncedSetSelectedCells;
107
134
  private agGridListenerKeydown;
@@ -233,14 +260,22 @@ export declare class AdaptableAgGrid implements IAdaptable {
233
260
  */
234
261
  onAgGridRowNodeEvent(event: RowNodeEvent): void;
235
262
  /**
236
- * Off-screen complement to row-node `cellChanged`. AG Grid fires this from
237
- * `ValueService.setValue` for every row; the row-node event only exists
238
- * when the node has a `LocalEventService` (rendered rows). Handling both
239
- * on a rendered row applies the delta twice, so rendered rows stay on
240
- * `cellChanged` (correct values for valueGetters / prevent-edit).
263
+ * Complement to row-node `cellChanged`. AG Grid fires this, after the edit, from
264
+ * `ValueService.setValue` for every row; the row-node event only exists when the node had a
265
+ * `LocalEventService` (a rendered row) at the time of the edit. The changes already reported
266
+ * (from a row-node event, or by `updateCell`) are skipped, so each edit is reported once even if
267
+ * the row has been rendered or removed from the DOM since.
241
268
  */
242
269
  private onAgGridCellValueChanged;
243
- private noteRowNodeDataChanged;
270
+ /**
271
+ * see #local_event_service_monkey_patch (AgGridAdapter.ts)
272
+ *
273
+ * AG Grid's `cellValueChanged`, received while AG Grid dispatches it. Only recorded while
274
+ * `updateCell` runs, which reports the edits once `setDataValue` has returned.
275
+ */
276
+ onAgGridCellValueChangedDispatch(event: CellValueChangedEvent): void;
277
+ private noteCellChangeReported;
278
+ private takeCellChangeReported;
244
279
  private shouldAutoSizeLayout;
245
280
  private autoSizeLayoutIfNeeded;
246
281
  forPlugins(callback: (plugin: AdaptablePlugin) => any): void;
@@ -367,10 +402,14 @@ export declare class AdaptableAgGrid implements IAdaptable {
367
402
  *
368
403
  * CSRM `applyTransaction({ update })` does not emit per-cell `cellValueChanged`.
369
404
  * Rendered rows still fire row-node `dataChanged`; off-screen rows do not.
405
+ * Stores the data each updated row has before the transaction, unless a pending transaction
406
+ * already did; returns the rows found.
370
407
  */
371
- private beginOffScreenRowUpdateTracking;
372
- private endOffScreenRowUpdateTracking;
373
- private emitOffScreenRowUpdates;
408
+ private trackRowUpdates;
409
+ /** Reports each updated row whose data is not the data last reported for it */
410
+ private reportTrackedRowUpdates;
411
+ private releaseTrackedRows;
412
+ private warnSameObjectUpdate;
374
413
  updateRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<IRowNode[]>;
375
414
  addRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<IRowNode[]>;
376
415
  addOrUpdateRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<{
@@ -384,6 +423,15 @@ export declare class AdaptableAgGrid implements IAdaptable {
384
423
  }>;
385
424
  deleteRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<IRowNode[]>;
386
425
  getRowNodeForPrimaryKey(primaryKeyValue: any): any;
426
+ private readPrimaryKeyValue;
427
+ /**
428
+ * For rows whose id is not their primary key value (an application `getRowId`, tree data,
429
+ * the server-side row model): a map from primary key value to row node, built on a miss and
430
+ * rebuilt at most once per synchronous turn.
431
+ */
432
+ private getRowNodeFromPrimaryKeyLookup;
433
+ /** The lookup is not rebuilt in the turn that built it, so the rows a transaction adds go in too */
434
+ private addToPrimaryKeyLookup;
387
435
  hideColumn(columnId: string): void;
388
436
  showColumn(columnId: string): void;
389
437
  autoSizeColumn(columnId: string): void;
@@ -473,6 +521,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
473
521
  getChartRef(chartId: string): ChartRef;
474
522
  updateLayoutInManagerAfterStoreHasChanged(layout?: Layout): void;
475
523
  private getActiveAdaptableAggFuncForCol;
524
+ private getDataBackedColumns;
476
525
  private onRowDataChanged;
477
526
  private onCellDataChanged;
478
527
  private isUndoChange;
@@ -481,6 +530,19 @@ export declare class AdaptableAgGrid implements IAdaptable {
481
530
  */
482
531
  private performPostEditChecks;
483
532
  private performPostEditChecksNow;
533
+ /**
534
+ * Runs `fn` with a post-edit batch open: the changes reported while it runs are re-filtered,
535
+ * refreshed column-wide and checked against the selection once, when `fn` returns, instead of
536
+ * once per row or cell. A nested call joins the open batch.
537
+ */
538
+ runPostEditBatch<T>(fn: () => T): T;
539
+ private flushPostEditBatch;
540
+ private recordChangedCellForSelection;
541
+ /**
542
+ * Whether the row is rendered. Inside a post-edit batch the rendered rows are read once per
543
+ * batch. A pinned row is always rendered.
544
+ */
545
+ isRowNodeRendered(rowNode: IRowNode): boolean;
484
546
  /**
485
547
  * Collect format / freetext / styled / observable / relative-styled columns
486
548
  * into one scope. Edited-row-only ids stay in `columnIds`; `ALL_ROWS()`
@@ -492,6 +554,10 @@ export declare class AdaptableAgGrid implements IAdaptable {
492
554
  * AdapTable flashing is driven by `CellDataChanged`, not AG Grid cell flash.
493
555
  */
494
556
  private applyPostEditRefresh;
557
+ private applyPendingPinnedCopyRefresh;
558
+ private refreshRenderedRows;
559
+ /** The row and its pinned copy, those of them that are rendered */
560
+ private getRenderedCopiesOfRow;
495
561
  private checkStyledColumnComparisonChanges;
496
562
  private checkFormatColumnPredicateStyleChanges;
497
563
  private checkFreeTextColumnChanges;