@adaptabletools/adaptable 22.0.8 → 22.0.10
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/package.json +1 -1
- package/src/AdaptableOptions/FilterOptions.d.ts +23 -6
- package/src/AdaptableState/Common/CellDataChangedInfo.d.ts +4 -0
- package/src/Api/Implementation/ColumnFilterApiImpl.js +0 -1
- package/src/Strategy/CalculatedColumnModule.js +1 -1
- package/src/Strategy/ColumnFilterModule.js +4 -2
- package/src/Strategy/DataChangeHistoryModule.js +3 -1
- package/src/Strategy/FlashingCellModule.js +1 -1
- package/src/Strategy/FreeTextColumnModule.js +1 -1
- package/src/Utilities/Services/DataService.js +6 -0
- package/src/agGrid/AdaptableAgGrid.js +3 -5
- package/src/agGrid/AgGridAdapter.d.ts +2 -0
- package/src/agGrid/AgGridAdapter.js +31 -2
- package/src/agGrid/AgGridColumnAdapter.js +2 -1
- package/src/components/Tree/TreeList/index.d.ts +1 -1
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.10",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -227,7 +227,6 @@ export interface InFilterValueResult {
|
|
|
227
227
|
* Information about items in the IN Column Filter
|
|
228
228
|
*/
|
|
229
229
|
export interface InFilterValueInfo extends InFilterValue {
|
|
230
|
-
id: string | number;
|
|
231
230
|
/**
|
|
232
231
|
* Whether Item is currently selected
|
|
233
232
|
*/
|
|
@@ -255,23 +254,41 @@ export interface InFilterValueInfo extends InFilterValue {
|
|
|
255
254
|
*/
|
|
256
255
|
export interface CustomInFilterValuesContext<TData = any> extends AdaptableColumnContext {
|
|
257
256
|
/**
|
|
258
|
-
*
|
|
257
|
+
* Distinct Column values in natural (unsorted) row iteration order.
|
|
258
|
+
*
|
|
259
|
+
* When the Column uses a Tree Filter, items have a hierarchical structure.
|
|
260
|
+
*
|
|
261
|
+
* Computed lazily on first access.
|
|
259
262
|
*/
|
|
260
263
|
defaultValues: Required<InFilterValueInfo>[];
|
|
261
264
|
/**
|
|
262
|
-
*
|
|
265
|
+
* Distinct Column values sorted by the Column's own sort direction (Asc / Desc).
|
|
266
|
+
*
|
|
267
|
+
* If the Column has no active sort, values are returned in the same order as `defaultValues`.
|
|
268
|
+
*
|
|
269
|
+
* When the Column uses a Tree Filter, items have a hierarchical structure.
|
|
270
|
+
*
|
|
271
|
+
* Computed lazily on first access.
|
|
263
272
|
*/
|
|
264
273
|
sortedValues: Required<InFilterValueInfo>[];
|
|
265
274
|
/**
|
|
266
|
-
*
|
|
275
|
+
* Distinct Column values in the order they appear in the grid from top to bottom.
|
|
276
|
+
*
|
|
277
|
+
* Always a flat list, even when the Column uses a Tree Filter.
|
|
278
|
+
*
|
|
279
|
+
* Computed lazily on first access.
|
|
267
280
|
*/
|
|
268
281
|
orderedValues: Required<InFilterValueInfo>[];
|
|
269
282
|
/**
|
|
270
|
-
*
|
|
283
|
+
* Current text in the IN Filter search box.
|
|
284
|
+
*
|
|
285
|
+
* Useful when implementing server-side filtering of the value list.
|
|
271
286
|
*/
|
|
272
287
|
currentSearchValue: string;
|
|
273
288
|
/**
|
|
274
|
-
*
|
|
289
|
+
* The result returned by the previous invocation of `FilterOptions.customInFilterValues`, if any.
|
|
290
|
+
*
|
|
291
|
+
* Useful for avoiding expensive recomputations (e.g. when filtering is async or server-side).
|
|
275
292
|
*/
|
|
276
293
|
previousFilterResult?: InFilterValueResult;
|
|
277
294
|
}
|
|
@@ -36,4 +36,8 @@ export interface CellDataChangedInfo<TData = any> {
|
|
|
36
36
|
* What triggered the change - user, background change or a reverted change?
|
|
37
37
|
*/
|
|
38
38
|
trigger?: 'edit' | 'tick' | 'undo' | 'aggChange';
|
|
39
|
+
/**
|
|
40
|
+
* Whether the change was prevented by a validation rule
|
|
41
|
+
*/
|
|
42
|
+
preventEdit?: boolean;
|
|
39
43
|
}
|
|
@@ -32,7 +32,7 @@ export class CalculatedColumnModule extends AdaptableModuleBase {
|
|
|
32
32
|
this.api.internalApi
|
|
33
33
|
.getDataService()
|
|
34
34
|
.on('CellDataChanged', (cellDataChangedInfo) => {
|
|
35
|
-
if (cellDataChangedInfo.trigger !== 'aggChange') {
|
|
35
|
+
if (cellDataChangedInfo.trigger !== 'aggChange' && !cellDataChangedInfo.preventEdit) {
|
|
36
36
|
this.api.internalApi
|
|
37
37
|
.getCalculatedColumnExpressionService()
|
|
38
38
|
.listentoCellDataChange(cellDataChangedInfo);
|
|
@@ -24,8 +24,10 @@ export class ColumnFilterModule extends AdaptableModuleBase {
|
|
|
24
24
|
this.api.internalApi
|
|
25
25
|
.getDataService()
|
|
26
26
|
.on('CellDataChanged', (cellDataChangedInfo) => {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
if (!cellDataChangedInfo.preventEdit) {
|
|
28
|
+
const changedColumnId = cellDataChangedInfo.column.columnId;
|
|
29
|
+
this.api.filterApi.columnFilterApi.resetFilterValues(changedColumnId);
|
|
30
|
+
}
|
|
29
31
|
});
|
|
30
32
|
// we reset the filter cache on sort change, because we might have columns
|
|
31
33
|
// with "In" filters, with custom values, which use `context.orderedValues`
|
|
@@ -29,7 +29,9 @@ export class DataChangeHistoryModule extends AdaptableModuleBase {
|
|
|
29
29
|
this.api.internalApi
|
|
30
30
|
.getDataService()
|
|
31
31
|
.on('CellDataChanged', (cellDataChangedInfo) => {
|
|
32
|
-
if (this.isListeningToCellDataChanges &&
|
|
32
|
+
if (this.isListeningToCellDataChanges &&
|
|
33
|
+
this.isDataChangeLoggable(cellDataChangedInfo) &&
|
|
34
|
+
!cellDataChangedInfo.preventEdit) {
|
|
33
35
|
this.api.dataChangeHistoryApi.addDataChangeHistoryEntry(cellDataChangedInfo);
|
|
34
36
|
}
|
|
35
37
|
});
|
|
@@ -35,7 +35,7 @@ export class FlashingCellModule extends AdaptableModuleBase {
|
|
|
35
35
|
this.api.internalApi
|
|
36
36
|
.getDataService()
|
|
37
37
|
.on('CellDataChanged', (cellDataChangedInfo) => {
|
|
38
|
-
if (cellDataChangedInfo.trigger === 'undo') {
|
|
38
|
+
if (cellDataChangedInfo.trigger === 'undo' || cellDataChangedInfo.preventEdit) {
|
|
39
39
|
// do NOT handle reverted changes
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
@@ -30,7 +30,7 @@ export class FreeTextColumnModule extends AdaptableModuleBase {
|
|
|
30
30
|
this.api.internalApi
|
|
31
31
|
.getDataService()
|
|
32
32
|
.on('CellDataChanged', (cellDataChangedInfo) => {
|
|
33
|
-
if (cellDataChangedInfo.trigger !== 'aggChange') {
|
|
33
|
+
if (cellDataChangedInfo.trigger !== 'aggChange' && !cellDataChangedInfo.preventEdit) {
|
|
34
34
|
this.api.freeTextColumnApi.internalApi.handleFreeTextColumnDataChange(cellDataChangedInfo);
|
|
35
35
|
}
|
|
36
36
|
});
|
|
@@ -41,6 +41,12 @@ export class DataService {
|
|
|
41
41
|
emit = (eventName, data) => this.emitter.emit(eventName, data);
|
|
42
42
|
CreateCellDataChangedEvent(cellDataChangedInfo) {
|
|
43
43
|
if (cellDataChangedInfo.newValue != cellDataChangedInfo.oldValue) {
|
|
44
|
+
const validationRules = this.adaptable.api.internalApi
|
|
45
|
+
.getValidationService()
|
|
46
|
+
.getValidationRulesForDataChange(cellDataChangedInfo);
|
|
47
|
+
if (validationRules.length) {
|
|
48
|
+
cellDataChangedInfo.preventEdit = true;
|
|
49
|
+
}
|
|
44
50
|
this.emitter.emitSync('CellDataChanged', cellDataChangedInfo);
|
|
45
51
|
this.adaptable.api.eventApi.internalApi.fireCellChangedEvent(cellDataChangedInfo);
|
|
46
52
|
const dataChangeLogEntry = this.extractDataChangeLogEntry(cellDataChangedInfo);
|
|
@@ -503,6 +503,7 @@ export class AdaptableAgGrid {
|
|
|
503
503
|
this.agGridAdapter.setAgGridApi(agGridApi);
|
|
504
504
|
this.agGridAdapter.monkeyPatchingGridOptionsUpdates();
|
|
505
505
|
this.agGridAdapter.monkeyPatchingAggColumnFilters();
|
|
506
|
+
this.agGridAdapter.monkeyPatchingAggFuncLabels();
|
|
506
507
|
this.lifecycleState = 'agGridReady';
|
|
507
508
|
this.api.entitlementApi.internalApi.setModulesAgGridDepsInfos();
|
|
508
509
|
this.ModuleService.logMissingAgGridDepsInfos();
|
|
@@ -1020,7 +1021,7 @@ export class AdaptableAgGrid {
|
|
|
1020
1021
|
}
|
|
1021
1022
|
return (params) => {
|
|
1022
1023
|
// might be a summary row
|
|
1023
|
-
if (params.data?.[ROW_SUMMARY_ROW_ID]) {
|
|
1024
|
+
if (params.data?.[ROW_SUMMARY_ROW_ID] != undefined) {
|
|
1024
1025
|
return params.data[ROW_SUMMARY_ROW_ID];
|
|
1025
1026
|
}
|
|
1026
1027
|
if (params.level > 0) {
|
|
@@ -1036,7 +1037,7 @@ export class AdaptableAgGrid {
|
|
|
1036
1037
|
const id = [...parentKeys, Math.abs(hash)].join('/');
|
|
1037
1038
|
return id;
|
|
1038
1039
|
}
|
|
1039
|
-
if (params.data?.[primaryKey]) {
|
|
1040
|
+
if (params.data?.[primaryKey] != undefined) {
|
|
1040
1041
|
const primaryKeyValue = params.data[primaryKey];
|
|
1041
1042
|
return typeof primaryKeyValue === 'number'
|
|
1042
1043
|
? `${primaryKeyValue}`
|
|
@@ -2709,11 +2710,9 @@ export class AdaptableAgGrid {
|
|
|
2709
2710
|
};
|
|
2710
2711
|
// No distinct values so lets return unique grid cells
|
|
2711
2712
|
const mapFn = (gridCell, level) => {
|
|
2712
|
-
const itemId = `${gridCell.rowNode?.id}-${gridCell.column?.columnId}`;
|
|
2713
2713
|
if (level || Array.isArray(gridCell.children)) {
|
|
2714
2714
|
const cell = gridCell;
|
|
2715
2715
|
const inFilterValue = {
|
|
2716
|
-
id: itemId,
|
|
2717
2716
|
value: gridCell.rawValue,
|
|
2718
2717
|
label: gridCell.displayValue,
|
|
2719
2718
|
level: level ?? 0,
|
|
@@ -2734,7 +2733,6 @@ export class AdaptableAgGrid {
|
|
|
2734
2733
|
return inFilterValue;
|
|
2735
2734
|
}
|
|
2736
2735
|
return {
|
|
2737
|
-
id: itemId,
|
|
2738
2736
|
value: gridCell.rawValue,
|
|
2739
2737
|
label: gridCell.displayValue,
|
|
2740
2738
|
};
|
|
@@ -11,6 +11,7 @@ export declare class AgGridAdapter {
|
|
|
11
11
|
private DANGER_updateGridOptionsMonkeyPatcher;
|
|
12
12
|
private DANGER_doFiltersPassMonkeyPatcher;
|
|
13
13
|
private DANGER_isAggFilterPresentMonkeyPatcher;
|
|
14
|
+
private DANGER_getDefaultFuncLabelMonkeyPatcher;
|
|
14
15
|
private activePivotColumnFilters_MEMO;
|
|
15
16
|
initialGridOptions: GridOptions;
|
|
16
17
|
private _agGridId;
|
|
@@ -28,6 +29,7 @@ export declare class AgGridAdapter {
|
|
|
28
29
|
getAgGridApi(skipLogging?: boolean): GridApi | undefined;
|
|
29
30
|
monkeyPatchingGridOptionsUpdates(): void;
|
|
30
31
|
monkeyPatchingAggColumnFilters(): void;
|
|
32
|
+
monkeyPatchingAggFuncLabels(): void;
|
|
31
33
|
private DANGER_getPrivateAgGridBeans;
|
|
32
34
|
DANGER_getLiveGridOptions(): GridOptions<any>;
|
|
33
35
|
getAgGridRootElement(): HTMLElement;
|
|
@@ -21,6 +21,8 @@ export class AgGridAdapter {
|
|
|
21
21
|
// see #aggColumnFilters_monkey_patch
|
|
22
22
|
DANGER_doFiltersPassMonkeyPatcher;
|
|
23
23
|
DANGER_isAggFilterPresentMonkeyPatcher;
|
|
24
|
+
// see #aggFuncLabels_monkey_patch
|
|
25
|
+
DANGER_getDefaultFuncLabelMonkeyPatcher;
|
|
24
26
|
activePivotColumnFilters_MEMO = new WeakMap();
|
|
25
27
|
initialGridOptions;
|
|
26
28
|
_agGridId;
|
|
@@ -51,6 +53,7 @@ export class AgGridAdapter {
|
|
|
51
53
|
this.DANGER_updateGridOptionsMonkeyPatcher = null;
|
|
52
54
|
this.DANGER_doFiltersPassMonkeyPatcher = null;
|
|
53
55
|
this.DANGER_isAggFilterPresentMonkeyPatcher = null;
|
|
56
|
+
this.DANGER_getDefaultFuncLabelMonkeyPatcher = null;
|
|
54
57
|
this.activePivotColumnFilters_MEMO = null;
|
|
55
58
|
this._adaptableInstance = null;
|
|
56
59
|
}
|
|
@@ -208,6 +211,27 @@ export class AgGridAdapter {
|
|
|
208
211
|
};
|
|
209
212
|
agGridColumnFilterService.isAggFilterPresent = this.DANGER_isAggFilterPresentMonkeyPatcher;
|
|
210
213
|
}
|
|
214
|
+
// #aggFuncLabels_monkey_patch
|
|
215
|
+
monkeyPatchingAggFuncLabels() {
|
|
216
|
+
const agGridAggFuncService = this.DANGER_getPrivateAgGridBeans()?.aggFuncSvc;
|
|
217
|
+
if (!agGridAggFuncService) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const original_getDefaultFuncLabel = agGridAggFuncService.getDefaultFuncLabel;
|
|
221
|
+
if (typeof original_getDefaultFuncLabel !== 'function') {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
this.DANGER_getDefaultFuncLabelMonkeyPatcher = function (fctName) {
|
|
225
|
+
if (fctName === 'only') {
|
|
226
|
+
return 'Only';
|
|
227
|
+
}
|
|
228
|
+
if (fctName === 'weightedAvg') {
|
|
229
|
+
return 'Weighted Average';
|
|
230
|
+
}
|
|
231
|
+
return original_getDefaultFuncLabel.call(this, fctName);
|
|
232
|
+
};
|
|
233
|
+
agGridAggFuncService.getDefaultFuncLabel = this.DANGER_getDefaultFuncLabelMonkeyPatcher;
|
|
234
|
+
}
|
|
211
235
|
DANGER_getPrivateAgGridBeans() {
|
|
212
236
|
const beans = DANGER_AG_GRID_BEANS_MAP[this._agGridId];
|
|
213
237
|
if (!beans) {
|
|
@@ -655,9 +679,14 @@ export class AgGridAdapter {
|
|
|
655
679
|
return false;
|
|
656
680
|
}
|
|
657
681
|
getColumnAggregationFunctions(colDef) {
|
|
658
|
-
|
|
682
|
+
const defaultAggFuncs = ['sum', 'min', 'max', 'count', 'avg', 'first', 'last'];
|
|
683
|
+
const hasAllowedAggFuncs = Array.isArray(colDef.allowedAggFuncs);
|
|
684
|
+
let result = hasAllowedAggFuncs ? [...colDef.allowedAggFuncs] : [...defaultAggFuncs];
|
|
659
685
|
const gridOptionsAggFuncs = this.adaptableApi.agGridApi.getGridOption('aggFuncs') || {};
|
|
660
|
-
|
|
686
|
+
const gridOptionsAggFuncNames = Object.keys(gridOptionsAggFuncs);
|
|
687
|
+
if (!hasAllowedAggFuncs) {
|
|
688
|
+
result.push(...gridOptionsAggFuncNames);
|
|
689
|
+
}
|
|
661
690
|
result = result.filter((func) => !isWeightedAverageAggFuncName(func));
|
|
662
691
|
return [...new Set(result)];
|
|
663
692
|
}
|
|
@@ -17,7 +17,7 @@ import { AdaptableFilterHandler } from './AdaptableFilterHandler';
|
|
|
17
17
|
import { AgGridFilterAdapterFactory } from './AgGridFilterAdapter';
|
|
18
18
|
import { AgGridFloatingFilterAdapterFactory } from './AgGridFloatingFilterAdapter';
|
|
19
19
|
import { errorOnce } from './AdaptableLogger';
|
|
20
|
-
import { isWeightedAverageAggFuncName } from '../AdaptableState/Common/AggregationColumns';
|
|
20
|
+
import { isWeightedAverageAggFuncName, } from '../AdaptableState/Common/AggregationColumns';
|
|
21
21
|
export function getEditorForColumnDataType(columnDataType, variant) {
|
|
22
22
|
if (columnDataType === 'number') {
|
|
23
23
|
return variant === 'react' ? AdaptableReactNumberEditor : AdaptableNumberEditor;
|
|
@@ -571,6 +571,7 @@ export class AgGridColumnAdapter {
|
|
|
571
571
|
return undefined;
|
|
572
572
|
}
|
|
573
573
|
return abColumn.availableAggregationFunctions.filter((func) => !isWeightedAverageAggFuncName(func));
|
|
574
|
+
// .filter((func) => func !== ONLY_AGG_FN_NAME);
|
|
574
575
|
});
|
|
575
576
|
}
|
|
576
577
|
setupColumnType(columnSetupInfo) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DataSourcePropOnTreeSelectionChange_MultiNode, InfiniteTableProps, TreeDataSourceProps } from '../../InfiniteTable';
|
|
3
3
|
export type TreeListItem<T = any> = {
|
|
4
|
-
id
|
|
4
|
+
id?: string | number;
|
|
5
5
|
label: string;
|
|
6
6
|
children?: TreeListItem<T>[];
|
|
7
7
|
};
|
package/src/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
3
|
-
PUBLISH_TIMESTAMP:
|
|
4
|
-
VERSION: "22.0.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1775746119161 || Date.now(),
|
|
4
|
+
VERSION: "22.0.10" || '--current-version--',
|
|
5
5
|
};
|