@adaptabletools/adaptable 24.0.2 → 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.
- package/devtools.d.ts +506 -5
- package/devtools.js +11 -1
- package/index.css +15 -5
- package/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +13 -1
- package/src/AdaptableOptions/DataImportOptions.d.ts +1 -1
- package/src/AdaptableOptions/ExportOptions.d.ts +2 -2
- package/src/AdaptableState/Common/AdaptableFormat.d.ts +2 -10
- package/src/AdaptableState/Common/RowSummary.d.ts +2 -0
- package/src/AdaptableState/LayoutState.d.ts +1 -1
- package/src/Api/AdaptableApi.d.ts +12 -0
- package/src/Api/GridApi.d.ts +13 -3
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -0
- package/src/Api/Implementation/AdaptableApiImpl.js +3 -0
- package/src/Api/Implementation/AlertApiImpl.js +2 -0
- package/src/Api/Implementation/FlashingCellApiImpl.js +3 -8
- package/src/Api/Implementation/GridApiImpl.js +1 -1
- package/src/Api/Internal/AlertInternalApi.d.ts +7 -0
- package/src/Api/Internal/AlertInternalApi.js +42 -9
- package/src/Api/Internal/CalculatedColumnInternalApi.js +25 -3
- package/src/Api/Internal/ExportInternalApi.d.ts +2 -0
- package/src/Api/Internal/ExportInternalApi.js +39 -3
- package/src/Api/Internal/LayoutInternalApi.d.ts +11 -1
- package/src/Api/Internal/LayoutInternalApi.js +34 -3
- package/src/Api/Internal/NoteInternalApi.d.ts +12 -0
- package/src/Api/Internal/NoteInternalApi.js +11 -0
- package/src/EnvVars.d.ts +1 -0
- package/src/EnvVars.js +1 -0
- package/src/Redux/Store/AdaptableStore.js +4 -7
- package/src/Strategy/FlashingCellModule.js +4 -1
- package/src/Utilities/Helpers/CellValueHelper.d.ts +20 -0
- package/src/Utilities/Helpers/CellValueHelper.js +35 -0
- package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +26 -1
- package/src/Utilities/Services/CalculatedColumnExpressionService.js +175 -42
- package/src/Utilities/Services/DataService.js +10 -6
- package/src/Utilities/Services/FlashingCellService.d.ts +12 -0
- package/src/Utilities/Services/FlashingCellService.js +40 -3
- package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +12 -0
- package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +22 -1
- package/src/Utilities/Services/QueryLanguageService.d.ts +17 -1
- package/src/Utilities/Services/QueryLanguageService.js +75 -2
- package/src/Utilities/Services/RowSummaryService.d.ts +2 -0
- package/src/Utilities/Services/RowSummaryService.js +6 -1
- package/src/Utilities/license/instanceLicense.d.ts +12 -0
- package/src/Utilities/license/instanceLicense.js +10 -0
- package/src/Utilities/license/licenseStatus.d.ts +26 -0
- package/src/Utilities/license/licenseStatus.js +72 -0
- package/src/View/Components/CellPopup/index.js +15 -10
- package/src/View/GridInfo/GridInfoPopup.js +6 -1
- package/src/View/Layout/TransposedPopup.js +1 -0
- package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +3 -5
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +10 -24
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +5 -1
- package/src/View/ObjectItemViews/Layout/aggregationSummaryHelpers.d.ts +5 -1
- package/src/View/ObjectItemViews/Layout/aggregationSummaryHelpers.js +6 -3
- package/src/agGrid/AdaptableAgGrid.d.ts +87 -17
- package/src/agGrid/AdaptableAgGrid.js +586 -168
- package/src/agGrid/AdaptableFilterHandler.d.ts +2 -0
- package/src/agGrid/AdaptableFilterHandler.js +34 -0
- package/src/agGrid/AgGridAdapter.d.ts +19 -1
- package/src/agGrid/AgGridAdapter.js +39 -12
- package/src/agGrid/AgGridColumnAdapter.d.ts +2 -0
- package/src/agGrid/AgGridColumnAdapter.js +124 -78
- package/src/agGrid/AgGridExportAdapter.d.ts +5 -0
- package/src/agGrid/AgGridExportAdapter.js +31 -0
- package/src/agGrid/AgGridMenuAdapter.js +1 -1
- package/src/agGrid/applyGlobalGridOptions.d.ts +9 -0
- package/src/agGrid/applyGlobalGridOptions.js +36 -0
- package/src/agGrid/cellRenderers/BadgeRenderer.js +22 -0
- package/src/agGrid/columnMinMaxCache.d.ts +33 -0
- package/src/agGrid/columnMinMaxCache.js +50 -0
- package/src/devTools/PerfStore.d.ts +218 -0
- package/src/devTools/PerfStore.js +717 -0
- package/src/devTools/index.d.ts +33 -0
- package/src/devTools/index.js +132 -56
- package/src/devTools/logBuffer.d.ts +17 -0
- package/src/devTools/logBuffer.js +33 -0
- package/src/devTools/memoryInfo.d.ts +15 -0
- package/src/devTools/memoryInfo.js +229 -0
- package/src/devTools/memoryRoots.d.ts +41 -0
- package/src/devTools/memoryRoots.js +136 -0
- package/src/devTools/perfContext.d.ts +5 -0
- package/src/devTools/perfContext.js +155 -0
- package/src/devTools/perfInstrumentation.d.ts +13 -0
- package/src/devTools/perfInstrumentation.js +78 -0
- package/src/env.js +2 -2
- package/src/layout-manager/src/LayoutManagerModel.d.ts +3 -1
- package/src/layout-manager/src/expandAllRowGroups.d.ts +6 -0
- package/src/layout-manager/src/expandAllRowGroups.js +13 -0
- package/src/layout-manager/src/index.js +18 -10
- package/src/setupDevTools.js +560 -106
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/vendor/components/Combobox/index.js +1 -1
- package/vendor/components/Combobox/index.js.map +1 -1
- package/vendor/components/Radio/index.d.ts.map +1 -1
- package/vendor/components/Radio/index.js +1 -1
- package/vendor/components/Radio/index.js.map +1 -1
- package/vendor/components/Resizable/index.d.ts +14 -9
- package/vendor/components/Resizable/index.d.ts.map +1 -1
- package/vendor/components/Resizable/index.js +23 -0
- package/vendor/components/Resizable/index.js.map +1 -1
- package/vendor/components/Resizable/resizableUtils.d.ts +24 -13
- package/vendor/components/Resizable/resizableUtils.d.ts.map +1 -1
- package/vendor/components/Resizable/resizableUtils.js +13 -3
- package/vendor/components/Resizable/resizableUtils.js.map +1 -1
- package/vendor/components/index.css +12 -5
- package/vendor/components/ui/combobox.js +1 -1
- package/vendor/components/ui/combobox.js.map +1 -1
- package/vendor/components/ui/input.js +1 -1
- package/vendor/components/ui/input.js.map +1 -1
- package/vendor/components/ui/select.js +1 -1
- package/vendor/components/ui/select.js.map +1 -1
- package/vendor/components/ui/textarea.js +1 -1
- package/vendor/components/ui/textarea.js.map +1 -1
- package/vendor/components/ui/tooltip.d.ts.map +1 -1
- package/vendor/components/ui/tooltip.js +3 -1
- package/vendor/components/ui/tooltip.js.map +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { debounce } from '../Utilities/Helpers/TimingHelper';
|
|
2
2
|
import { createGrid, } from 'ag-grid-enterprise';
|
|
3
|
+
import { computeMinMax, updateColumnMinMaxCacheEntry, } from './columnMinMaxCache';
|
|
3
4
|
import { AdaptableLogger } from './AdaptableLogger';
|
|
5
|
+
import { applyGlobalGridOptions } from './applyGlobalGridOptions';
|
|
4
6
|
import { PrimaryKeyDocsLink } from '../Utilities/Constants/DocumentationLinkConstants';
|
|
5
7
|
import { describeGridRefreshScope, FULL_GRID_REFRESH_SCOPE, getMissingGridRefreshScope, mergeGridRefreshScopes, } from './gridRefreshScope';
|
|
6
8
|
import StringExtensions from '../Utilities/Extensions/StringExtensions';
|
|
@@ -25,6 +27,7 @@ import { ValidationService } from '../Utilities/Services/ValidationService';
|
|
|
25
27
|
import { ModuleService } from '../Utilities/Services/ModuleService';
|
|
26
28
|
import { CalculatedColumnExpressionService } from '../Utilities/Services/CalculatedColumnExpressionService';
|
|
27
29
|
import { expandCellDataChangedInfosWithCalculatedColumns } from '../Utilities/Services/CalculatedColumnExpressionService';
|
|
30
|
+
import { areCellValuesEqual, getDataBackedColumns, } from '../Utilities/Helpers/CellValueHelper';
|
|
28
31
|
import { QueryLanguageService } from '../Utilities/Services/QueryLanguageService';
|
|
29
32
|
import { LiveRefreshService } from '../Utilities/Services/LiveRefreshService';
|
|
30
33
|
import { AlertLiveBindingService } from '../Utilities/Services/AlertLiveBindingService';
|
|
@@ -84,7 +87,8 @@ import { AgGridColumnAdapter } from './AgGridColumnAdapter';
|
|
|
84
87
|
import getScrollbarSize from '../Utilities/getScrollbarSize';
|
|
85
88
|
import { ONLY_AGG_FN_NAME, WEIGHTED_AVERAGE_AGG_FN_NAME, } from '../AdaptableState/Common/AggregationColumns';
|
|
86
89
|
import { RowFormService } from '../Utilities/Services/RowFormService';
|
|
87
|
-
import {
|
|
90
|
+
import { ADAPTABLE_PUBLISH_DATE } from '../EnvVars';
|
|
91
|
+
import { getInstanceLicenseKey } from '../Utilities/license/instanceLicense';
|
|
88
92
|
import { AdaptableUpgradeHelper } from '../migration/AdaptableUpgradeHelper';
|
|
89
93
|
import { stripDeprecatedStateKeys } from '../migration/DeprecatedStateKeys';
|
|
90
94
|
import { ensureLoadingScreenPortalElement } from '../components/Modal';
|
|
@@ -100,6 +104,7 @@ import { checkForDuplicateColumns, resetLayoutHelperErrorOnceMessages, getLayout
|
|
|
100
104
|
import { applyAutoCreatedLayout, buildLayoutFromColDefs, resolveAutoCreateLayoutConfig, } from '../Utilities/Helpers/Layouts/AutoCreateLayoutHelper';
|
|
101
105
|
import { LayoutManager } from '../layout-manager/src';
|
|
102
106
|
import { rowGroupDisplayTypeToGridOption } from '../layout-manager/src/rowGroupDisplayType';
|
|
107
|
+
import { expandAllRowGroups } from '../layout-manager/src/expandAllRowGroups';
|
|
103
108
|
import { isPivotLayoutModel } from '../layout-manager/src/isPivotLayoutModel';
|
|
104
109
|
import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, HIDDEN_COLUMN_TYPE, hiddenColDefConfig, PIVOT_AGGREGATION_TOTAL_COLUMN_TYPE, PIVOT_ANY_TOTAL_COLUMN_TYPE, PIVOT_COLUMN_TOTAL_COLUMN_TYPE, PIVOT_GRAND_TOTAL_COLUMN_TYPE, } from '../AdaptableState/Common/AdaptableColumn';
|
|
105
110
|
import { mergeDataTypeDefinitions } from './AgGridCellDataTypeHelper';
|
|
@@ -107,7 +112,18 @@ import { AgGridThemeAdapter } from './AgGridThemeAdapter';
|
|
|
107
112
|
import { mapOldTypeToDataType } from '../migration/VersionUpgrade20';
|
|
108
113
|
import { tagProvidedByAdaptable } from '../Utilities/adaptableOverrideCheck';
|
|
109
114
|
import { AgGridModulesAdapter } from './AgGridModulesAdapter';
|
|
110
|
-
import { getMarker } from '../devTools';
|
|
115
|
+
import { getMarker, getStartupMarker } from '../devTools';
|
|
116
|
+
import { getPerfRecorder } from '../devTools/PerfStore';
|
|
117
|
+
const describeGridFilterPerf = () => ({
|
|
118
|
+
module: 'GridFilter',
|
|
119
|
+
objectName: 'Grid Filter (per row)',
|
|
120
|
+
});
|
|
121
|
+
const describeDataChangePerf = () => ({
|
|
122
|
+
objectName: 'Data change handling (Alerts, Flashing, Validation, history, refresh)',
|
|
123
|
+
});
|
|
124
|
+
const describeRefilterPerf = () => ({
|
|
125
|
+
objectName: 'Full re-filter after a data change',
|
|
126
|
+
});
|
|
111
127
|
import { DeepMap } from '@infinite-table/infinite-react';
|
|
112
128
|
import { DateFormatter } from '../Utilities/Helpers/DisplayFormatHelper';
|
|
113
129
|
import { AgGridFilterAdapterFactory } from './AgGridFilterAdapter';
|
|
@@ -115,7 +131,9 @@ import { AdaptableFilterHandler } from './AdaptableFilterHandler';
|
|
|
115
131
|
import { getColumnFilterInListValues } from '../aql/columnFilterQl';
|
|
116
132
|
import { AgGridFloatingFilterAdapterFactory } from './AgGridFloatingFilterAdapter';
|
|
117
133
|
import { listenForDevTools } from '../setupDevTools';
|
|
118
|
-
const
|
|
134
|
+
const getChangedCellKey = (primaryKeyValue, columnId) => `${primaryKeyValue}\u0000${columnId}`;
|
|
135
|
+
const getPinnedCopySource = (rowNode) => rowNode?.rowPinned != null ? rowNode.pinnedSibling : undefined;
|
|
136
|
+
const hasLocalEventService = (rowNode) => !!rowNode.__localEventService;
|
|
119
137
|
export class AdaptableAgGrid {
|
|
120
138
|
logger;
|
|
121
139
|
lifecycleState;
|
|
@@ -156,7 +174,21 @@ export class AdaptableAgGrid {
|
|
|
156
174
|
LicenseService;
|
|
157
175
|
ChartingService;
|
|
158
176
|
isListeningToAgGridRowNodeEvents = false;
|
|
159
|
-
|
|
177
|
+
trackedRowData = new Map();
|
|
178
|
+
pendingAsyncRowNodes = new Map();
|
|
179
|
+
pendingAsyncTransactions = 0;
|
|
180
|
+
syncTransactionDepth = 0;
|
|
181
|
+
refilterAfterAsyncFlush = false;
|
|
182
|
+
reportedCellChanges = new Map();
|
|
183
|
+
isReportedCellChangesClearScheduled = false;
|
|
184
|
+
updateCellCapture;
|
|
185
|
+
postEditBatch;
|
|
186
|
+
pendingPinnedCopyRefreshes = new Map();
|
|
187
|
+
dataBackedColumnsCache;
|
|
188
|
+
isRowIdPrimaryKey = false;
|
|
189
|
+
primaryKeyLookup;
|
|
190
|
+
hasLoggedPrimaryKeyLookupFallback = false;
|
|
191
|
+
hasWarnedSameObjectUpdate = false;
|
|
160
192
|
debouncedSetSelectedRows;
|
|
161
193
|
debouncedSetSelectedCells;
|
|
162
194
|
agGridListenerKeydown;
|
|
@@ -166,7 +198,6 @@ export class AdaptableAgGrid {
|
|
|
166
198
|
listenerGlobalChartingChanges;
|
|
167
199
|
listenerCellEditingStarted;
|
|
168
200
|
listenerFirstDataRendered;
|
|
169
|
-
listenerPivotChanged;
|
|
170
201
|
listenerCellSelectionChanged;
|
|
171
202
|
listenerSortChanged;
|
|
172
203
|
listenerColumnGroupOpened;
|
|
@@ -233,6 +264,7 @@ export class AdaptableAgGrid {
|
|
|
233
264
|
return this.emitter.onIncludeFired(eventName, callback);
|
|
234
265
|
};
|
|
235
266
|
static async _initInternal(config) {
|
|
267
|
+
applyGlobalGridOptions(config.gridOptions);
|
|
236
268
|
let promise = null;
|
|
237
269
|
if (Array.isArray(config.adaptableOptions.plugins)) {
|
|
238
270
|
const agGridOptions = {
|
|
@@ -288,7 +320,7 @@ export class AdaptableAgGrid {
|
|
|
288
320
|
this.logger = this.logger ?? new AdaptableLogger(this._rawAdaptableOptions.adaptableId);
|
|
289
321
|
resetLayoutHelperErrorOnceMessages();
|
|
290
322
|
const adaptableId = this._rawAdaptableOptions.adaptableId;
|
|
291
|
-
const initMarker =
|
|
323
|
+
const initMarker = getStartupMarker(adaptableId).track.Init.label.Init.start();
|
|
292
324
|
const perfInitAdaptableAgGrid = this.logger.beginPerf(`Adaptable._initAdaptableAgGrid()`);
|
|
293
325
|
this.variant = config.variant;
|
|
294
326
|
this.initWithLazyData =
|
|
@@ -320,7 +352,7 @@ export class AdaptableAgGrid {
|
|
|
320
352
|
this.forPlugins((plugin) => plugin.afterInitServices(this));
|
|
321
353
|
this.adaptableModules = this.initModules();
|
|
322
354
|
this.forPlugins((plugin) => plugin.afterInitModules(this, this.adaptableModules));
|
|
323
|
-
const loadStoreMarker =
|
|
355
|
+
const loadStoreMarker = getStartupMarker(adaptableId).track.Init.label.LoadStore.start();
|
|
324
356
|
const perfLoadStore = this.logger.beginPerf(`loadStore()`);
|
|
325
357
|
this.adaptableStore = this.initAdaptableStore();
|
|
326
358
|
this.forPlugins((plugin) => plugin.afterInitStore(this));
|
|
@@ -348,7 +380,7 @@ export class AdaptableAgGrid {
|
|
|
348
380
|
this.disableUnsupportedAdaptableFilter(colDef, String(colDef.colId ?? colDef.field ?? ''));
|
|
349
381
|
});
|
|
350
382
|
gridOptions.columnDefs = columnDefs;
|
|
351
|
-
this.setInitialGridOptions(gridOptions
|
|
383
|
+
this.setInitialGridOptions(gridOptions);
|
|
352
384
|
const { gridState: initialGridState, layoutModel } = this.mapAdaptableStateToAgGridState(this.adaptableStore.TheStore.getState(), gridOptions.columnDefs, {
|
|
353
385
|
isTree: !!gridOptions.treeData,
|
|
354
386
|
colTypes: gridOptions.columnTypes,
|
|
@@ -376,7 +408,7 @@ export class AdaptableAgGrid {
|
|
|
376
408
|
this.lifecycleState = 'initAgGrid';
|
|
377
409
|
this.agGridAdapter.initialGridOptions = gridOptions;
|
|
378
410
|
const perfInitAgGrid = this.logger.beginPerf(`initAgGrid()`);
|
|
379
|
-
const initAgGridMarker =
|
|
411
|
+
const initAgGridMarker = getStartupMarker(adaptableId).track.Init.label.InitAGGrid.start();
|
|
380
412
|
this.validateColumnDefTypes(gridOptions.columnDefs);
|
|
381
413
|
const agGridApi = await this.initializeAgGrid(gridOptions, config.modules, config.renderAgGridFrameworkComponent);
|
|
382
414
|
if (agGridApi === false) {
|
|
@@ -751,7 +783,7 @@ export class AdaptableAgGrid {
|
|
|
751
783
|
}
|
|
752
784
|
return adaptableOptions;
|
|
753
785
|
}
|
|
754
|
-
setInitialGridOptions(gridOptions
|
|
786
|
+
setInitialGridOptions(gridOptions) {
|
|
755
787
|
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'context', (original_context) => {
|
|
756
788
|
const userContext = original_context || {};
|
|
757
789
|
return {
|
|
@@ -879,6 +911,7 @@ export class AdaptableAgGrid {
|
|
|
879
911
|
if (StringExtensions.IsNullOrEmpty(primaryKey)) {
|
|
880
912
|
return original_getRowId;
|
|
881
913
|
}
|
|
914
|
+
this.isRowIdPrimaryKey = true;
|
|
882
915
|
if (this.hasAutogeneratedPrimaryKey) {
|
|
883
916
|
return (params) => {
|
|
884
917
|
if (Helper.objectNotExists(params.data[primaryKey])) {
|
|
@@ -936,6 +969,13 @@ export class AdaptableAgGrid {
|
|
|
936
969
|
}
|
|
937
970
|
return currentLayout.SuppressAggFuncInHeader;
|
|
938
971
|
});
|
|
972
|
+
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'ssrmExpandAllAffectsAllRows', (original_ssrmExpandAllAffectsAllRows) => {
|
|
973
|
+
if (original_ssrmExpandAllAffectsAllRows != undefined ||
|
|
974
|
+
gridOptions.rowModelType !== 'serverSide') {
|
|
975
|
+
return original_ssrmExpandAllAffectsAllRows;
|
|
976
|
+
}
|
|
977
|
+
return true;
|
|
978
|
+
});
|
|
939
979
|
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'aggFuncs', (original_aggFuncs) => {
|
|
940
980
|
const aggregationFunctions = original_aggFuncs || {};
|
|
941
981
|
aggregationFunctions[ONLY_AGG_FN_NAME] = (params) => {
|
|
@@ -1029,8 +1069,19 @@ export class AdaptableAgGrid {
|
|
|
1029
1069
|
return true;
|
|
1030
1070
|
}
|
|
1031
1071
|
const gridFilterPasses = resolveGridFilterPassPlan().passes;
|
|
1032
|
-
if (gridFilterPasses
|
|
1033
|
-
|
|
1072
|
+
if (gridFilterPasses) {
|
|
1073
|
+
const recorder = getPerfRecorder(this.adaptableOptions?.adaptableId);
|
|
1074
|
+
if (recorder) {
|
|
1075
|
+
const start = performance.now();
|
|
1076
|
+
const passes = gridFilterPasses(node);
|
|
1077
|
+
recorder.add('gridFilter', 'gridFilter', start, describeGridFilterPerf);
|
|
1078
|
+
if (!passes) {
|
|
1079
|
+
return false;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
else if (!gridFilterPasses(node)) {
|
|
1083
|
+
return false;
|
|
1084
|
+
}
|
|
1034
1085
|
}
|
|
1035
1086
|
const result = original_doesExternalFilterPass
|
|
1036
1087
|
? original_doesExternalFilterPass(node)
|
|
@@ -1056,6 +1107,12 @@ export class AdaptableAgGrid {
|
|
|
1056
1107
|
return this.agGridMenuAdapter.buildContextMenu(params, original_getContextMenuItems);
|
|
1057
1108
|
};
|
|
1058
1109
|
});
|
|
1110
|
+
if (this._isDetailGridForIndex == null) {
|
|
1111
|
+
const ignoredMenuCallbacks = ['getContextMenuItems', 'getColumnMenuItems', 'getMainMenuItems'].filter((propertyName) => this.agGridOptionsService.getUserGridOptionsProperty(propertyName));
|
|
1112
|
+
if (ignoredMenuCallbacks.length) {
|
|
1113
|
+
this.logger.consoleWarn(`GridOptions ${ignoredMenuCallbacks.join(', ')} ${ignoredMenuCallbacks.length === 1 ? 'is' : 'are'} ignored, as AdapTable builds the Context and Column Menus. Use contextMenuOptions.customContextMenu and columnMenuOptions.customColumnMenu instead.`);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1059
1116
|
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'components', (original_components) => {
|
|
1060
1117
|
const AdaptableToolPanel = getAdaptableToolPanelAgGridComponent(this);
|
|
1061
1118
|
const components = original_components || {};
|
|
@@ -1065,8 +1122,6 @@ export class AdaptableAgGrid {
|
|
|
1065
1122
|
};
|
|
1066
1123
|
return adaptableComponents;
|
|
1067
1124
|
});
|
|
1068
|
-
if (variant === 'react') {
|
|
1069
|
-
}
|
|
1070
1125
|
if (gridOptions.sideBar != undefined) {
|
|
1071
1126
|
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'sideBar', (original_sideBar) => {
|
|
1072
1127
|
if (!original_sideBar) {
|
|
@@ -1414,7 +1469,7 @@ export class AdaptableAgGrid {
|
|
|
1414
1469
|
}
|
|
1415
1470
|
initAdaptableStore() {
|
|
1416
1471
|
const perfNewAdaptableStore = this.logger.beginPerf(`initAdaptableStore()`);
|
|
1417
|
-
const initAdaptableStoreMarker =
|
|
1472
|
+
const initAdaptableStoreMarker = getStartupMarker(this.adaptableOptions.adaptableId).track.Init.label.InitStore.start();
|
|
1418
1473
|
const adaptableStore = new AdaptableStore(this);
|
|
1419
1474
|
adaptableStore.onBeforeAny((eventName, data) => {
|
|
1420
1475
|
if (this.isReady) {
|
|
@@ -1482,16 +1537,6 @@ export class AdaptableAgGrid {
|
|
|
1482
1537
|
});
|
|
1483
1538
|
}
|
|
1484
1539
|
}));
|
|
1485
|
-
this.agGridAdapter.getAgGridApi().addEventListener('columnPivotChanged', (this.listenerPivotChanged = (params) => {
|
|
1486
|
-
if (params.type == 'columnPivotChanged' &&
|
|
1487
|
-
params.columnApi != null &&
|
|
1488
|
-
params.columnApi.columnController != null &&
|
|
1489
|
-
params.columnApi.columnController.pivotMode == true) {
|
|
1490
|
-
if (this.api.layoutApi.getCurrentLayout().AutoSizeColumns) {
|
|
1491
|
-
this.agGridAdapter.getAgGridApi().autoSizeAllColumns();
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
}));
|
|
1495
1540
|
this.debouncedSetSelectedRows = debounce(() => {
|
|
1496
1541
|
if (!this.isReady) {
|
|
1497
1542
|
return;
|
|
@@ -1600,50 +1645,105 @@ export class AdaptableAgGrid {
|
|
|
1600
1645
|
}
|
|
1601
1646
|
if (event.type === 'dataChanged') {
|
|
1602
1647
|
const { node, oldData, newData } = event;
|
|
1603
|
-
|
|
1604
|
-
|
|
1648
|
+
const sourceNode = getPinnedCopySource(node);
|
|
1649
|
+
if (sourceNode && hasLocalEventService(sourceNode)) {
|
|
1650
|
+
this.applyPendingPinnedCopyRefresh(node);
|
|
1651
|
+
return;
|
|
1652
|
+
}
|
|
1653
|
+
const rowNode = sourceNode ?? node;
|
|
1654
|
+
const isPendingAsyncRow = this.pendingAsyncRowNodes.has(rowNode);
|
|
1655
|
+
if (this.trackedRowData.has(rowNode)) {
|
|
1656
|
+
this.trackedRowData.set(rowNode, newData);
|
|
1657
|
+
}
|
|
1658
|
+
this.onRowDataChanged({
|
|
1659
|
+
rowNode,
|
|
1660
|
+
oldData,
|
|
1661
|
+
newData,
|
|
1662
|
+
deferRefilter: isPendingAsyncRow && !this.postEditBatch,
|
|
1663
|
+
});
|
|
1605
1664
|
return;
|
|
1606
1665
|
}
|
|
1607
1666
|
if (event.type === 'cellChanged') {
|
|
1608
1667
|
const { node, column, oldValue, newValue } = event;
|
|
1609
|
-
if (column) {
|
|
1610
|
-
|
|
1668
|
+
if (!column) {
|
|
1669
|
+
return;
|
|
1670
|
+
}
|
|
1671
|
+
const sourceNode = getPinnedCopySource(node);
|
|
1672
|
+
if (sourceNode && hasLocalEventService(sourceNode)) {
|
|
1673
|
+
return;
|
|
1611
1674
|
}
|
|
1675
|
+
const rowNode = sourceNode ?? node;
|
|
1676
|
+
const colId = column.getColId();
|
|
1677
|
+
this.noteCellChangeReported(rowNode, colId);
|
|
1678
|
+
const reportedByRowNode = this.updateCellCapture?.reportedByRowNode;
|
|
1679
|
+
if (reportedByRowNode) {
|
|
1680
|
+
let colIds = reportedByRowNode.get(rowNode);
|
|
1681
|
+
if (!colIds) {
|
|
1682
|
+
colIds = new Set();
|
|
1683
|
+
reportedByRowNode.set(rowNode, colIds);
|
|
1684
|
+
}
|
|
1685
|
+
colIds.add(colId);
|
|
1686
|
+
}
|
|
1687
|
+
this.onCellDataChanged({ rowNode, oldValue, newValue, colId });
|
|
1612
1688
|
}
|
|
1613
1689
|
}
|
|
1614
1690
|
onAgGridCellValueChanged(event) {
|
|
1615
1691
|
if (!this.isListeningToAgGridRowNodeEvents) {
|
|
1616
1692
|
return;
|
|
1617
1693
|
}
|
|
1618
|
-
if (this.offScreenRowUpdateTrackers.length > 0) {
|
|
1619
|
-
return;
|
|
1620
|
-
}
|
|
1621
1694
|
const node = event.node;
|
|
1622
1695
|
const column = event.column;
|
|
1623
1696
|
if (!node || !column) {
|
|
1624
1697
|
return;
|
|
1625
1698
|
}
|
|
1626
|
-
if (node
|
|
1699
|
+
if (getPinnedCopySource(node)) {
|
|
1627
1700
|
return;
|
|
1628
1701
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1702
|
+
const colId = column.getColId();
|
|
1703
|
+
if (this.takeCellChangeReported(node, colId)) {
|
|
1631
1704
|
return;
|
|
1632
1705
|
}
|
|
1633
1706
|
this.onCellDataChanged({
|
|
1634
1707
|
rowNode: node,
|
|
1635
1708
|
oldValue: event.oldValue,
|
|
1636
1709
|
newValue: event.newValue,
|
|
1637
|
-
colId
|
|
1710
|
+
colId,
|
|
1638
1711
|
});
|
|
1639
1712
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1713
|
+
onAgGridCellValueChangedDispatch(event) {
|
|
1714
|
+
this.updateCellCapture?.events.push(event);
|
|
1715
|
+
}
|
|
1716
|
+
noteCellChangeReported(rowNode, colId) {
|
|
1717
|
+
if (!this.isReportedCellChangesClearScheduled) {
|
|
1718
|
+
this.isReportedCellChangesClearScheduled = true;
|
|
1719
|
+
queueMicrotask(() => setTimeout(() => {
|
|
1720
|
+
this.isReportedCellChangesClearScheduled = false;
|
|
1721
|
+
this.reportedCellChanges.clear();
|
|
1722
|
+
}, 0));
|
|
1723
|
+
}
|
|
1724
|
+
let countByColId = this.reportedCellChanges.get(rowNode);
|
|
1725
|
+
if (!countByColId) {
|
|
1726
|
+
countByColId = new Map();
|
|
1727
|
+
this.reportedCellChanges.set(rowNode, countByColId);
|
|
1728
|
+
}
|
|
1729
|
+
countByColId.set(colId, (countByColId.get(colId) ?? 0) + 1);
|
|
1730
|
+
}
|
|
1731
|
+
takeCellChangeReported(rowNode, colId) {
|
|
1732
|
+
const countByColId = this.reportedCellChanges.get(rowNode);
|
|
1733
|
+
const count = countByColId?.get(colId);
|
|
1734
|
+
if (!count) {
|
|
1735
|
+
return false;
|
|
1736
|
+
}
|
|
1737
|
+
if (count > 1) {
|
|
1738
|
+
countByColId.set(colId, count - 1);
|
|
1643
1739
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1740
|
+
else {
|
|
1741
|
+
countByColId.delete(colId);
|
|
1742
|
+
if (countByColId.size === 0) {
|
|
1743
|
+
this.reportedCellChanges.delete(rowNode);
|
|
1744
|
+
}
|
|
1646
1745
|
}
|
|
1746
|
+
return true;
|
|
1647
1747
|
}
|
|
1648
1748
|
shouldAutoSizeLayout() {
|
|
1649
1749
|
const { layoutApi } = this.api;
|
|
@@ -1704,10 +1804,8 @@ export class AdaptableAgGrid {
|
|
|
1704
1804
|
this.RowFormService = new RowFormService(this.api);
|
|
1705
1805
|
}
|
|
1706
1806
|
initLicenseService() {
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
return new LicenseService(this, licenseKey, {
|
|
1710
|
-
publishedAt: publishTimestamp,
|
|
1807
|
+
return new LicenseService(this, getInstanceLicenseKey(this.api), {
|
|
1808
|
+
publishedAt: ADAPTABLE_PUBLISH_DATE,
|
|
1711
1809
|
});
|
|
1712
1810
|
}
|
|
1713
1811
|
initModules() {
|
|
@@ -2272,86 +2370,136 @@ export class AdaptableAgGrid {
|
|
|
2272
2370
|
});
|
|
2273
2371
|
return data;
|
|
2274
2372
|
}
|
|
2373
|
+
countTransactionForPerf(transaction) {
|
|
2374
|
+
const recorder = getPerfRecorder(this.adaptableOptions?.adaptableId);
|
|
2375
|
+
if (recorder) {
|
|
2376
|
+
recorder.count('rowTransactions', (transaction.add?.length ?? 0) +
|
|
2377
|
+
(transaction.update?.length ?? 0) +
|
|
2378
|
+
(transaction.remove?.length ?? 0));
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2275
2381
|
applyAgGridTransaction(transaction) {
|
|
2276
2382
|
const isServerSideRowModel = this.getAgGridRowModelType() === 'serverSide';
|
|
2277
2383
|
const agGridApi = this.agGridAdapter.getAgGridApi();
|
|
2384
|
+
this.countTransactionForPerf(transaction);
|
|
2278
2385
|
if (isServerSideRowModel) {
|
|
2279
|
-
return
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
this.emitOffScreenRowUpdates(tracking, result?.update);
|
|
2285
|
-
return result;
|
|
2286
|
-
}
|
|
2287
|
-
finally {
|
|
2288
|
-
this.endOffScreenRowUpdateTracking(tracking);
|
|
2386
|
+
return this.runPostEditBatch(() => {
|
|
2387
|
+
const result = agGridApi.applyServerSideTransaction(transaction);
|
|
2388
|
+
this.addToPrimaryKeyLookup(result?.add);
|
|
2389
|
+
return result;
|
|
2390
|
+
});
|
|
2289
2391
|
}
|
|
2392
|
+
return this.runPostEditBatch(() => {
|
|
2393
|
+
this.trackRowUpdates(transaction.update);
|
|
2394
|
+
this.syncTransactionDepth++;
|
|
2395
|
+
try {
|
|
2396
|
+
const result = agGridApi.applyTransaction(transaction);
|
|
2397
|
+
this.postEditBatch.renderedRowIds = undefined;
|
|
2398
|
+
this.addToPrimaryKeyLookup(result?.add);
|
|
2399
|
+
this.reportTrackedRowUpdates(result?.update);
|
|
2400
|
+
return result;
|
|
2401
|
+
}
|
|
2402
|
+
finally {
|
|
2403
|
+
this.syncTransactionDepth--;
|
|
2404
|
+
this.releaseTrackedRows();
|
|
2405
|
+
}
|
|
2406
|
+
});
|
|
2290
2407
|
}
|
|
2291
2408
|
applyAgGridTransactionAsync(transaction, callback) {
|
|
2292
2409
|
const isServerSideRowModel = this.getAgGridRowModelType() === 'serverSide';
|
|
2293
2410
|
const agGridApi = this.agGridAdapter.getAgGridApi();
|
|
2411
|
+
this.countTransactionForPerf(transaction);
|
|
2294
2412
|
if (isServerSideRowModel) {
|
|
2295
|
-
return agGridApi.applyServerSideTransactionAsync(transaction,
|
|
2413
|
+
return agGridApi.applyServerSideTransactionAsync(transaction, (result) => {
|
|
2414
|
+
this.addToPrimaryKeyLookup(result?.add);
|
|
2415
|
+
callback(result);
|
|
2416
|
+
});
|
|
2417
|
+
}
|
|
2418
|
+
const trackedNodes = this.trackRowUpdates(transaction.update);
|
|
2419
|
+
this.pendingAsyncTransactions++;
|
|
2420
|
+
for (const node of trackedNodes) {
|
|
2421
|
+
this.pendingAsyncRowNodes.set(node, (this.pendingAsyncRowNodes.get(node) ?? 0) + 1);
|
|
2296
2422
|
}
|
|
2297
|
-
const tracking = this.beginOffScreenRowUpdateTracking(transaction.update);
|
|
2298
2423
|
const wrappedCallback = (result) => {
|
|
2299
2424
|
try {
|
|
2300
|
-
this.
|
|
2425
|
+
this.runPostEditBatch(() => {
|
|
2426
|
+
if (this.refilterAfterAsyncFlush) {
|
|
2427
|
+
this.refilterAfterAsyncFlush = false;
|
|
2428
|
+
this.postEditBatch.needsRefilter = true;
|
|
2429
|
+
}
|
|
2430
|
+
this.addToPrimaryKeyLookup(result?.add);
|
|
2431
|
+
this.reportTrackedRowUpdates(result?.update);
|
|
2432
|
+
});
|
|
2301
2433
|
}
|
|
2302
2434
|
finally {
|
|
2303
|
-
this.
|
|
2435
|
+
this.pendingAsyncTransactions--;
|
|
2436
|
+
for (const node of trackedNodes) {
|
|
2437
|
+
const count = this.pendingAsyncRowNodes.get(node) ?? 0;
|
|
2438
|
+
if (count > 1) {
|
|
2439
|
+
this.pendingAsyncRowNodes.set(node, count - 1);
|
|
2440
|
+
}
|
|
2441
|
+
else {
|
|
2442
|
+
this.pendingAsyncRowNodes.delete(node);
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
this.releaseTrackedRows();
|
|
2304
2446
|
}
|
|
2305
2447
|
callback(result);
|
|
2306
2448
|
};
|
|
2307
2449
|
return agGridApi.applyTransactionAsync(transaction, wrappedCallback);
|
|
2308
2450
|
}
|
|
2309
|
-
|
|
2451
|
+
trackRowUpdates(updateRows) {
|
|
2310
2452
|
if (!updateRows?.length || !this.isListeningToAgGridRowNodeEvents) {
|
|
2311
|
-
return
|
|
2453
|
+
return [];
|
|
2312
2454
|
}
|
|
2313
2455
|
const primaryKey = this.adaptableOptions.primaryKey;
|
|
2314
|
-
const
|
|
2456
|
+
const trackedNodes = [];
|
|
2315
2457
|
for (const row of updateRows) {
|
|
2316
|
-
|
|
2458
|
+
const primaryKeyValue = row?.[primaryKey];
|
|
2459
|
+
if (primaryKeyValue == null) {
|
|
2317
2460
|
continue;
|
|
2318
2461
|
}
|
|
2319
|
-
const node = this.getRowNodeForPrimaryKey(
|
|
2320
|
-
if (node?.data) {
|
|
2321
|
-
|
|
2462
|
+
const node = this.getRowNodeForPrimaryKey(primaryKeyValue);
|
|
2463
|
+
if (!node?.data) {
|
|
2464
|
+
continue;
|
|
2322
2465
|
}
|
|
2466
|
+
if (node.data === row) {
|
|
2467
|
+
this.warnSameObjectUpdate();
|
|
2468
|
+
continue;
|
|
2469
|
+
}
|
|
2470
|
+
if (!this.trackedRowData.has(node)) {
|
|
2471
|
+
this.trackedRowData.set(node, node.data);
|
|
2472
|
+
}
|
|
2473
|
+
trackedNodes.push(node);
|
|
2323
2474
|
}
|
|
2324
|
-
|
|
2325
|
-
seenIds: new Set(),
|
|
2326
|
-
oldDataByPk,
|
|
2327
|
-
};
|
|
2328
|
-
this.offScreenRowUpdateTrackers.push(tracking);
|
|
2329
|
-
return tracking;
|
|
2330
|
-
}
|
|
2331
|
-
endOffScreenRowUpdateTracking(tracking) {
|
|
2332
|
-
if (!tracking) {
|
|
2333
|
-
return;
|
|
2334
|
-
}
|
|
2335
|
-
const index = this.offScreenRowUpdateTrackers.lastIndexOf(tracking);
|
|
2336
|
-
if (index >= 0) {
|
|
2337
|
-
this.offScreenRowUpdateTrackers.splice(index, 1);
|
|
2338
|
-
}
|
|
2475
|
+
return trackedNodes;
|
|
2339
2476
|
}
|
|
2340
|
-
|
|
2341
|
-
if (!
|
|
2477
|
+
reportTrackedRowUpdates(updatedNodes) {
|
|
2478
|
+
if (!updatedNodes?.length || this.trackedRowData.size === 0) {
|
|
2342
2479
|
return;
|
|
2343
2480
|
}
|
|
2344
2481
|
for (const node of updatedNodes) {
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
}
|
|
2348
|
-
const primaryKeyValue = this.getPrimaryKeyValueFromRowNode(node);
|
|
2349
|
-
const oldData = tracking.oldDataByPk.get(primaryKeyValue);
|
|
2350
|
-
if (oldData == null) {
|
|
2482
|
+
const reportedData = this.trackedRowData.get(node);
|
|
2483
|
+
if (reportedData === undefined || reportedData === node.data) {
|
|
2351
2484
|
continue;
|
|
2352
2485
|
}
|
|
2353
|
-
this.
|
|
2486
|
+
this.trackedRowData.set(node, node.data);
|
|
2487
|
+
this.onRowDataChanged({ rowNode: node, oldData: reportedData, newData: node.data });
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
releaseTrackedRows() {
|
|
2491
|
+
if (this.syncTransactionDepth === 0 && this.pendingAsyncTransactions === 0) {
|
|
2492
|
+
this.trackedRowData.clear();
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
warnSameObjectUpdate() {
|
|
2496
|
+
if (this.hasWarnedSameObjectUpdate) {
|
|
2497
|
+
return;
|
|
2354
2498
|
}
|
|
2499
|
+
this.hasWarnedSameObjectUpdate = true;
|
|
2500
|
+
this.logger.consoleWarn('A row passed to updateGridData, addOrUpdateGridData or manageGridData is the same object as the row in the grid. ' +
|
|
2501
|
+
'Changes made to that object in place cannot be detected, so no Cell Changed Event, Flashing Cell or Alert is raised for them. ' +
|
|
2502
|
+
'Pass a new object for each updated row instead.');
|
|
2355
2503
|
}
|
|
2356
2504
|
updateRows(dataRows, dataUpdateConfig) {
|
|
2357
2505
|
if (this.hasAutogeneratedPrimaryKey) {
|
|
@@ -2556,15 +2704,71 @@ export class AdaptableAgGrid {
|
|
|
2556
2704
|
}
|
|
2557
2705
|
}
|
|
2558
2706
|
getRowNodeForPrimaryKey(primaryKeyValue) {
|
|
2559
|
-
if (
|
|
2560
|
-
return
|
|
2707
|
+
if (primaryKeyValue == null) {
|
|
2708
|
+
return undefined;
|
|
2561
2709
|
}
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2710
|
+
const rowNode = this.agGridAdapter
|
|
2711
|
+
.getAgGridApi()
|
|
2712
|
+
.getRowNode(typeof primaryKeyValue === 'number' ? `${primaryKeyValue}` : primaryKeyValue);
|
|
2713
|
+
if (rowNode && this.readPrimaryKeyValue(rowNode) == primaryKeyValue) {
|
|
2714
|
+
return rowNode;
|
|
2715
|
+
}
|
|
2716
|
+
if (this.isRowIdPrimaryKey &&
|
|
2717
|
+
this.getAgGridRowModelType() === 'clientSide' &&
|
|
2718
|
+
!this.agGridAdapter.getGridOption('treeData')) {
|
|
2719
|
+
return undefined;
|
|
2720
|
+
}
|
|
2721
|
+
return this.getRowNodeFromPrimaryKeyLookup(primaryKeyValue);
|
|
2722
|
+
}
|
|
2723
|
+
readPrimaryKeyValue(rowNode) {
|
|
2724
|
+
const value = rowNode.data?.[this.adaptableOptions.primaryKey];
|
|
2725
|
+
return value !== undefined ? value : this.getPrimaryKeyValueFromRowNode(rowNode);
|
|
2726
|
+
}
|
|
2727
|
+
getRowNodeFromPrimaryKeyLookup(primaryKeyValue) {
|
|
2728
|
+
const agGridApi = this.agGridAdapter.getAgGridApi();
|
|
2729
|
+
const key = String(primaryKeyValue);
|
|
2730
|
+
const lookup = this.primaryKeyLookup;
|
|
2731
|
+
const cached = lookup?.rowNodeByPrimaryKey.get(key);
|
|
2732
|
+
if (cached &&
|
|
2733
|
+
agGridApi.getRowNode(cached.id) === cached &&
|
|
2734
|
+
this.readPrimaryKeyValue(cached) == primaryKeyValue) {
|
|
2735
|
+
return cached;
|
|
2736
|
+
}
|
|
2737
|
+
if (lookup?.builtInTurn) {
|
|
2738
|
+
return undefined;
|
|
2739
|
+
}
|
|
2740
|
+
const rowNodeByPrimaryKey = new Map();
|
|
2741
|
+
agGridApi.forEachNode((rowNode) => {
|
|
2742
|
+
if (rowNode.data && !rowNode.group) {
|
|
2743
|
+
const value = this.readPrimaryKeyValue(rowNode);
|
|
2744
|
+
if (value != null) {
|
|
2745
|
+
rowNodeByPrimaryKey.set(String(value), rowNode);
|
|
2566
2746
|
}
|
|
2567
|
-
}
|
|
2747
|
+
}
|
|
2748
|
+
});
|
|
2749
|
+
const builtLookup = { rowNodeByPrimaryKey, builtInTurn: true };
|
|
2750
|
+
this.primaryKeyLookup = builtLookup;
|
|
2751
|
+
queueMicrotask(() => {
|
|
2752
|
+
builtLookup.builtInTurn = false;
|
|
2753
|
+
});
|
|
2754
|
+
const found = rowNodeByPrimaryKey.get(key);
|
|
2755
|
+
if (found && !this.hasLoggedPrimaryKeyLookupFallback) {
|
|
2756
|
+
this.hasLoggedPrimaryKeyLookupFallback = true;
|
|
2757
|
+
this.logger.consoleWarn(`The row id given by getRowId is not the primary key value ('${this.adaptableOptions.primaryKey}'), so rows are looked up by primary key through a slower search. ` +
|
|
2758
|
+
'Return the primary key value from getRowId to avoid it.');
|
|
2759
|
+
}
|
|
2760
|
+
return found;
|
|
2761
|
+
}
|
|
2762
|
+
addToPrimaryKeyLookup(addedRowNodes) {
|
|
2763
|
+
const lookup = this.primaryKeyLookup;
|
|
2764
|
+
if (!lookup || !addedRowNodes?.length) {
|
|
2765
|
+
return;
|
|
2766
|
+
}
|
|
2767
|
+
for (const rowNode of addedRowNodes) {
|
|
2768
|
+
const value = this.readPrimaryKeyValue(rowNode);
|
|
2769
|
+
if (value != null) {
|
|
2770
|
+
lookup.rowNodeByPrimaryKey.set(String(value), rowNode);
|
|
2771
|
+
}
|
|
2568
2772
|
}
|
|
2569
2773
|
}
|
|
2570
2774
|
hideColumn(columnId) {
|
|
@@ -3141,26 +3345,13 @@ export class AdaptableAgGrid {
|
|
|
3141
3345
|
return returnValues;
|
|
3142
3346
|
}
|
|
3143
3347
|
getRowNodesForPrimaryKeys(primaryKeyValues) {
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
});
|
|
3152
|
-
}
|
|
3153
|
-
else {
|
|
3154
|
-
primaryKeyValues.forEach((pkValue) => {
|
|
3155
|
-
let foundRow = false;
|
|
3156
|
-
this.agGridAdapter.getAgGridApi().forEachNode((rowNode) => {
|
|
3157
|
-
if (!foundRow && pkValue == this.getPrimaryKeyValueFromRowNode(rowNode)) {
|
|
3158
|
-
rowNodes.push(rowNode);
|
|
3159
|
-
foundRow = true;
|
|
3160
|
-
}
|
|
3161
|
-
});
|
|
3162
|
-
});
|
|
3163
|
-
}
|
|
3348
|
+
const rowNodes = [];
|
|
3349
|
+
primaryKeyValues.forEach((pkValue) => {
|
|
3350
|
+
const rowNode = this.getRowNodeForPrimaryKey(pkValue);
|
|
3351
|
+
if (rowNode) {
|
|
3352
|
+
rowNodes.push(rowNode);
|
|
3353
|
+
}
|
|
3354
|
+
});
|
|
3164
3355
|
return rowNodes;
|
|
3165
3356
|
}
|
|
3166
3357
|
getRowNodeByIndex(index) {
|
|
@@ -3175,7 +3366,38 @@ export class AdaptableAgGrid {
|
|
|
3175
3366
|
this.logger.warn(`updateCell() - rowNode not found for primaryKeyValue: ${cellUpdateRequest.primaryKeyValue}`);
|
|
3176
3367
|
return;
|
|
3177
3368
|
}
|
|
3178
|
-
|
|
3369
|
+
const outerCapture = this.updateCellCapture;
|
|
3370
|
+
const capture = {
|
|
3371
|
+
events: [],
|
|
3372
|
+
reportedByRowNode: new Map(),
|
|
3373
|
+
};
|
|
3374
|
+
this.updateCellCapture = capture;
|
|
3375
|
+
try {
|
|
3376
|
+
rowNode.setDataValue(cellUpdateRequest.columnId, cellUpdateRequest.newValue, 'edit');
|
|
3377
|
+
}
|
|
3378
|
+
finally {
|
|
3379
|
+
this.updateCellCapture = outerCapture;
|
|
3380
|
+
}
|
|
3381
|
+
if (!this.isListeningToAgGridRowNodeEvents) {
|
|
3382
|
+
return;
|
|
3383
|
+
}
|
|
3384
|
+
for (const event of capture.events) {
|
|
3385
|
+
const { node, column } = event;
|
|
3386
|
+
if (!node || !column || getPinnedCopySource(node)) {
|
|
3387
|
+
continue;
|
|
3388
|
+
}
|
|
3389
|
+
const colId = column.getColId();
|
|
3390
|
+
if (capture.reportedByRowNode.get(node)?.has(colId)) {
|
|
3391
|
+
continue;
|
|
3392
|
+
}
|
|
3393
|
+
this.noteCellChangeReported(node, colId);
|
|
3394
|
+
this.onCellDataChanged({
|
|
3395
|
+
rowNode: node,
|
|
3396
|
+
oldValue: event.oldValue,
|
|
3397
|
+
newValue: event.newValue,
|
|
3398
|
+
colId,
|
|
3399
|
+
});
|
|
3400
|
+
}
|
|
3179
3401
|
}
|
|
3180
3402
|
forAllRowNodesDo(func, config) {
|
|
3181
3403
|
this.agGridAdapter.getAgGridApi().forEachNode((rowNode, rowIndex) => {
|
|
@@ -3520,7 +3742,7 @@ export class AdaptableAgGrid {
|
|
|
3520
3742
|
.removeRowGroupColumns(this.agGridAdapter.getAgGridApi().getRowGroupColumns());
|
|
3521
3743
|
}
|
|
3522
3744
|
expandAllRowGroups() {
|
|
3523
|
-
this.agGridAdapter.getAgGridApi()
|
|
3745
|
+
expandAllRowGroups(this.agGridAdapter.getAgGridApi());
|
|
3524
3746
|
}
|
|
3525
3747
|
collapseAllRowGroups() {
|
|
3526
3748
|
this.agGridAdapter.getAgGridApi().collapseAll();
|
|
@@ -3570,11 +3792,14 @@ export class AdaptableAgGrid {
|
|
|
3570
3792
|
if (distinctRawValues.length === 0) {
|
|
3571
3793
|
return undefined;
|
|
3572
3794
|
}
|
|
3573
|
-
if (aggregation === 'min') {
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3795
|
+
if (aggregation === 'min' || aggregation === 'max') {
|
|
3796
|
+
const { min, max } = computeMinMax(distinctRawValues);
|
|
3797
|
+
this.columnMinMaxValuesCache[columnId] = {
|
|
3798
|
+
...this.columnMinMaxValuesCache[columnId],
|
|
3799
|
+
min,
|
|
3800
|
+
max,
|
|
3801
|
+
};
|
|
3802
|
+
return aggregation === 'min' ? min : max;
|
|
3578
3803
|
}
|
|
3579
3804
|
else if (aggregation === 'avg') {
|
|
3580
3805
|
const sum = distinctRawValues.reduce((acc, v) => acc + v, 0);
|
|
@@ -3613,7 +3838,6 @@ export class AdaptableAgGrid {
|
|
|
3613
3838
|
const agGridApi = this.agGridAdapter?.getAgGridApi();
|
|
3614
3839
|
if (agGridApi && !agGridApi.isDestroyed()) {
|
|
3615
3840
|
agGridApi.removeEventListener('firstDataRendered', this.listenerFirstDataRendered);
|
|
3616
|
-
agGridApi.removeEventListener('columnPivotChanged', this.listenerPivotChanged);
|
|
3617
3841
|
agGridApi.removeEventListener('cellEditingStarted', this.listenerCellEditingStarted);
|
|
3618
3842
|
agGridApi.removeEventListener('cellSelectionChanged', this.listenerCellSelectionChanged);
|
|
3619
3843
|
agGridApi.removeEventListener('columnGroupOpened', this.listenerColumnGroupOpened);
|
|
@@ -3626,7 +3850,6 @@ export class AdaptableAgGrid {
|
|
|
3626
3850
|
this.agGridAdapter.getAgGridApi().removeGlobalListener(this.listenerGlobalChartingChanges);
|
|
3627
3851
|
}
|
|
3628
3852
|
this.listenerFirstDataRendered = null;
|
|
3629
|
-
this.listenerPivotChanged = null;
|
|
3630
3853
|
this.listenerColumnGroupOpened = null;
|
|
3631
3854
|
this.listenerCellEditingStarted = null;
|
|
3632
3855
|
this.listenerCellSelectionChanged = null;
|
|
@@ -3698,6 +3921,13 @@ export class AdaptableAgGrid {
|
|
|
3698
3921
|
this.agGridModulesAdapter?.destroy();
|
|
3699
3922
|
this.agGridModulesAdapter = null;
|
|
3700
3923
|
this.isListeningToAgGridRowNodeEvents = false;
|
|
3924
|
+
this.trackedRowData.clear();
|
|
3925
|
+
this.pendingAsyncRowNodes.clear();
|
|
3926
|
+
this.reportedCellChanges.clear();
|
|
3927
|
+
this.updateCellCapture = undefined;
|
|
3928
|
+
this.pendingPinnedCopyRefreshes.clear();
|
|
3929
|
+
this.primaryKeyLookup = undefined;
|
|
3930
|
+
this.dataBackedColumnsCache = undefined;
|
|
3701
3931
|
this.emitter.destroy();
|
|
3702
3932
|
this.emitter = null;
|
|
3703
3933
|
this.adaptableOptions = null;
|
|
@@ -3889,7 +4119,17 @@ export class AdaptableAgGrid {
|
|
|
3889
4119
|
}
|
|
3890
4120
|
return null;
|
|
3891
4121
|
}
|
|
3892
|
-
|
|
4122
|
+
getDataBackedColumns() {
|
|
4123
|
+
const columns = this.api.columnApi.getColumns();
|
|
4124
|
+
if (this.dataBackedColumnsCache?.columns !== columns) {
|
|
4125
|
+
this.dataBackedColumnsCache = {
|
|
4126
|
+
columns,
|
|
4127
|
+
dataBackedColumns: getDataBackedColumns(columns, !!this.agGridAdapter.getGridOption('suppressFieldDotNotation')),
|
|
4128
|
+
};
|
|
4129
|
+
}
|
|
4130
|
+
return this.dataBackedColumnsCache.dataBackedColumns;
|
|
4131
|
+
}
|
|
4132
|
+
onRowDataChanged({ rowNode, oldData, newData, deferRefilter = false, }) {
|
|
3893
4133
|
if (oldData == null || oldData == undefined) {
|
|
3894
4134
|
return;
|
|
3895
4135
|
}
|
|
@@ -3900,31 +4140,34 @@ export class AdaptableAgGrid {
|
|
|
3900
4140
|
if (primaryKeyValue == null) {
|
|
3901
4141
|
return;
|
|
3902
4142
|
}
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
oldValue: oldValue,
|
|
3911
|
-
newValue: newValue,
|
|
3912
|
-
column: this.api.columnApi.getColumnWithColumnId(key),
|
|
3913
|
-
primaryKeyValue: primaryKeyValue,
|
|
3914
|
-
rowNode: rowNode,
|
|
3915
|
-
trigger: 'tick',
|
|
3916
|
-
});
|
|
3917
|
-
if (this.isUndoChange(cellDataChangedInfo)) {
|
|
3918
|
-
cellDataChangedInfo.trigger = 'undo';
|
|
3919
|
-
}
|
|
3920
|
-
cellDataChangedInfos.push(cellDataChangedInfo);
|
|
3921
|
-
}
|
|
4143
|
+
const internalApi = this.api.internalApi;
|
|
4144
|
+
const cellDataChangedInfos = [];
|
|
4145
|
+
for (const { column, field, isNested } of this.getDataBackedColumns()) {
|
|
4146
|
+
const oldValue = isNested ? internalApi.getValueUsingField(oldData, field) : oldData[field];
|
|
4147
|
+
const newValue = isNested ? internalApi.getValueUsingField(newData, field) : newData?.[field];
|
|
4148
|
+
if (areCellValuesEqual(oldValue, newValue)) {
|
|
4149
|
+
continue;
|
|
3922
4150
|
}
|
|
3923
|
-
|
|
3924
|
-
|
|
4151
|
+
const cellDataChangedInfo = internalApi.buildCellDataChangedInfo({
|
|
4152
|
+
oldValue: oldValue,
|
|
4153
|
+
newValue: newValue,
|
|
4154
|
+
column,
|
|
4155
|
+
primaryKeyValue: primaryKeyValue,
|
|
4156
|
+
rowNode: rowNode,
|
|
4157
|
+
trigger: 'tick',
|
|
4158
|
+
});
|
|
4159
|
+
if (this.isUndoChange(cellDataChangedInfo)) {
|
|
4160
|
+
cellDataChangedInfo.trigger = 'undo';
|
|
4161
|
+
}
|
|
4162
|
+
cellDataChangedInfos.push(cellDataChangedInfo);
|
|
4163
|
+
}
|
|
4164
|
+
if (cellDataChangedInfos.length === 0) {
|
|
4165
|
+
return;
|
|
4166
|
+
}
|
|
4167
|
+
this.performPostEditChecks(rowNode, cellDataChangedInfos, { oldData, deferRefilter });
|
|
3925
4168
|
}
|
|
3926
4169
|
onCellDataChanged({ rowNode, oldValue, newValue, colId, }) {
|
|
3927
|
-
if (oldValue
|
|
4170
|
+
if (areCellValuesEqual(oldValue, newValue)) {
|
|
3928
4171
|
return;
|
|
3929
4172
|
}
|
|
3930
4173
|
const abColumn = this.api.columnApi.getColumnWithColumnId(colId);
|
|
@@ -3964,8 +4207,24 @@ export class AdaptableAgGrid {
|
|
|
3964
4207
|
const undoChange = this.api.internalApi.getDataService().extractUndoChange(dataChange);
|
|
3965
4208
|
return !!undoChange;
|
|
3966
4209
|
}
|
|
3967
|
-
performPostEditChecks(rowNode, cellDataChangedInfos) {
|
|
3968
|
-
|
|
4210
|
+
performPostEditChecks(rowNode, cellDataChangedInfos, options) {
|
|
4211
|
+
const recorder = getPerfRecorder(this.adaptableOptions?.adaptableId);
|
|
4212
|
+
if (!recorder) {
|
|
4213
|
+
this.performPostEditChecksNow(rowNode, cellDataChangedInfos, options);
|
|
4214
|
+
return;
|
|
4215
|
+
}
|
|
4216
|
+
const start = performance.now();
|
|
4217
|
+
try {
|
|
4218
|
+
this.performPostEditChecksNow(rowNode, cellDataChangedInfos, options);
|
|
4219
|
+
}
|
|
4220
|
+
finally {
|
|
4221
|
+
recorder.count('cellChanges', cellDataChangedInfos.length);
|
|
4222
|
+
recorder.add('dataChange', 'dataChange', start, describeDataChangePerf);
|
|
4223
|
+
}
|
|
4224
|
+
}
|
|
4225
|
+
performPostEditChecksNow(rowNode, cellDataChangedInfos, options) {
|
|
4226
|
+
const batch = this.postEditBatch;
|
|
4227
|
+
cellDataChangedInfos = expandCellDataChangedInfosWithCalculatedColumns(this.api, cellDataChangedInfos, options?.oldData);
|
|
3969
4228
|
cellDataChangedInfos.forEach((cellDataChangedInfo) => {
|
|
3970
4229
|
if (cellDataChangedInfo.trigger === 'undo') {
|
|
3971
4230
|
this.logger.info(`Data change reverted: column="${cellDataChangedInfo.column}", primaryKey="${cellDataChangedInfo.primaryKeyValue}", from=${cellDataChangedInfo.newValue} to=${cellDataChangedInfo.oldValue}`);
|
|
@@ -3973,10 +4232,15 @@ export class AdaptableAgGrid {
|
|
|
3973
4232
|
if (cellDataChangedInfo.trigger === 'edit' ||
|
|
3974
4233
|
cellDataChangedInfo.trigger === 'undo' ||
|
|
3975
4234
|
cellDataChangedInfo.trigger === 'tick') {
|
|
3976
|
-
|
|
4235
|
+
if (batch) {
|
|
4236
|
+
this.recordChangedCellForSelection(batch, cellDataChangedInfo);
|
|
4237
|
+
}
|
|
4238
|
+
else {
|
|
4239
|
+
this.checkIfChangedCellCurrentlySelected(cellDataChangedInfo);
|
|
4240
|
+
}
|
|
3977
4241
|
}
|
|
3978
4242
|
this.DataService.CreateCellDataChangedEvent(cellDataChangedInfo);
|
|
3979
|
-
this.
|
|
4243
|
+
this.updateMinMaxCachedValueForColumn(cellDataChangedInfo);
|
|
3980
4244
|
});
|
|
3981
4245
|
this.applyPostEditRefresh(rowNode, this.collectPostEditRefreshScope(rowNode, cellDataChangedInfos));
|
|
3982
4246
|
const colIds = cellDataChangedInfos.map((c) => c.column.columnId);
|
|
@@ -3984,17 +4248,102 @@ export class AdaptableAgGrid {
|
|
|
3984
4248
|
const isGridFilterActive = !!gridFilterApi.getCurrentGridFilterExpression();
|
|
3985
4249
|
const isColumnFilterActive = colIds.some((colId) => columnFilterApi.isColumnFilterActiveForColumn(colId));
|
|
3986
4250
|
const shouldFilter = isGridFilterActive || isColumnFilterActive;
|
|
3987
|
-
if (shouldFilter) {
|
|
4251
|
+
if (!shouldFilter) {
|
|
4252
|
+
return;
|
|
4253
|
+
}
|
|
4254
|
+
if (batch) {
|
|
4255
|
+
batch.needsRefilter = true;
|
|
4256
|
+
}
|
|
4257
|
+
else if (options?.deferRefilter) {
|
|
4258
|
+
this.refilterAfterAsyncFlush = true;
|
|
4259
|
+
}
|
|
4260
|
+
else {
|
|
4261
|
+
this.filterOnDataChange();
|
|
4262
|
+
}
|
|
4263
|
+
}
|
|
4264
|
+
runPostEditBatch(fn) {
|
|
4265
|
+
if (this.postEditBatch) {
|
|
4266
|
+
return fn();
|
|
4267
|
+
}
|
|
4268
|
+
const batch = {
|
|
4269
|
+
needsRefilter: false,
|
|
4270
|
+
refreshAllCells: false,
|
|
4271
|
+
allRowsColumnIds: new Set(),
|
|
4272
|
+
changedCellKeys: new Set(),
|
|
4273
|
+
changedRowKeys: new Set(),
|
|
4274
|
+
};
|
|
4275
|
+
this.postEditBatch = batch;
|
|
4276
|
+
try {
|
|
4277
|
+
return fn();
|
|
4278
|
+
}
|
|
4279
|
+
finally {
|
|
4280
|
+
this.postEditBatch = undefined;
|
|
4281
|
+
this.flushPostEditBatch(batch);
|
|
4282
|
+
}
|
|
4283
|
+
}
|
|
4284
|
+
flushPostEditBatch(batch) {
|
|
4285
|
+
if (!this.isListeningToAgGridRowNodeEvents) {
|
|
4286
|
+
return;
|
|
4287
|
+
}
|
|
4288
|
+
if (batch.refreshAllCells) {
|
|
4289
|
+
this.agGridAdapter.getAgGridApi().refreshCells({ force: true, suppressFlash: true });
|
|
4290
|
+
}
|
|
4291
|
+
else if (batch.allRowsColumnIds.size > 0) {
|
|
4292
|
+
this.refreshColumns([...batch.allRowsColumnIds], true, true);
|
|
4293
|
+
}
|
|
4294
|
+
if (batch.selection) {
|
|
4295
|
+
const { cells, rows } = batch.selection;
|
|
4296
|
+
if (batch.changedCellKeys.size > 0 &&
|
|
4297
|
+
cells.some((gridCell) => batch.changedCellKeys.has(getChangedCellKey(gridCell.primaryKeyValue, gridCell.column?.columnId)))) {
|
|
4298
|
+
this.debouncedSetSelectedCells();
|
|
4299
|
+
}
|
|
4300
|
+
if (batch.changedRowKeys.size > 0 &&
|
|
4301
|
+
rows.some((gridRow) => batch.changedRowKeys.has(String(gridRow.primaryKeyValue)))) {
|
|
4302
|
+
this.debouncedSetSelectedRows();
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
4305
|
+
if (batch.needsRefilter) {
|
|
3988
4306
|
this.filterOnDataChange();
|
|
3989
4307
|
}
|
|
3990
4308
|
}
|
|
4309
|
+
recordChangedCellForSelection(batch, cellDataChangedInfo) {
|
|
4310
|
+
if (!batch.selection) {
|
|
4311
|
+
batch.selection = {
|
|
4312
|
+
cells: this.api.gridApi.getSelectedCellInfo()?.gridCells ?? [],
|
|
4313
|
+
rows: this.api.gridApi.getSelectedRowInfo()?.gridRows ?? [],
|
|
4314
|
+
};
|
|
4315
|
+
}
|
|
4316
|
+
const { cells, rows } = batch.selection;
|
|
4317
|
+
if (cells.length > 0) {
|
|
4318
|
+
batch.changedCellKeys.add(getChangedCellKey(cellDataChangedInfo.primaryKeyValue, cellDataChangedInfo.column?.columnId));
|
|
4319
|
+
}
|
|
4320
|
+
if (rows.length > 0) {
|
|
4321
|
+
batch.changedRowKeys.add(String(cellDataChangedInfo.primaryKeyValue));
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
isRowNodeRendered(rowNode) {
|
|
4325
|
+
if (rowNode.rowPinned != null) {
|
|
4326
|
+
return true;
|
|
4327
|
+
}
|
|
4328
|
+
const batch = this.postEditBatch;
|
|
4329
|
+
if (!batch) {
|
|
4330
|
+
return this.agGridAdapter.isVisibleNode(rowNode);
|
|
4331
|
+
}
|
|
4332
|
+
if (!batch.renderedRowIds) {
|
|
4333
|
+
batch.renderedRowIds = new Set(this.agGridAdapter
|
|
4334
|
+
.getAgGridApi()
|
|
4335
|
+
.getRenderedNodes()
|
|
4336
|
+
.map((renderedNode) => renderedNode.id));
|
|
4337
|
+
}
|
|
4338
|
+
return batch.renderedRowIds.has(rowNode.id);
|
|
4339
|
+
}
|
|
3991
4340
|
collectPostEditRefreshScope(rowNode, cellDataChangedInfos) {
|
|
3992
4341
|
const scope = {
|
|
3993
4342
|
wholeRow: false,
|
|
3994
4343
|
columnIds: new Set(),
|
|
3995
4344
|
allRowsColumnIds: new Set(),
|
|
3996
4345
|
};
|
|
3997
|
-
const isVisible = this.
|
|
4346
|
+
const isVisible = this.getRenderedCopiesOfRow(rowNode).length > 0;
|
|
3998
4347
|
if (isVisible && cellDataChangedInfos.length > 0) {
|
|
3999
4348
|
this.checkFormatColumnExpressionStyleChanges(scope, cellDataChangedInfos);
|
|
4000
4349
|
if (!scope.wholeRow) {
|
|
@@ -4018,6 +4367,11 @@ export class AdaptableAgGrid {
|
|
|
4018
4367
|
scope.columnIds.add(affected.columnId);
|
|
4019
4368
|
}
|
|
4020
4369
|
});
|
|
4370
|
+
if (isVisible) {
|
|
4371
|
+
expressionService
|
|
4372
|
+
.getAggregatedCalculatedColumnsAffectedByColumn(columnId)
|
|
4373
|
+
.forEach((affectedColumnId) => scope.columnIds.add(affectedColumnId));
|
|
4374
|
+
}
|
|
4021
4375
|
}
|
|
4022
4376
|
}
|
|
4023
4377
|
const styledColumn = this.api.styledColumnApi.getActiveStyledColumnForColumn(info.column);
|
|
@@ -4033,22 +4387,65 @@ export class AdaptableAgGrid {
|
|
|
4033
4387
|
}
|
|
4034
4388
|
applyPostEditRefresh(rowNode, scope) {
|
|
4035
4389
|
const { wholeRow, columnIds, allRowsColumnIds } = scope;
|
|
4036
|
-
|
|
4390
|
+
const batch = this.postEditBatch;
|
|
4391
|
+
const pinnedSibling = rowNode.pinnedSibling;
|
|
4392
|
+
if (pinnedSibling &&
|
|
4393
|
+
pinnedSibling.data !== rowNode.data &&
|
|
4394
|
+
hasLocalEventService(pinnedSibling) &&
|
|
4395
|
+
(wholeRow || columnIds.size > 0 || allRowsColumnIds.size > 0)) {
|
|
4396
|
+
this.pendingPinnedCopyRefreshes.set(pinnedSibling, {
|
|
4397
|
+
wholeRow,
|
|
4398
|
+
columnIds: new Set([...columnIds, ...allRowsColumnIds]),
|
|
4399
|
+
});
|
|
4400
|
+
}
|
|
4401
|
+
if (batch && allRowsColumnIds.size > 0) {
|
|
4402
|
+
if (wholeRow) {
|
|
4403
|
+
batch.refreshAllCells = true;
|
|
4404
|
+
return;
|
|
4405
|
+
}
|
|
4406
|
+
allRowsColumnIds.forEach((columnId) => batch.allRowsColumnIds.add(columnId));
|
|
4407
|
+
}
|
|
4408
|
+
else if (allRowsColumnIds.size > 0 && wholeRow) {
|
|
4037
4409
|
this.agGridAdapter.getAgGridApi().refreshCells({ force: true, suppressFlash: true });
|
|
4038
4410
|
return;
|
|
4039
4411
|
}
|
|
4040
|
-
if (allRowsColumnIds.size > 0) {
|
|
4412
|
+
else if (allRowsColumnIds.size > 0) {
|
|
4041
4413
|
this.refreshColumns([...allRowsColumnIds, ...columnIds], true, true);
|
|
4042
4414
|
return;
|
|
4043
4415
|
}
|
|
4416
|
+
const rowNodes = this.getRenderedCopiesOfRow(rowNode).filter((node) => !this.pendingPinnedCopyRefreshes.has(node));
|
|
4417
|
+
this.refreshRenderedRows(rowNodes, wholeRow, columnIds);
|
|
4418
|
+
}
|
|
4419
|
+
applyPendingPinnedCopyRefresh(pinnedCopy) {
|
|
4420
|
+
const pending = this.pendingPinnedCopyRefreshes.get(pinnedCopy);
|
|
4421
|
+
if (!pending) {
|
|
4422
|
+
return;
|
|
4423
|
+
}
|
|
4424
|
+
this.pendingPinnedCopyRefreshes.delete(pinnedCopy);
|
|
4425
|
+
this.refreshRenderedRows([pinnedCopy], pending.wholeRow, pending.columnIds);
|
|
4426
|
+
}
|
|
4427
|
+
refreshRenderedRows(rowNodes, wholeRow, columnIds) {
|
|
4428
|
+
if (rowNodes.length === 0) {
|
|
4429
|
+
return;
|
|
4430
|
+
}
|
|
4044
4431
|
if (wholeRow) {
|
|
4045
|
-
this.
|
|
4432
|
+
this.redrawRows(rowNodes);
|
|
4046
4433
|
return;
|
|
4047
4434
|
}
|
|
4048
|
-
if (columnIds.size > 0
|
|
4049
|
-
this.
|
|
4435
|
+
if (columnIds.size > 0) {
|
|
4436
|
+
this.agGridAdapter.getAgGridApi().refreshCells({
|
|
4437
|
+
rowNodes,
|
|
4438
|
+
columns: Array.from(columnIds),
|
|
4439
|
+
force: true,
|
|
4440
|
+
suppressFlash: true,
|
|
4441
|
+
});
|
|
4050
4442
|
}
|
|
4051
4443
|
}
|
|
4444
|
+
getRenderedCopiesOfRow(rowNode) {
|
|
4445
|
+
const pinnedSibling = rowNode.pinnedSibling;
|
|
4446
|
+
const rowNodes = pinnedSibling ? [rowNode, pinnedSibling] : [rowNode];
|
|
4447
|
+
return rowNodes.filter((node) => this.isRowNodeRendered(node));
|
|
4448
|
+
}
|
|
4052
4449
|
checkStyledColumnComparisonChanges(dataChangedScope, cellDataChangedInfos) {
|
|
4053
4450
|
this.api.styledColumnApi.getStyledColumns().forEach((sc) => {
|
|
4054
4451
|
let columnComparison = this.api.styledColumnApi.internalApi.getColumnComparisonForStyledColumn(sc);
|
|
@@ -4124,24 +4521,45 @@ export class AdaptableAgGrid {
|
|
|
4124
4521
|
}
|
|
4125
4522
|
}
|
|
4126
4523
|
}
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
if (this.columnMinMaxValuesCache[column.columnId]) {
|
|
4132
|
-
this.columnMinMaxValuesCache[column.columnId] = undefined;
|
|
4524
|
+
updateMinMaxCachedValueForColumn(cellDataChangedInfo) {
|
|
4525
|
+
const columnId = cellDataChangedInfo.column?.columnId;
|
|
4526
|
+
if (!columnId || !this.columnMinMaxValuesCache?.[columnId]) {
|
|
4527
|
+
return;
|
|
4133
4528
|
}
|
|
4529
|
+
this.columnMinMaxValuesCache[columnId] = updateColumnMinMaxCacheEntry(this.columnMinMaxValuesCache[columnId], cellDataChangedInfo);
|
|
4134
4530
|
}
|
|
4135
4531
|
filterOnDataChange() {
|
|
4136
|
-
this.
|
|
4532
|
+
const recorder = getPerfRecorder(this.adaptableOptions?.adaptableId);
|
|
4533
|
+
if (!recorder) {
|
|
4534
|
+
this.agGridAdapter.getAgGridApi()?.onFilterChanged();
|
|
4535
|
+
return;
|
|
4536
|
+
}
|
|
4537
|
+
const start = performance.now();
|
|
4538
|
+
try {
|
|
4539
|
+
this.agGridAdapter.getAgGridApi()?.onFilterChanged();
|
|
4540
|
+
}
|
|
4541
|
+
finally {
|
|
4542
|
+
recorder.count('refiltersFromDataChange');
|
|
4543
|
+
recorder.add('filterPass', 'filterPass:dataChange', start, describeRefilterPerf);
|
|
4544
|
+
}
|
|
4137
4545
|
}
|
|
4138
|
-
refreshLayout() {
|
|
4546
|
+
refreshLayout(config) {
|
|
4139
4547
|
const columnDefs = this.agGridAdapter.getColumnDefinitionsInclSpecialColumns();
|
|
4140
4548
|
this.agGridAdapter.setGridOption('columnDefs', columnDefs);
|
|
4141
4549
|
this.__forceUpdateColumnModel = true;
|
|
4142
4550
|
this.updateLayoutInManagerAfterStoreHasChanged();
|
|
4551
|
+
if (config?.columnsChanged &&
|
|
4552
|
+
this.getAgGridRowModelType() === 'serverSide' &&
|
|
4553
|
+
!this.isAnyFilterActive()) {
|
|
4554
|
+
return;
|
|
4555
|
+
}
|
|
4143
4556
|
this.applyFiltering();
|
|
4144
4557
|
}
|
|
4558
|
+
isAnyFilterActive() {
|
|
4559
|
+
return (this.api.filterApi.columnFilterApi.getActiveColumnFilters().length > 0 ||
|
|
4560
|
+
StringExtensions.IsNotNullOrEmpty(this.api.filterApi.gridFilterApi.getCurrentGridFilterExpression()) ||
|
|
4561
|
+
Object.keys(this.agGridAdapter.getAgGridApi().getFilterModel() ?? {}).length > 0);
|
|
4562
|
+
}
|
|
4145
4563
|
isRowGroupDifferentInLayout(one, other) {
|
|
4146
4564
|
const prevRowGroupedColumns = one.RowGroupedColumns || one.PivotGroupedColumns || [];
|
|
4147
4565
|
const currentRowGroupedColumns = other.RowGroupedColumns || other.PivotGroupedColumns || [];
|