@adaptabletools/adaptable 23.0.22 → 23.1.0-canary.1
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 +3 -2
- package/src/AdaptableInterfaces/IAdaptable.d.ts +37 -1
- package/src/AdaptableOptions/ColumnMenuOptions.d.ts +1 -1
- package/src/AdaptableOptions/ContextMenuOptions.d.ts +1 -1
- package/src/AdaptableOptions/FilterOptions.d.ts +22 -6
- package/src/Api/Internal/FormatColumnInternalApi.d.ts +12 -2
- package/src/Api/Internal/FormatColumnInternalApi.js +4 -0
- package/src/Redux/Store/AdaptableStore.js +20 -6
- package/src/Strategy/LayoutModule.js +4 -1
- package/src/Utilities/Helpers/StyledColumns/SparklineStyleHelper.d.ts +2 -0
- package/src/Utilities/Helpers/StyledColumns/SparklineStyleHelper.js +13 -10
- package/src/Utilities/Hooks/useAdaptableOptions.d.ts +1 -1
- package/src/Utilities/Services/AnnotationsService.js +8 -8
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.d.ts +3 -9
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +10 -6
- package/src/View/Components/PredicateEditor/PredicateEditor.js +8 -4
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +18 -8
- package/src/View/Wizard/OnePageAdaptableWizard.d.ts +2 -2
- package/src/View/Wizard/OnePageWizards.d.ts +1 -1
- package/src/agGrid/AdaptableAgGrid.d.ts +71 -10
- package/src/agGrid/AdaptableAgGrid.js +125 -88
- package/src/agGrid/AgGridAdapter.d.ts +33 -1
- package/src/agGrid/AgGridAdapter.js +91 -0
- package/src/agGrid/AgGridColumnAdapter.d.ts +68 -1
- package/src/agGrid/AgGridColumnAdapter.js +191 -73
- package/src/agGrid/AgGridMenuAdapter.d.ts +8 -2
- package/src/agGrid/AgGridMenuAdapter.js +17 -4
- package/src/agGrid/AgGridModulesAdapter.js +6 -1
- package/src/agGrid/AgGridThemeAdapter.d.ts +17 -0
- package/src/agGrid/AgGridThemeAdapter.js +37 -6
- package/src/agGrid/gridRefreshScope.d.ts +20 -0
- package/src/agGrid/gridRefreshScope.js +39 -0
- package/src/components/Radio/index.d.ts +2 -2
- package/src/devTools/DevToolsTracks.d.ts +6 -0
- package/src/devTools/DevToolsTracks.js +6 -0
- package/src/devTools/index.d.ts +25 -1
- package/src/env.js +2 -2
- package/src/layout-manager/src/index.d.ts +9 -0
- package/src/layout-manager/src/index.js +38 -17
- package/src/parser/src/types.d.ts +3 -1
- package/src/types.d.ts +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -7,12 +7,53 @@ export declare function getEditorForColumnDataType(columnDataType: AdaptableColu
|
|
|
7
7
|
export declare class AgGridColumnAdapter {
|
|
8
8
|
private adaptableInstance;
|
|
9
9
|
private colDefPropertyCache;
|
|
10
|
+
private workingColDefs;
|
|
11
|
+
private sortCacheInvalidationNeeded;
|
|
12
|
+
private stableCallbacks;
|
|
13
|
+
private stableCallbackImplementations;
|
|
14
|
+
private stableCallbackOwners;
|
|
15
|
+
private adaptableColumnFilterDef;
|
|
16
|
+
private adaptableFloatingFilterComponent;
|
|
10
17
|
constructor(adaptableInstance: AdaptableAgGrid);
|
|
11
18
|
private getVariant;
|
|
12
19
|
destroy(): void;
|
|
13
20
|
private get adaptableApi();
|
|
14
21
|
private get adaptableOptions();
|
|
15
22
|
private get agGridApi();
|
|
23
|
+
/**
|
|
24
|
+
* The colDef that `setupColumnXxx` methods should read from & write to:
|
|
25
|
+
* the working copy while the column is being set up (see #col_def_commit), the live colDef otherwise.
|
|
26
|
+
*/
|
|
27
|
+
private getColDefForSetup;
|
|
28
|
+
/**
|
|
29
|
+
* see #col_def_commit
|
|
30
|
+
* Creates the working copy of the colDef, which is committed via `commitColDefChanges`
|
|
31
|
+
*/
|
|
32
|
+
private beginColDefChanges;
|
|
33
|
+
/**
|
|
34
|
+
* see #col_def_commit
|
|
35
|
+
* Hands the working copy over to AG Grid, which re-initialises everything it caches from the colDef
|
|
36
|
+
* and refreshes the rendered cells of the column - but only if the colDef actually changed.
|
|
37
|
+
*/
|
|
38
|
+
private commitColDefChanges;
|
|
39
|
+
/**
|
|
40
|
+
* see #stable_col_def_callbacks
|
|
41
|
+
* Returns the (stable) function AG Grid should see for this column & property,
|
|
42
|
+
* delegating to the given (latest) implementation.
|
|
43
|
+
*/
|
|
44
|
+
private toStableCallback;
|
|
45
|
+
/**
|
|
46
|
+
* #pivot_result_col_def_copies_source
|
|
47
|
+
*
|
|
48
|
+
* AG Grid generates a pivot result colDef by copying the WHOLE colDef of its value (source) column
|
|
49
|
+
* (`PivotColDefService.createColDef` -> `Object.assign(colDef, valueColumn.colDef)`), and regenerates it
|
|
50
|
+
* whenever the source colDef is committed (see #col_def_commit). The copy therefore contains the
|
|
51
|
+
* callbacks Adaptable set up for the SOURCE column, which must not be mistaken for values provided by the user.
|
|
52
|
+
*
|
|
53
|
+
* When such a callback is found where a user value is expected, the user value of the source column
|
|
54
|
+
* is used instead - which is exactly what the pivot result column would have inherited from the user.
|
|
55
|
+
*/
|
|
56
|
+
private resolveUserProvidedValue;
|
|
16
57
|
setColDefProperty<T extends keyof ColDef>(col: Column, propertyName: T, propertyGetter: (userPropertyValue: ColDef[T]) => ColDef[T] | undefined): void;
|
|
17
58
|
getUserColDefProperty<T extends keyof ColDef>(columnId: string, propertyName: T): ColDef[T] | undefined;
|
|
18
59
|
shouldSkipColumn(colId: string): boolean;
|
|
@@ -22,6 +63,7 @@ export declare class AgGridColumnAdapter {
|
|
|
22
63
|
* @param specificColumnIds - optional list of column Ids to setup. If not provided, all columns are setup
|
|
23
64
|
*/
|
|
24
65
|
setupColumns(specificColumnIds?: string[]): void;
|
|
66
|
+
private setupColumn;
|
|
25
67
|
private setupColumnValueGetter;
|
|
26
68
|
private setupColumnCellClass;
|
|
27
69
|
private setupColumnHeaderClass;
|
|
@@ -45,6 +87,8 @@ export declare class AgGridColumnAdapter {
|
|
|
45
87
|
private setupColumnCellDataType;
|
|
46
88
|
setupColumnHeader({ col }: ColumnSetupInfo): void;
|
|
47
89
|
private setupColumnFilter;
|
|
90
|
+
private getAdaptableColumnFilterDef;
|
|
91
|
+
private getAdaptableFloatingFilterComponent;
|
|
48
92
|
private setupColumnFloatingFilter;
|
|
49
93
|
private setupColumnValueFormatter;
|
|
50
94
|
private setupColumnEditable;
|
|
@@ -72,6 +116,22 @@ export declare class AgGridColumnAdapter {
|
|
|
72
116
|
* The combination of styled column and format cells
|
|
73
117
|
* This function decides when the two can be merged.
|
|
74
118
|
*/
|
|
119
|
+
/**
|
|
120
|
+
* #derived_pivot_cell_style
|
|
121
|
+
*
|
|
122
|
+
* A pivot result column is generated by AG Grid for a value (base) column, so the cells of
|
|
123
|
+
* `pivot_make_Ford_rating` show (aggregated) `rating` values. Adaptable objects are defined
|
|
124
|
+
* against the base column, and its pivot result cells inherit them:
|
|
125
|
+
* - Format Columns whose Scope contains the base column style the pivot result cells, and their
|
|
126
|
+
* Rule is evaluated against the pivot result cell: in a Rule Expression `[rating]` / `$SCOPE()`
|
|
127
|
+
* resolve to the pivot result cell value (`COL` / `$SCOPE` in `scalarExpressionFunctions.ts`
|
|
128
|
+
* read `pivotResultColumn` from the evaluation context), a Rule Predicate gets it as `value`;
|
|
129
|
+
* - the Styled Column of the base column contributes its cell style (e.g. Gradient background).
|
|
130
|
+
*
|
|
131
|
+
* Returns the context when `params` describe a pivot result cell, `undefined` otherwise.
|
|
132
|
+
* This is the single place deriving it; everything below `setupColumnCellStyle` receives it explicitly.
|
|
133
|
+
*/
|
|
134
|
+
private getPivotResultCellContext;
|
|
75
135
|
private getFormatColumnAndStyledColumnCellStyle;
|
|
76
136
|
/**
|
|
77
137
|
* Returns true when the active Styled Column declares a `Font` slot
|
|
@@ -92,7 +152,14 @@ export declare class AgGridColumnAdapter {
|
|
|
92
152
|
private styledColumnClaimsCellBoxStyle;
|
|
93
153
|
private getFormatColumnHeaderStyle;
|
|
94
154
|
private getStyledColumnStyle;
|
|
95
|
-
|
|
155
|
+
/**
|
|
156
|
+
* The given (in scope) Format Columns whose Rule matches the cell.
|
|
157
|
+
*
|
|
158
|
+
* @param abColumn - the column the Format Columns are scoped to: the cell's column, or its base column
|
|
159
|
+
* for a pivot result cell inheriting base column Format Columns (see #derived_pivot_cell_style)
|
|
160
|
+
* @param pivotResultColumn - set when the cell is a pivot result cell, see #derived_pivot_cell_style
|
|
161
|
+
*/
|
|
162
|
+
private getRelevantFormatColumnsForCell;
|
|
96
163
|
private getFormatColumnAdaptableStyle;
|
|
97
164
|
private getAlertCellStyle;
|
|
98
165
|
private getFlashingCellStyle;
|
|
@@ -49,6 +49,22 @@ const stripCssKeys = (style, keys) => {
|
|
|
49
49
|
};
|
|
50
50
|
const stripFontCssKeys = (style) => stripCssKeys(style, FONT_CSS_KEYS);
|
|
51
51
|
const stripCellBoxCssKeys = (style) => stripCssKeys(style, CELL_BOX_CSS_KEYS);
|
|
52
|
+
const STABLE_CALLBACK_COL_DEF_PROPERTIES = new Set([
|
|
53
|
+
'cellStyle',
|
|
54
|
+
'cellClass',
|
|
55
|
+
'headerStyle',
|
|
56
|
+
'headerClass',
|
|
57
|
+
'valueGetter',
|
|
58
|
+
'valueFormatter',
|
|
59
|
+
'valueSetter',
|
|
60
|
+
'editable',
|
|
61
|
+
'comparator',
|
|
62
|
+
'pivotComparator',
|
|
63
|
+
'getFindText',
|
|
64
|
+
'getQuickFilterText',
|
|
65
|
+
'tooltipValueGetter',
|
|
66
|
+
'cellEditorParams',
|
|
67
|
+
]);
|
|
52
68
|
export function getEditorForColumnDataType(columnDataType, variant) {
|
|
53
69
|
if (columnDataType === 'number') {
|
|
54
70
|
return variant === 'react' ? AdaptableReactNumberEditor : AdaptableNumberEditor;
|
|
@@ -60,9 +76,20 @@ export function getEditorForColumnDataType(columnDataType, variant) {
|
|
|
60
76
|
export class AgGridColumnAdapter {
|
|
61
77
|
adaptableInstance;
|
|
62
78
|
colDefPropertyCache;
|
|
79
|
+
workingColDefs;
|
|
80
|
+
sortCacheInvalidationNeeded = false;
|
|
81
|
+
stableCallbacks;
|
|
82
|
+
stableCallbackImplementations;
|
|
83
|
+
stableCallbackOwners;
|
|
84
|
+
adaptableColumnFilterDef;
|
|
85
|
+
adaptableFloatingFilterComponent;
|
|
63
86
|
constructor(adaptableInstance) {
|
|
64
87
|
this.adaptableInstance = adaptableInstance;
|
|
65
88
|
this.colDefPropertyCache = new Map();
|
|
89
|
+
this.workingColDefs = new Map();
|
|
90
|
+
this.stableCallbacks = new Map();
|
|
91
|
+
this.stableCallbackImplementations = new Map();
|
|
92
|
+
this.stableCallbackOwners = new WeakMap();
|
|
66
93
|
}
|
|
67
94
|
getVariant() {
|
|
68
95
|
return this.adaptableInstance.variant;
|
|
@@ -71,6 +98,15 @@ export class AgGridColumnAdapter {
|
|
|
71
98
|
this.adaptableInstance = null;
|
|
72
99
|
this.colDefPropertyCache.clear();
|
|
73
100
|
this.colDefPropertyCache = null;
|
|
101
|
+
this.workingColDefs.clear();
|
|
102
|
+
this.workingColDefs = null;
|
|
103
|
+
this.stableCallbacks.clear();
|
|
104
|
+
this.stableCallbacks = null;
|
|
105
|
+
this.stableCallbackImplementations.clear();
|
|
106
|
+
this.stableCallbackImplementations = null;
|
|
107
|
+
this.stableCallbackOwners = null;
|
|
108
|
+
this.adaptableColumnFilterDef = null;
|
|
109
|
+
this.adaptableFloatingFilterComponent = null;
|
|
74
110
|
}
|
|
75
111
|
get adaptableApi() {
|
|
76
112
|
return this.adaptableInstance.api;
|
|
@@ -81,9 +117,55 @@ export class AgGridColumnAdapter {
|
|
|
81
117
|
get agGridApi() {
|
|
82
118
|
return this.adaptableApi.agGridApi;
|
|
83
119
|
}
|
|
120
|
+
getColDefForSetup(col) {
|
|
121
|
+
return this.workingColDefs.get(col.getColId()) ?? col.getColDef();
|
|
122
|
+
}
|
|
123
|
+
beginColDefChanges(col) {
|
|
124
|
+
const workingColDef = { ...col.getColDef() };
|
|
125
|
+
this.workingColDefs.set(col.getColId(), workingColDef);
|
|
126
|
+
return workingColDef;
|
|
127
|
+
}
|
|
128
|
+
commitColDefChanges(col) {
|
|
129
|
+
const colId = col.getColId();
|
|
130
|
+
const workingColDef = this.workingColDefs.get(colId);
|
|
131
|
+
this.workingColDefs.delete(colId);
|
|
132
|
+
if (!workingColDef) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const agColumn = col;
|
|
136
|
+
if (typeof agColumn.setColDef !== 'function') {
|
|
137
|
+
errorOnce(`CRITICAL: AG Grid 'AgColumn.setColDef()' is not available, Adaptable cannot commit column definition changes! (see #col_def_commit)`);
|
|
138
|
+
Object.assign(col.getColDef(), workingColDef);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
agColumn.setColDef(workingColDef, col.getUserProvidedColDef(), 'api');
|
|
142
|
+
}
|
|
143
|
+
toStableCallback(colId, propertyName, implementation) {
|
|
144
|
+
const key = `${colId}.${propertyName}`;
|
|
145
|
+
this.stableCallbackImplementations.set(key, implementation);
|
|
146
|
+
let stableCallback = this.stableCallbacks.get(key);
|
|
147
|
+
if (!stableCallback) {
|
|
148
|
+
stableCallback = (...args) => {
|
|
149
|
+
return this.stableCallbackImplementations?.get(key)?.(...args);
|
|
150
|
+
};
|
|
151
|
+
this.stableCallbacks.set(key, stableCallback);
|
|
152
|
+
this.stableCallbackOwners.set(stableCallback, { colId, propertyName });
|
|
153
|
+
}
|
|
154
|
+
return stableCallback;
|
|
155
|
+
}
|
|
156
|
+
resolveUserProvidedValue(propertyName, value) {
|
|
157
|
+
if (typeof value !== 'function') {
|
|
158
|
+
return value;
|
|
159
|
+
}
|
|
160
|
+
const owner = this.stableCallbackOwners.get(value);
|
|
161
|
+
if (!owner) {
|
|
162
|
+
return value;
|
|
163
|
+
}
|
|
164
|
+
return this.colDefPropertyCache.get(`user.${owner.colId}.${propertyName}`);
|
|
165
|
+
}
|
|
84
166
|
setColDefProperty(col, propertyName, propertyGetter) {
|
|
85
167
|
const colId = col.getColId();
|
|
86
|
-
const colDef =
|
|
168
|
+
const colDef = this.getColDefForSetup(col);
|
|
87
169
|
const colSetupInfo = {
|
|
88
170
|
col,
|
|
89
171
|
colDef,
|
|
@@ -94,10 +176,15 @@ export class AgGridColumnAdapter {
|
|
|
94
176
|
const value = colDef[propertyName];
|
|
95
177
|
const isUserDefined = value !== this.colDefPropertyCache.get(adaptableKey);
|
|
96
178
|
if (isUserDefined) {
|
|
97
|
-
this.colDefPropertyCache.set(userKey, value);
|
|
179
|
+
this.colDefPropertyCache.set(userKey, this.resolveUserProvidedValue(propertyName, value));
|
|
98
180
|
}
|
|
99
181
|
const userValue = this.colDefPropertyCache.get(userKey);
|
|
100
|
-
|
|
182
|
+
let adaptableValue = propertyGetter(userValue);
|
|
183
|
+
if (typeof adaptableValue === 'function' &&
|
|
184
|
+
adaptableValue !== userValue &&
|
|
185
|
+
STABLE_CALLBACK_COL_DEF_PROPERTIES.has(propertyName)) {
|
|
186
|
+
adaptableValue = this.toStableCallback(colId, propertyName, adaptableValue);
|
|
187
|
+
}
|
|
101
188
|
if (adaptableValue != null) {
|
|
102
189
|
this.colDefPropertyCache.set(adaptableKey, adaptableValue);
|
|
103
190
|
}
|
|
@@ -115,7 +202,12 @@ export class AgGridColumnAdapter {
|
|
|
115
202
|
if (theValue === undefined && colDef[propertyName] === undefined) {
|
|
116
203
|
return;
|
|
117
204
|
}
|
|
205
|
+
const previousValue = colDef[propertyName];
|
|
118
206
|
colDef[propertyName] = theValue;
|
|
207
|
+
if ((propertyName === 'comparator' || propertyName === 'pivotComparator') &&
|
|
208
|
+
previousValue !== theValue) {
|
|
209
|
+
this.sortCacheInvalidationNeeded = true;
|
|
210
|
+
}
|
|
119
211
|
}
|
|
120
212
|
getUserColDefProperty(columnId, propertyName) {
|
|
121
213
|
const userKey = `user.${columnId}.${propertyName}`;
|
|
@@ -148,42 +240,54 @@ export class AgGridColumnAdapter {
|
|
|
148
240
|
cols = cols.filter((col) => specificColumnIds.includes(col.getColId()));
|
|
149
241
|
}
|
|
150
242
|
cols.forEach((col) => {
|
|
151
|
-
const colDef = col.getColDef();
|
|
152
243
|
const colId = col.getColId();
|
|
153
244
|
if (this.shouldSkipColumn(colId)) {
|
|
154
245
|
return;
|
|
155
246
|
}
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
col,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
};
|
|
163
|
-
const isAutoRowGroupColumn = this.adaptableApi.columnApi.isAutoRowGroupColumn(colId);
|
|
164
|
-
this.setupColumnCellRenderer(colSetupInfo);
|
|
165
|
-
this.setupColumnCellStyle(colSetupInfo);
|
|
166
|
-
this.setupColumnCellClass(colSetupInfo);
|
|
167
|
-
this.setupColumnHeaderStyle(colSetupInfo);
|
|
168
|
-
this.setupColumnHeaderClass(colSetupInfo);
|
|
169
|
-
this.setupColumnValueGetter(colSetupInfo);
|
|
170
|
-
this.setupColumnTooltipValueGetter(colSetupInfo);
|
|
171
|
-
if (!isAutoRowGroupColumn) {
|
|
172
|
-
this.setupColumnFilter(colSetupInfo);
|
|
173
|
-
this.setupColumnFloatingFilter(colSetupInfo);
|
|
247
|
+
const colDef = this.beginColDefChanges(col);
|
|
248
|
+
try {
|
|
249
|
+
this.setupColumn({ col, colDef, colId });
|
|
250
|
+
}
|
|
251
|
+
finally {
|
|
252
|
+
this.commitColDefChanges(col);
|
|
174
253
|
}
|
|
175
|
-
this.setupColumnValueFormatter(colSetupInfo);
|
|
176
|
-
this.setupColumnEditable(colSetupInfo);
|
|
177
|
-
this.setupColumnValueSetter(colSetupInfo);
|
|
178
|
-
this.setupColumnComparator(colSetupInfo);
|
|
179
|
-
this.setupColumnGetFindText(colSetupInfo);
|
|
180
|
-
this.setupColumnCellEditor(colSetupInfo);
|
|
181
|
-
this.setupColumnHeader(colSetupInfo);
|
|
182
|
-
this.setupColumnQuickFilterText(colSetupInfo);
|
|
183
|
-
this.setupColumnAllowedAggFuncs(colSetupInfo);
|
|
184
|
-
this.setupColumnType(colSetupInfo);
|
|
185
|
-
this.setupColumnCellDataType(colSetupInfo);
|
|
186
254
|
});
|
|
255
|
+
if (this.sortCacheInvalidationNeeded) {
|
|
256
|
+
this.sortCacheInvalidationNeeded = false;
|
|
257
|
+
this.adaptableInstance.agGridAdapter?.DANGER_invalidateSortCache();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
setupColumn({ col, colDef, colId }) {
|
|
261
|
+
const abColumn = this.adaptableApi.columnApi.getColumnWithColumnId(colId);
|
|
262
|
+
const colSetupInfo = {
|
|
263
|
+
col,
|
|
264
|
+
colDef,
|
|
265
|
+
colId,
|
|
266
|
+
abColumn,
|
|
267
|
+
};
|
|
268
|
+
const isAutoRowGroupColumn = this.adaptableApi.columnApi.isAutoRowGroupColumn(colId);
|
|
269
|
+
this.setupColumnCellRenderer(colSetupInfo);
|
|
270
|
+
this.setupColumnCellStyle(colSetupInfo);
|
|
271
|
+
this.setupColumnCellClass(colSetupInfo);
|
|
272
|
+
this.setupColumnHeaderStyle(colSetupInfo);
|
|
273
|
+
this.setupColumnHeaderClass(colSetupInfo);
|
|
274
|
+
this.setupColumnValueGetter(colSetupInfo);
|
|
275
|
+
this.setupColumnTooltipValueGetter(colSetupInfo);
|
|
276
|
+
if (!isAutoRowGroupColumn) {
|
|
277
|
+
this.setupColumnFilter(colSetupInfo);
|
|
278
|
+
this.setupColumnFloatingFilter(colSetupInfo);
|
|
279
|
+
}
|
|
280
|
+
this.setupColumnValueFormatter(colSetupInfo);
|
|
281
|
+
this.setupColumnEditable(colSetupInfo);
|
|
282
|
+
this.setupColumnValueSetter(colSetupInfo);
|
|
283
|
+
this.setupColumnComparator(colSetupInfo);
|
|
284
|
+
this.setupColumnGetFindText(colSetupInfo);
|
|
285
|
+
this.setupColumnCellEditor(colSetupInfo);
|
|
286
|
+
this.setupColumnHeader(colSetupInfo);
|
|
287
|
+
this.setupColumnQuickFilterText(colSetupInfo);
|
|
288
|
+
this.setupColumnAllowedAggFuncs(colSetupInfo);
|
|
289
|
+
this.setupColumnType(colSetupInfo);
|
|
290
|
+
this.setupColumnCellDataType(colSetupInfo);
|
|
187
291
|
}
|
|
188
292
|
setupColumnValueGetter({ col }) {
|
|
189
293
|
this.setColDefProperty(col, 'valueGetter', (userValue) => {
|
|
@@ -358,31 +462,14 @@ export class AgGridColumnAdapter {
|
|
|
358
462
|
const textStyleToApply = isCurrentMatch
|
|
359
463
|
? { ...textMatchStyle, ...currentTextMatchStyle }
|
|
360
464
|
: textMatchStyle;
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
const baseColumn = params.column.getColDef()?.pivotValueColumn;
|
|
364
|
-
if (baseColumn) {
|
|
365
|
-
const baseColDefCellStyle = baseColumn?.getColDef()?.cellStyle;
|
|
366
|
-
const baseColParams = {
|
|
367
|
-
...params,
|
|
368
|
-
column: baseColumn,
|
|
369
|
-
__pivotResultColumn: params.column,
|
|
370
|
-
};
|
|
371
|
-
baseStyles =
|
|
372
|
-
typeof baseColDefCellStyle === 'function'
|
|
373
|
-
? baseColDefCellStyle(baseColParams)
|
|
374
|
-
: baseColDefCellStyle;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
else {
|
|
378
|
-
baseStyles = typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle;
|
|
379
|
-
}
|
|
465
|
+
const baseStyles = typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle;
|
|
466
|
+
const pivotResultCell = this.getPivotResultCellContext(params);
|
|
380
467
|
const result = {
|
|
381
468
|
...baseStyles,
|
|
382
469
|
...this.getReadOnlyCellStyle(gridCell, params),
|
|
383
470
|
...this.getEditableCellStyle(gridCell, params),
|
|
384
471
|
...this.getEditedCellStyle(gridCell, params),
|
|
385
|
-
...this.getFormatColumnAndStyledColumnCellStyle(gridCell.column, params),
|
|
472
|
+
...this.getFormatColumnAndStyledColumnCellStyle(gridCell.column, params, pivotResultCell),
|
|
386
473
|
...(isQuickSearchActive ? quickSearchStyle : {}),
|
|
387
474
|
...(isQuickSearchActive && textStyleToApply ? textStyleToApply : {}),
|
|
388
475
|
...this.getAlertCellStyle(gridCell, params),
|
|
@@ -744,11 +831,23 @@ export class AgGridColumnAdapter {
|
|
|
744
831
|
this.adaptableApi.consoleError(`Column "${colId}" has a custom filter in colDef.filter, but Adaptable filtering only accepts boolean (true/false) values for this property.`);
|
|
745
832
|
return false;
|
|
746
833
|
}
|
|
747
|
-
return
|
|
834
|
+
return this.getAdaptableColumnFilterDef();
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
getAdaptableColumnFilterDef() {
|
|
838
|
+
if (!this.adaptableColumnFilterDef) {
|
|
839
|
+
this.adaptableColumnFilterDef = {
|
|
748
840
|
component: AgGridFilterAdapterFactory(this.adaptableInstance),
|
|
749
841
|
handler: () => new AdaptableFilterHandler(this.adaptableApi),
|
|
750
842
|
};
|
|
751
|
-
}
|
|
843
|
+
}
|
|
844
|
+
return this.adaptableColumnFilterDef;
|
|
845
|
+
}
|
|
846
|
+
getAdaptableFloatingFilterComponent() {
|
|
847
|
+
if (!this.adaptableFloatingFilterComponent) {
|
|
848
|
+
this.adaptableFloatingFilterComponent = AgGridFloatingFilterAdapterFactory(this.adaptableInstance);
|
|
849
|
+
}
|
|
850
|
+
return this.adaptableFloatingFilterComponent;
|
|
752
851
|
}
|
|
753
852
|
setupColumnFloatingFilter({ col, colDef }) {
|
|
754
853
|
const userProvidedFilterProp = this.getUserColDefProperty(col.getColId(), 'filter');
|
|
@@ -775,13 +874,13 @@ export class AgGridColumnAdapter {
|
|
|
775
874
|
if (isFloatingFilterDisabled) {
|
|
776
875
|
return;
|
|
777
876
|
}
|
|
778
|
-
return
|
|
877
|
+
return this.getAdaptableFloatingFilterComponent();
|
|
779
878
|
});
|
|
780
879
|
this.setColDefProperty(col, 'floatingFilter', () => {
|
|
781
880
|
if (isFloatingFilterDisabled) {
|
|
782
881
|
return;
|
|
783
882
|
}
|
|
784
|
-
return
|
|
883
|
+
return this.getAdaptableFloatingFilterComponent();
|
|
785
884
|
});
|
|
786
885
|
this.setColDefProperty(col, 'suppressFloatingFilterButton', () => {
|
|
787
886
|
return !isFloatingFilterDisabled;
|
|
@@ -1201,21 +1300,44 @@ export class AgGridColumnAdapter {
|
|
|
1201
1300
|
}
|
|
1202
1301
|
return undefined;
|
|
1203
1302
|
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1303
|
+
getPivotResultCellContext(params) {
|
|
1304
|
+
if (!this.adaptableApi.columnApi.isPivotResultColumn(params.column.getColId())) {
|
|
1305
|
+
return undefined;
|
|
1306
|
+
}
|
|
1307
|
+
const baseAgColumn = params.column.getColDef()?.pivotValueColumn;
|
|
1308
|
+
const baseColumn = baseAgColumn
|
|
1309
|
+
? this.adaptableApi.columnApi.getColumnWithColumnId(baseAgColumn.getColId())
|
|
1310
|
+
: undefined;
|
|
1311
|
+
if (!baseColumn) {
|
|
1312
|
+
return undefined;
|
|
1313
|
+
}
|
|
1314
|
+
return { pivotResultColumn: params.column, baseColumn };
|
|
1315
|
+
}
|
|
1316
|
+
getFormatColumnAndStyledColumnCellStyle(column, params, pivotResultCell) {
|
|
1317
|
+
let styledColumn = this.adaptableApi.styledColumnApi.getStyledColumnForColumnId(column.columnId);
|
|
1318
|
+
let styledColumnColumn = column;
|
|
1319
|
+
if (!styledColumn && pivotResultCell) {
|
|
1320
|
+
styledColumn = this.adaptableApi.styledColumnApi.getStyledColumnForColumnId(pivotResultCell.baseColumn.columnId);
|
|
1321
|
+
styledColumnColumn = pivotResultCell.baseColumn;
|
|
1322
|
+
}
|
|
1206
1323
|
const styledColumnIsActive = !!styledColumn && !styledColumn?.IsSuspended;
|
|
1207
1324
|
const styledColumnStyle = styledColumnIsActive
|
|
1208
|
-
? this.getStyledColumnStyle(styledColumn,
|
|
1325
|
+
? this.getStyledColumnStyle(styledColumn, styledColumnColumn, params)
|
|
1209
1326
|
: {};
|
|
1210
|
-
const
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1327
|
+
const formatColumnInternalApi = this.adaptableApi.formatColumnApi.internalApi;
|
|
1328
|
+
const relevantFormatColumnsWithStyle = this.getRelevantFormatColumnsForCell(column, formatColumnInternalApi.getFormatColumnsWithStyleForColumn(column, { target: 'cell' }), params, pivotResultCell?.pivotResultColumn);
|
|
1329
|
+
if (pivotResultCell) {
|
|
1330
|
+
const baseFormatColumnsWithStyle = formatColumnInternalApi
|
|
1331
|
+
.getFormatColumnsWithStyleForColumn(pivotResultCell.baseColumn, { target: 'cell' })
|
|
1332
|
+
.filter((formatColumn) => !relevantFormatColumnsWithStyle.includes(formatColumn));
|
|
1333
|
+
relevantFormatColumnsWithStyle.push(...this.getRelevantFormatColumnsForCell(pivotResultCell.baseColumn, baseFormatColumnsWithStyle, params, pivotResultCell.pivotResultColumn));
|
|
1334
|
+
}
|
|
1335
|
+
let formatColumnStyle = this.getFormatColumnAdaptableStyle(relevantFormatColumnsWithStyle);
|
|
1214
1336
|
if (styledColumnIsActive) {
|
|
1215
|
-
if (this.styledColumnClaimsFontStyle(styledColumn,
|
|
1337
|
+
if (this.styledColumnClaimsFontStyle(styledColumn, styledColumnColumn)) {
|
|
1216
1338
|
formatColumnStyle = stripFontCssKeys(formatColumnStyle);
|
|
1217
1339
|
}
|
|
1218
|
-
if (this.styledColumnClaimsCellBoxStyle(styledColumn,
|
|
1340
|
+
if (this.styledColumnClaimsCellBoxStyle(styledColumn, styledColumnColumn)) {
|
|
1219
1341
|
formatColumnStyle = stripCellBoxCssKeys(formatColumnStyle);
|
|
1220
1342
|
}
|
|
1221
1343
|
}
|
|
@@ -1328,14 +1450,10 @@ export class AgGridColumnAdapter {
|
|
|
1328
1450
|
}
|
|
1329
1451
|
return style;
|
|
1330
1452
|
}
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
return
|
|
1334
|
-
}
|
|
1335
|
-
const relevantFormatColumnsWithStyle = activeFormatColumnsWithStyle.filter((formatColumn) => {
|
|
1336
|
-
return this.adaptableApi.formatColumnApi.internalApi.formatColumnShouldRenderInCell(formatColumn, abColumn, params.node, params.value, params.__pivotResultColumn);
|
|
1453
|
+
getRelevantFormatColumnsForCell(abColumn, activeFormatColumnsWithStyle, params, pivotResultColumn) {
|
|
1454
|
+
return activeFormatColumnsWithStyle.filter((formatColumn) => {
|
|
1455
|
+
return this.adaptableApi.formatColumnApi.internalApi.formatColumnShouldRenderInCell(formatColumn, abColumn, params.node, params.value, pivotResultColumn);
|
|
1337
1456
|
});
|
|
1338
|
-
return this.getFormatColumnAdaptableStyle(relevantFormatColumnsWithStyle);
|
|
1339
1457
|
}
|
|
1340
1458
|
getFormatColumnAdaptableStyle(formatColumns) {
|
|
1341
1459
|
return formatColumns.reduceRight((style, formatColumn) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AdaptableAgGrid } from './AdaptableAgGrid';
|
|
2
|
-
import { DefaultMenuItem, GetContextMenuItems, GetContextMenuItemsParams, GetMainMenuItems, GetMainMenuItemsParams, MenuItemDef } from 'ag-grid-enterprise';
|
|
2
|
+
import { DefaultMenuItem, GetContextMenuItems, GetContextMenuItemsParams, GetColumnMenuItemsParams, GetMainMenuItems, GetMainMenuItemsParams, MenuItemDef } from 'ag-grid-enterprise';
|
|
3
3
|
import { AdaptableColumn } from '../AdaptableState/Common/AdaptableColumn';
|
|
4
4
|
import { AdaptableMenuItem } from '../AdaptableState/Common/Menu';
|
|
5
5
|
export declare class AgGridMenuAdapter {
|
|
@@ -8,8 +8,14 @@ export declare class AgGridMenuAdapter {
|
|
|
8
8
|
private get adaptableOptions();
|
|
9
9
|
private get adaptableApi();
|
|
10
10
|
destroy(): void;
|
|
11
|
-
buildColumnMenu(params: GetMainMenuItemsParams,
|
|
11
|
+
buildColumnMenu(params: GetMainMenuItemsParams | GetColumnMenuItemsParams, _originalGetMainMenuItems?: GetMainMenuItems): (DefaultMenuItem | MenuItemDef)[];
|
|
12
|
+
/**
|
|
13
|
+
* Columns Tool Panel / Column Chooser (AG Grid 36.1 `getColumnMenuItems`).
|
|
14
|
+
* Phase 1 only strips dual-UI items; AdapTable items are added in Phase 2.
|
|
15
|
+
*/
|
|
16
|
+
buildColumnsToolPanelMenu(params: GetColumnMenuItemsParams): (DefaultMenuItem | MenuItemDef)[];
|
|
12
17
|
buildContextMenu(params: GetContextMenuItemsParams, originalGetContextMenuItems: GetContextMenuItems): (DefaultMenuItem | MenuItemDef)[];
|
|
18
|
+
private filterSuppressedAgGridDualUiMenuItems;
|
|
13
19
|
private mapAgGridItemTypeToAgGridMenuItem;
|
|
14
20
|
private removeConsecutiveSeparators;
|
|
15
21
|
private createColumnMenuContextObject;
|
|
@@ -3,6 +3,13 @@ import { iconToString } from '../components/icons';
|
|
|
3
3
|
import ArrayExtensions from '../Utilities/Extensions/ArrayExtensions';
|
|
4
4
|
import { MENU_SEPARATOR } from '../Utilities/Constants/GeneralConstants';
|
|
5
5
|
import { getAggFuncName, getDisplayAggFuncNames, isWeightedAverageAggregation, WEIGHTED_AVERAGE_AGG_FN_NAME, } from '../AdaptableState/Common/AggregationColumns';
|
|
6
|
+
const AG_GRID_DUAL_UI_MENU_ITEMS = new Set([
|
|
7
|
+
'calculatedColumn',
|
|
8
|
+
'editCalculatedColumn',
|
|
9
|
+
'removeCalculatedColumn',
|
|
10
|
+
'editColumnName',
|
|
11
|
+
'showValuesAsSubMenu',
|
|
12
|
+
]);
|
|
6
13
|
function createAgGridIcon(name) {
|
|
7
14
|
const element = document.createElement('span');
|
|
8
15
|
element.className = `ag-icon ag-icon-${name}`;
|
|
@@ -114,8 +121,8 @@ export class AgGridMenuAdapter {
|
|
|
114
121
|
destroy() {
|
|
115
122
|
this._adaptableInstance = null;
|
|
116
123
|
}
|
|
117
|
-
buildColumnMenu(params,
|
|
118
|
-
const agGridMenuItems = (params.defaultItems ? [...params.defaultItems] : []);
|
|
124
|
+
buildColumnMenu(params, _originalGetMainMenuItems) {
|
|
125
|
+
const agGridMenuItems = this.filterSuppressedAgGridDualUiMenuItems(params.defaultItems ? [...params.defaultItems] : []);
|
|
119
126
|
if (!params.column) {
|
|
120
127
|
return agGridMenuItems;
|
|
121
128
|
}
|
|
@@ -158,18 +165,21 @@ export class AgGridMenuAdapter {
|
|
|
158
165
|
];
|
|
159
166
|
return this.removeConsecutiveSeparators(defaultContextMenu);
|
|
160
167
|
}
|
|
168
|
+
buildColumnsToolPanelMenu(params) {
|
|
169
|
+
return this.removeConsecutiveSeparators(this.filterSuppressedAgGridDualUiMenuItems(params.defaultItems ? [...params.defaultItems] : []));
|
|
170
|
+
}
|
|
161
171
|
buildContextMenu(params, originalGetContextMenuItems) {
|
|
162
172
|
if (!params.column) {
|
|
163
173
|
return [];
|
|
164
174
|
}
|
|
165
175
|
if (!this.adaptableApi.userInterfaceApi.isAdaptableUIVisible()) {
|
|
166
|
-
return (params.defaultItems ? [...params.defaultItems] : []);
|
|
176
|
+
return this.filterSuppressedAgGridDualUiMenuItems(params.defaultItems ? [...params.defaultItems] : []);
|
|
167
177
|
}
|
|
168
178
|
this._adaptableInstance.refreshSelectedCellsState();
|
|
169
179
|
const contextMenuOptions = this.adaptableOptions.contextMenuOptions;
|
|
170
180
|
const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId(params.column?.getColId());
|
|
171
181
|
const menuContext = this.createContextMenuContextObject(params, adaptableColumn);
|
|
172
|
-
const agGridMenuItems = (params.defaultItems ? [...params.defaultItems] : []);
|
|
182
|
+
const agGridMenuItems = this.filterSuppressedAgGridDualUiMenuItems(params.defaultItems ? [...params.defaultItems] : []);
|
|
173
183
|
const agGridCopyItems = agGridMenuItems.filter((item) => ['copy', 'copyWithHeaders', 'copyWithGroupHeaders', 'cut', 'paste'].includes(item));
|
|
174
184
|
const otherAgGridItems = agGridMenuItems.filter((item) => !agGridCopyItems.includes(item) &&
|
|
175
185
|
!['export', 'csvExport', 'excelExport'].includes(item));
|
|
@@ -213,6 +223,9 @@ export class AgGridMenuAdapter {
|
|
|
213
223
|
];
|
|
214
224
|
return this.removeConsecutiveSeparators(defaultContextMenu);
|
|
215
225
|
}
|
|
226
|
+
filterSuppressedAgGridDualUiMenuItems(items) {
|
|
227
|
+
return items.filter((item) => typeof item !== 'string' || !AG_GRID_DUAL_UI_MENU_ITEMS.has(item));
|
|
228
|
+
}
|
|
216
229
|
mapAgGridItemTypeToAgGridMenuItem(itemName) {
|
|
217
230
|
return {
|
|
218
231
|
menuType: 'AgGrid',
|
|
@@ -17,6 +17,12 @@ export class AgGridModulesAdapter {
|
|
|
17
17
|
return this.adaptableInstance.agGridAdapter.getAgGridApi();
|
|
18
18
|
}
|
|
19
19
|
isAgGridModuleRegistered(moduleName) {
|
|
20
|
+
if (moduleName === 'ClientSideRowModelModule') {
|
|
21
|
+
const rowModelType = this.agGridApi.getGridOption('rowModelType');
|
|
22
|
+
if (rowModelType == null || rowModelType === 'clientSide') {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
20
26
|
let isModuleRegistered = this.agGridApi.isModuleRegistered(moduleName);
|
|
21
27
|
if (!isModuleRegistered) {
|
|
22
28
|
const serverSideDependencies = [
|
|
@@ -61,7 +67,6 @@ export class AgGridModulesAdapter {
|
|
|
61
67
|
mandatoryModules.push('ViewportRowModelModule');
|
|
62
68
|
break;
|
|
63
69
|
default:
|
|
64
|
-
mandatoryModules.push('ClientSideRowModelModule');
|
|
65
70
|
mandatoryModules.push('ClientSideRowModelApiModule');
|
|
66
71
|
}
|
|
67
72
|
mandatoryModules.push('CellApiModule', 'CellStyleModule', 'ColumnApiModule', 'ColumnMenuModule', 'ContextMenuModule', 'CustomFilterModule', 'EventApiModule', 'ExternalFilterModule', 'GridStateModule', 'GroupFilterModule', 'RenderApiModule', 'RowApiModule', 'RowGroupingModule', 'RowStyleModule', 'ScrollApiModule');
|
|
@@ -13,7 +13,24 @@ export declare class AgGridThemeAdapter {
|
|
|
13
13
|
applyAgGridThemeOnAdaptableThemeChange(adaptableTheme: AdaptableTheme, variantTheme: string, agGridContainer: HTMLElement, themesToRemove: AdaptableTheme[]): void;
|
|
14
14
|
private getAgGridContainerElement;
|
|
15
15
|
private legacy_applyAgGridThemeOnAdaptableThemeChange;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the space-separated `ag-theme-*` class names which have to be applied to elements rendered
|
|
18
|
+
* OUTSIDE the grid DOM (e.g. AdapTable popups/tooltips portaled to `document.body`) so that they
|
|
19
|
+
* pick up the AG Grid theme.
|
|
20
|
+
*
|
|
21
|
+
* - legacy theme mode: the `ag-theme-<name>` class of the grid container
|
|
22
|
+
* - Theming API: the `ag-theme-inherit-N` + `ag-theme-<part>-N ... ag-theme-params-N` classes
|
|
23
|
+
* AG Grid 36 applies on the grid-owned `.ag-styled-root` wrappers around the grid
|
|
24
|
+
*/
|
|
16
25
|
getAgGridCurrentThemeClassNames(): string;
|
|
26
|
+
/**
|
|
27
|
+
* AG Grid 36+ wraps the grid in three grid-owned `div.ag-styled-root` elements
|
|
28
|
+
* (outer: `ag-theme-inherit-N`, middle: `ag-theme-<part>-N ... ag-theme-params-N`, inner: `ag-ltr|ag-rtl`);
|
|
29
|
+
* `AgGridAdapter.getAgGridRootElement()` is the innermost one.
|
|
30
|
+
* Collects the `ag-theme-*` classes of these wrappers (direction classes are skipped).
|
|
31
|
+
*/
|
|
32
|
+
private getThemeClassNamesFromStyledRoots;
|
|
33
|
+
private getThemeClassNamesFromThemeInternals;
|
|
17
34
|
private getAgGridLightThemeName;
|
|
18
35
|
private legacy_getAgGridCurrentThemeClassNames;
|
|
19
36
|
}
|
|
@@ -74,15 +74,46 @@ export class AgGridThemeAdapter {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
getAgGridCurrentThemeClassNames() {
|
|
77
|
-
if (this.agGridThemeMode === 'legacy') {
|
|
78
|
-
this.legacy_getAgGridCurrentThemeClassNames();
|
|
79
|
-
}
|
|
80
77
|
const currentAgGridTheme = this._adaptableInstance.agGridAdapter.getGridOption('theme');
|
|
81
|
-
if (currentAgGridTheme === 'legacy') {
|
|
78
|
+
if (this.agGridThemeMode === 'legacy' || currentAgGridTheme === 'legacy') {
|
|
82
79
|
return this.legacy_getAgGridCurrentThemeClassNames();
|
|
83
80
|
}
|
|
84
|
-
const
|
|
85
|
-
|
|
81
|
+
const classNamesFromDom = this.getThemeClassNamesFromStyledRoots();
|
|
82
|
+
if (classNamesFromDom) {
|
|
83
|
+
return classNamesFromDom;
|
|
84
|
+
}
|
|
85
|
+
return this.getThemeClassNamesFromThemeInternals(currentAgGridTheme);
|
|
86
|
+
}
|
|
87
|
+
getThemeClassNamesFromStyledRoots() {
|
|
88
|
+
const gridRoot = this._adaptableInstance.agGridAdapter.getAgGridRootElement();
|
|
89
|
+
const themeClassNames = [];
|
|
90
|
+
let element = gridRoot ?? null;
|
|
91
|
+
while (element && element.classList?.contains('ag-styled-root')) {
|
|
92
|
+
element.classList.forEach((cls) => {
|
|
93
|
+
if (cls.indexOf('ag-theme-') === 0) {
|
|
94
|
+
themeClassNames.push(cls);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
element = element.parentElement;
|
|
98
|
+
}
|
|
99
|
+
return themeClassNames.join(' ');
|
|
100
|
+
}
|
|
101
|
+
getThemeClassNamesFromThemeInternals(theme) {
|
|
102
|
+
if (!theme || typeof theme === 'string') {
|
|
103
|
+
return '';
|
|
104
|
+
}
|
|
105
|
+
const themeInternals = theme;
|
|
106
|
+
let cssClasses;
|
|
107
|
+
try {
|
|
108
|
+
cssClasses = themeInternals._getCssClasses?.() ?? themeInternals._cssClassCache;
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
cssClasses = themeInternals._cssClassCache;
|
|
112
|
+
}
|
|
113
|
+
if (Array.isArray(cssClasses)) {
|
|
114
|
+
return cssClasses.filter(Boolean).join(' ');
|
|
115
|
+
}
|
|
116
|
+
return typeof cssClasses === 'string' ? cssClasses : '';
|
|
86
117
|
}
|
|
87
118
|
getAgGridLightThemeName() {
|
|
88
119
|
const container = this.getAgGridContainerElement();
|