@adaptabletools/adaptable 23.0.22 → 23.1.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
- 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/Redux/Store/AdaptableStore.js +6 -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 +30 -6
- package/src/agGrid/AdaptableAgGrid.js +60 -78
- package/src/agGrid/AgGridAdapter.d.ts +32 -1
- package/src/agGrid/AgGridAdapter.js +88 -0
- package/src/agGrid/AgGridColumnAdapter.d.ts +44 -0
- package/src/agGrid/AgGridColumnAdapter.js +153 -37
- 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/components/Radio/index.d.ts +2 -2
- 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/types.d.ts +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -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) => {
|
|
@@ -744,11 +848,23 @@ export class AgGridColumnAdapter {
|
|
|
744
848
|
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
849
|
return false;
|
|
746
850
|
}
|
|
747
|
-
return
|
|
851
|
+
return this.getAdaptableColumnFilterDef();
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
getAdaptableColumnFilterDef() {
|
|
855
|
+
if (!this.adaptableColumnFilterDef) {
|
|
856
|
+
this.adaptableColumnFilterDef = {
|
|
748
857
|
component: AgGridFilterAdapterFactory(this.adaptableInstance),
|
|
749
858
|
handler: () => new AdaptableFilterHandler(this.adaptableApi),
|
|
750
859
|
};
|
|
751
|
-
}
|
|
860
|
+
}
|
|
861
|
+
return this.adaptableColumnFilterDef;
|
|
862
|
+
}
|
|
863
|
+
getAdaptableFloatingFilterComponent() {
|
|
864
|
+
if (!this.adaptableFloatingFilterComponent) {
|
|
865
|
+
this.adaptableFloatingFilterComponent = AgGridFloatingFilterAdapterFactory(this.adaptableInstance);
|
|
866
|
+
}
|
|
867
|
+
return this.adaptableFloatingFilterComponent;
|
|
752
868
|
}
|
|
753
869
|
setupColumnFloatingFilter({ col, colDef }) {
|
|
754
870
|
const userProvidedFilterProp = this.getUserColDefProperty(col.getColId(), 'filter');
|
|
@@ -775,13 +891,13 @@ export class AgGridColumnAdapter {
|
|
|
775
891
|
if (isFloatingFilterDisabled) {
|
|
776
892
|
return;
|
|
777
893
|
}
|
|
778
|
-
return
|
|
894
|
+
return this.getAdaptableFloatingFilterComponent();
|
|
779
895
|
});
|
|
780
896
|
this.setColDefProperty(col, 'floatingFilter', () => {
|
|
781
897
|
if (isFloatingFilterDisabled) {
|
|
782
898
|
return;
|
|
783
899
|
}
|
|
784
|
-
return
|
|
900
|
+
return this.getAdaptableFloatingFilterComponent();
|
|
785
901
|
});
|
|
786
902
|
this.setColDefProperty(col, 'suppressFloatingFilterButton', () => {
|
|
787
903
|
return !isFloatingFilterDisabled;
|
|
@@ -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();
|
|
@@ -22,14 +22,14 @@ export interface RadioProps extends TypeProps, Omit<BoxProps, keyof TypeProps> {
|
|
|
22
22
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
23
23
|
onFocus?: React.FocusEventHandler<HTMLDivElement>;
|
|
24
24
|
}
|
|
25
|
-
export declare const useRadioContext: <T extends
|
|
25
|
+
export declare const useRadioContext: <T extends any>() => {
|
|
26
26
|
value: T;
|
|
27
27
|
onChange: (value: T) => void;
|
|
28
28
|
name: string;
|
|
29
29
|
variant: Variant;
|
|
30
30
|
};
|
|
31
31
|
declare const Radio: ({ children, checked, onChange, value, name, gapDistance, childrenPosition, as, id, tabIndex, disabled, ...props }: RadioProps) => React.JSX.Element;
|
|
32
|
-
export declare const RadioGroup: <T extends
|
|
32
|
+
export declare const RadioGroup: <T extends any>(props: {
|
|
33
33
|
orientation: "horizontal" | "vertical";
|
|
34
34
|
value?: T;
|
|
35
35
|
name?: string;
|
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: "23.0.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1789413930421 || Date.now(),
|
|
4
|
+
VERSION: "23.1.0-canary.0" || '--current-version--',
|
|
5
5
|
};
|
|
@@ -104,6 +104,15 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
|
|
|
104
104
|
private computeColumnOrderAndVisibility;
|
|
105
105
|
autoSizeColumns(columnIds?: string[]): false | string[];
|
|
106
106
|
private applyPivotLayout;
|
|
107
|
+
/**
|
|
108
|
+
* Applies the layout state that targets pivot result columns (order, sorts, pinning).
|
|
109
|
+
*
|
|
110
|
+
* Must be called after the primary applyColumnState call(s) - i.e. after the pivot
|
|
111
|
+
* result columns have been (re)generated by AG Grid - because pivot result column
|
|
112
|
+
* state included in the same call that changes pivot/aggregation config is applied
|
|
113
|
+
* to the previous generation of pivot result columns (see AG Grid 36 notes in applyPivotLayout).
|
|
114
|
+
*/
|
|
115
|
+
private applyPivotResultColumnsState;
|
|
107
116
|
applyPivotTotals(layout: PivotLayoutModel): void;
|
|
108
117
|
applyColumnGroupCollapseExpandState(layout: PivotLayoutModel | TableLayoutModel): void;
|
|
109
118
|
private withSuppressColumnAnimation;
|
|
@@ -1340,20 +1340,6 @@ export class LayoutManager extends LMEmitter {
|
|
|
1340
1340
|
this.computeColumnSorts(layout, columnState);
|
|
1341
1341
|
this.computePinnedColumns(layout, columnState);
|
|
1342
1342
|
this.computePivotAggregations(layout, columnState);
|
|
1343
|
-
if (Array.isArray(layout.PivotResultColumnsOrder)) {
|
|
1344
|
-
const pivotResultColumnsOrderSet = new Set(layout.PivotResultColumnsOrder);
|
|
1345
|
-
const existingPivotResultState = {};
|
|
1346
|
-
columnState.state = columnState.state.filter((colState) => {
|
|
1347
|
-
if (pivotResultColumnsOrderSet.has(colState.colId)) {
|
|
1348
|
-
existingPivotResultState[colState.colId] = colState;
|
|
1349
|
-
return false;
|
|
1350
|
-
}
|
|
1351
|
-
return true;
|
|
1352
|
-
});
|
|
1353
|
-
layout.PivotResultColumnsOrder.forEach((colId) => {
|
|
1354
|
-
columnState.state.push(existingPivotResultState[colId] || { colId });
|
|
1355
|
-
});
|
|
1356
|
-
}
|
|
1357
1343
|
return columnState;
|
|
1358
1344
|
}
|
|
1359
1345
|
computePivotAggregations(layout, columnState) {
|
|
@@ -1583,10 +1569,8 @@ export class LayoutManager extends LMEmitter {
|
|
|
1583
1569
|
this.gridApi.applyColumnState(columnState);
|
|
1584
1570
|
});
|
|
1585
1571
|
this.computePivotAggregations(layout, columnState);
|
|
1586
|
-
if (Array.isArray(layout.PivotResultColumnsOrder)) {
|
|
1587
|
-
columnState.applyOrder = true;
|
|
1588
|
-
}
|
|
1589
1572
|
this.gridApi.applyColumnState(columnState);
|
|
1573
|
+
this.applyPivotResultColumnsState(layout);
|
|
1590
1574
|
if (layout.ColumnSizing) {
|
|
1591
1575
|
const colWidthForPivotResultColumns = [];
|
|
1592
1576
|
(this.gridApi.getPivotResultColumns() || []).forEach((col) => {
|
|
@@ -1608,6 +1592,43 @@ export class LayoutManager extends LMEmitter {
|
|
|
1608
1592
|
}
|
|
1609
1593
|
});
|
|
1610
1594
|
}
|
|
1595
|
+
applyPivotResultColumnsState(layout) {
|
|
1596
|
+
const existingPivotResultColIds = (this.gridApi.getPivotResultColumns() || []).map((col) => col.getColId());
|
|
1597
|
+
if (!existingPivotResultColIds.length) {
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
const existingSet = new Set(existingPivotResultColIds);
|
|
1601
|
+
const persistedOrder = Array.isArray(layout.PivotResultColumnsOrder) && layout.PivotResultColumnsOrder.length > 0
|
|
1602
|
+
? layout.PivotResultColumnsOrder
|
|
1603
|
+
: null;
|
|
1604
|
+
let orderedColIds = existingPivotResultColIds;
|
|
1605
|
+
if (persistedOrder) {
|
|
1606
|
+
const desiredSet = new Set(persistedOrder);
|
|
1607
|
+
const knownColIds = existingPivotResultColIds.filter((colId) => desiredSet.has(colId));
|
|
1608
|
+
const extraColIds = existingPivotResultColIds.filter((colId) => !desiredSet.has(colId));
|
|
1609
|
+
orderedColIds = [
|
|
1610
|
+
...sortColumnIdsByOrder(knownColIds, persistedOrder).filter((colId) => existingSet.has(colId)),
|
|
1611
|
+
...extraColIds,
|
|
1612
|
+
];
|
|
1613
|
+
}
|
|
1614
|
+
const sorts = layout.ColumnSorts || [];
|
|
1615
|
+
const sortIndexes = new Map(sorts.map((sort, index) => [sort.ColumnId, index]));
|
|
1616
|
+
const pinning = layout.ColumnPinning || {};
|
|
1617
|
+
const state = orderedColIds.map((colId) => {
|
|
1618
|
+
const sortIndex = sortIndexes.get(colId);
|
|
1619
|
+
const sort = sortIndex != null ? sorts[sortIndex] : undefined;
|
|
1620
|
+
return {
|
|
1621
|
+
colId,
|
|
1622
|
+
sort: sort ? (sort.SortOrder === 'Asc' ? 'asc' : 'desc') : null,
|
|
1623
|
+
sortIndex: sort ? sortIndex : null,
|
|
1624
|
+
pinned: pinning[colId] ?? null,
|
|
1625
|
+
};
|
|
1626
|
+
});
|
|
1627
|
+
this.gridApi.applyColumnState({
|
|
1628
|
+
state,
|
|
1629
|
+
applyOrder: !!persistedOrder,
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1611
1632
|
applyPivotTotals(layout) {
|
|
1612
1633
|
if (layout.PivotGrandTotal) {
|
|
1613
1634
|
const pivotGrandTotal = layout.PivotGrandTotal === true || layout.PivotGrandTotal === 'before'
|
package/src/types.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export type { OpenFinPluginOptions } from './AdaptableOptions/OpenFinPluginOptio
|
|
|
34
34
|
export type { InteropioPluginOptions } from './AdaptableOptions/InteropioPluginOptions';
|
|
35
35
|
export type { MasterDetailPluginOptions, DetailInitContext, } from './AdaptableOptions/MasterDetailPluginOptions';
|
|
36
36
|
export type { DateInputOptions } from './AdaptableOptions/DateInputOptions';
|
|
37
|
-
export type { FilterOptions, ColumnFilterOptions, GridFilterOptions, IsRowFilterableContext, InFilterValueInfo, InFilterValueResult, InFilterValue, CustomInFilterValuesContext, GridFilterEditors, DefaultPredicateFilterContext, AdaptableFilterComponentLocation, } from './AdaptableOptions/FilterOptions';
|
|
37
|
+
export type { FilterOptions, ColumnFilterOptions, GridFilterOptions, IsRowFilterableContext, InFilterValueInfo, InFilterValueResult, InFilterValue, CustomInFilterValuesContext, InFilterLabelContext, GridFilterEditors, DefaultPredicateFilterContext, AdaptableFilterComponentLocation, } from './AdaptableOptions/FilterOptions';
|
|
38
38
|
export type { QuickSearchOptions, QuickSearchContext } from './AdaptableOptions/QuickSearchOptions';
|
|
39
39
|
export type { FormatColumnOptions, CustomDisplayFormatter, CustomDisplayFormatterContext, } from './AdaptableOptions/FormatColumnOptions';
|
|
40
40
|
export type { PlusMinusOptions } from './AdaptableOptions/EditOptions';
|