@adaptabletools/adaptable 18.0.0-canary.3 → 18.0.0-canary.5
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/agGrid.d.ts +4 -21
- package/agGrid.js +9 -26
- package/base.css +4 -1
- package/base.css.map +1 -1
- package/index.css +79 -68
- package/index.css.map +1 -1
- package/package.json +3 -4
- package/src/AdaptableInterfaces/IAdaptable.d.ts +55 -109
- package/src/AdaptableOptions/AdaptableOptions.d.ts +11 -5
- package/src/AdaptableOptions/ColumnFilterOptions.d.ts +4 -4
- package/src/AdaptableOptions/{CommentsOptions.d.ts → CommentOptions.d.ts} +5 -5
- package/src/AdaptableOptions/MenuOptions.d.ts +1 -1
- package/src/AdaptableOptions/MenuOptions.js +1 -5
- package/src/AdaptableOptions/{NotesOptions.d.ts → NoteOptions.d.ts} +1 -1
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +17 -0
- package/src/Api/AdaptableApi.d.ts +5 -0
- package/src/Api/BulkUpdateApi.d.ts +0 -5
- package/src/Api/Events/AdaptableReady.d.ts +3 -3
- package/src/Api/Events/GridDataChanged.d.ts +4 -4
- package/src/Api/GridApi.d.ts +14 -13
- package/src/Api/Implementation/ActionColumnApiImpl.d.ts +2 -0
- package/src/Api/Implementation/ActionColumnApiImpl.js +33 -0
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -0
- package/src/Api/Implementation/AdaptableApiImpl.js +3 -0
- package/src/Api/Implementation/ApiBase.d.ts +2 -1
- package/src/Api/Implementation/ApiBase.js +4 -1
- package/src/Api/Implementation/BulkUpdateApiImpl.d.ts +0 -1
- package/src/Api/Implementation/BulkUpdateApiImpl.js +0 -4
- package/src/Api/Implementation/CommentsApiImpl.js +2 -1
- package/src/Api/Implementation/ConfigApiImpl.js +8 -3
- package/src/Api/Implementation/GridApiImpl.d.ts +3 -3
- package/src/Api/Implementation/GridApiImpl.js +20 -14
- package/src/Api/Implementation/LayoutApiImpl.d.ts +4 -0
- package/src/Api/Implementation/LayoutApiImpl.js +14 -0
- package/src/Api/Implementation/NotesApiImpl.d.ts +2 -4
- package/src/Api/Implementation/NotesApiImpl.js +4 -8
- package/src/Api/Implementation/OptionsApiImpl.d.ts +1 -1
- package/src/Api/Implementation/OptionsApiImpl.js +2 -2
- package/src/Api/Implementation/StatusBarApiImpl.d.ts +0 -1
- package/src/Api/Implementation/StatusBarApiImpl.js +0 -3
- package/src/Api/Implementation/ToolPanelApiImpl.js +6 -6
- package/src/Api/Internal/ActionRowInternalApi.d.ts +5 -1
- package/src/Api/Internal/ActionRowInternalApi.js +106 -0
- package/src/Api/Internal/AdaptableInternalApi.d.ts +3 -4
- package/src/Api/Internal/AdaptableInternalApi.js +10 -8
- package/src/Api/Internal/CalculatedColumnInternalApi.d.ts +2 -0
- package/src/Api/Internal/CalculatedColumnInternalApi.js +70 -0
- package/src/Api/Internal/ColumnFilterInternalApi.d.ts +1 -0
- package/src/Api/Internal/ColumnFilterInternalApi.js +11 -1
- package/src/Api/Internal/ColumnInternalApi.d.ts +4 -1
- package/src/Api/Internal/ColumnInternalApi.js +12 -0
- package/src/Api/Internal/CustomSortInternalApi.d.ts +3 -2
- package/src/Api/Internal/CustomSortInternalApi.js +32 -1
- package/src/Api/Internal/DataSetInternalApi.js +1 -1
- package/src/Api/Internal/FreeTextColumnInternalApi.d.ts +2 -0
- package/src/Api/Internal/FreeTextColumnInternalApi.js +59 -0
- package/src/Api/Internal/GridFilterInternalApi.js +1 -1
- package/src/Api/Internal/GridInternalApi.d.ts +21 -3
- package/src/Api/Internal/GridInternalApi.js +126 -7
- package/src/Api/Internal/TeamSharingInternalApi.js +1 -1
- package/src/Api/InteropioPluginApi.d.ts +2 -2
- package/src/Api/LayoutApi.d.ts +8 -0
- package/src/Api/OptionsApi.d.ts +1 -1
- package/src/EnvVars.d.ts +3 -0
- package/src/EnvVars.js +4 -0
- package/src/PredefinedConfig/Common/AggregationColumns.d.ts +1 -0
- package/src/PredefinedConfig/Common/AggregationColumns.js +3 -0
- package/src/PredefinedConfig/NotesState.d.ts +10 -20
- package/src/PredefinedConfig/PredefinedConfig.d.ts +1 -1
- package/src/Redux/ActionsReducers/NotesRedux.d.ts +3 -4
- package/src/Redux/ActionsReducers/NotesRedux.js +8 -7
- package/src/Redux/Store/AdaptableStore.d.ts +4 -6
- package/src/Redux/Store/AdaptableStore.js +22 -50
- package/src/Redux/Store/Interface/IAdaptableStore.d.ts +7 -1
- package/src/Strategy/AdaptableModuleBase.d.ts +2 -3
- package/src/Strategy/AdaptableModuleBase.js +4 -7
- package/src/Strategy/AlertModule.d.ts +1 -2
- package/src/Strategy/AlertModule.js +2 -55
- package/src/Strategy/CalculatedColumnModule.d.ts +2 -3
- package/src/Strategy/CalculatedColumnModule.js +5 -25
- package/src/Strategy/ChartingModule.d.ts +0 -1
- package/src/Strategy/ChartingModule.js +2 -22
- package/src/Strategy/ColumnFilterModule.d.ts +1 -2
- package/src/Strategy/ColumnFilterModule.js +1 -64
- package/src/Strategy/CommentsModule.d.ts +1 -0
- package/src/Strategy/CommentsModule.js +2 -1
- package/src/Strategy/CustomSortModule.js +1 -1
- package/src/Strategy/DashboardModule.d.ts +1 -2
- package/src/Strategy/DashboardModule.js +1 -8
- package/src/Strategy/DataChangeHistoryModule.d.ts +1 -0
- package/src/Strategy/DataChangeHistoryModule.js +3 -1
- package/src/Strategy/DataSetModule.d.ts +1 -1
- package/src/Strategy/DataSetModule.js +1 -1
- package/src/Strategy/FlashingCellModule.d.ts +1 -2
- package/src/Strategy/FlashingCellModule.js +2 -15
- package/src/Strategy/FormatColumnModule.d.ts +0 -2
- package/src/Strategy/FormatColumnModule.js +0 -47
- package/src/Strategy/FreeTextColumnModule.d.ts +0 -1
- package/src/Strategy/FreeTextColumnModule.js +0 -30
- package/src/Strategy/GridFilterModule.d.ts +0 -1
- package/src/Strategy/GridFilterModule.js +0 -37
- package/src/Strategy/Interface/IModule.d.ts +0 -1
- package/src/Strategy/LayoutModule.d.ts +1 -3
- package/src/Strategy/LayoutModule.js +6 -50
- package/src/Strategy/NamedQueryModule.d.ts +0 -1
- package/src/Strategy/NamedQueryModule.js +0 -19
- package/src/Strategy/PlusMinusModule.d.ts +1 -1
- package/src/Strategy/PlusMinusModule.js +1 -1
- package/src/Strategy/ScheduleModule.d.ts +1 -1
- package/src/Strategy/ScheduleModule.js +1 -1
- package/src/Strategy/ShortcutModule.d.ts +1 -1
- package/src/Strategy/ShortcutModule.js +1 -1
- package/src/Strategy/StyledColumnModule.d.ts +0 -1
- package/src/Strategy/StyledColumnModule.js +0 -21
- package/src/Strategy/TeamSharingModule.d.ts +1 -0
- package/src/Strategy/TeamSharingModule.js +5 -5
- package/src/Strategy/ToolPanelModule.d.ts +0 -1
- package/src/Strategy/ToolPanelModule.js +0 -23
- package/src/Utilities/Constants/DocumentationLinkConstants.js +1 -1
- package/src/Utilities/Constants/GeneralConstants.d.ts +1 -0
- package/src/Utilities/Constants/GeneralConstants.js +1 -0
- package/src/Utilities/Defaults/DefaultSettingsPanel.js +5 -4
- package/src/Utilities/Helpers/AdaptableHelper.d.ts +0 -3
- package/src/Utilities/Helpers/AdaptableHelper.js +0 -58
- package/src/Utilities/Helpers/Helper.d.ts +2 -0
- package/src/Utilities/Helpers/Helper.js +4 -0
- package/src/Utilities/Services/AggregatedScalarLiveValue.js +3 -1
- package/src/Utilities/Services/CellPopupService.js +0 -1
- package/src/Utilities/Services/LicenseService/index.d.ts +3 -0
- package/src/Utilities/Services/LicenseService/index.js +10 -3
- package/src/Utilities/Services/MetamodelService.d.ts +1 -1
- package/src/Utilities/Services/MetamodelService.js +6 -3
- package/src/Utilities/Services/RowEditService.d.ts +3 -2
- package/src/Utilities/Services/RowEditService.js +3 -1
- package/src/View/AdaptableView.js +0 -2
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +2 -2
- package/src/View/BulkUpdate/BulkUpdatePopup.js +1 -1
- package/src/View/CalculatedColumn/utils.d.ts +1 -1
- package/src/View/CellSummary/CellSummaryPopup.js +1 -1
- package/src/View/Comments/CommentsPopup.js +12 -8
- package/src/View/Components/Popups/AdaptableLoadingScreen.d.ts +6 -5
- package/src/View/Components/Popups/AdaptableLoadingScreen.js +19 -9
- package/src/View/Components/Popups/GridCellPopup/GridCellPopup.js +1 -1
- package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +1 -0
- package/src/View/Components/Popups/WindowPopups/windowFactory.js +3 -0
- package/src/View/Components/Selectors/PermittedValuesSelector.js +1 -1
- package/src/View/CustomSort/CustomSortSummary.js +1 -1
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -1
- package/src/View/GridFilter/GridFilterViewPanel.js +6 -2
- package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +2 -3
- package/src/View/Layout/TransposedPopup.d.ts +3 -0
- package/src/View/Layout/TransposedPopup.js +193 -0
- package/src/View/Layout/Wizard/LayoutWizard.js +1 -1
- package/src/View/Notes/NotesPopup.js +9 -11
- package/src/View/Theme/ThemeSelector.js +3 -3
- package/src/agGrid/ActionColumnRenderer.js +4 -4
- package/src/agGrid/Adaptable.d.ts +3 -455
- package/src/agGrid/Adaptable.js +8 -5292
- package/src/agGrid/AdaptableAgGrid.d.ts +336 -0
- package/src/agGrid/AdaptableAgGrid.js +3780 -0
- package/src/agGrid/AdaptableLogger.js +77 -11
- package/src/agGrid/AgGridAdapter.d.ts +54 -0
- package/src/agGrid/AgGridAdapter.js +549 -0
- package/src/agGrid/AgGridColumnAdapter.d.ts +56 -0
- package/src/agGrid/AgGridColumnAdapter.js +813 -0
- package/src/agGrid/AgGridMenuAdapter.d.ts +28 -0
- package/src/agGrid/AgGridMenuAdapter.js +271 -0
- package/src/agGrid/AgGridOptionsService.d.ts +11 -0
- package/src/agGrid/AgGridOptionsService.js +50 -0
- package/src/agGrid/BadgeRenderer.js +1 -1
- package/src/agGrid/CheckboxRenderer.js +1 -1
- package/src/agGrid/FilterWrapper.d.ts +2 -2
- package/src/agGrid/FilterWrapper.js +1 -1
- package/src/agGrid/attachAddaptableColumnTypes.d.ts +12 -12
- package/src/agGrid/defaultAdaptableOptions.d.ts +3 -0
- package/src/{Utilities/Defaults/DefaultAdaptableOptions.js → agGrid/defaultAdaptableOptions.js} +70 -9
- package/src/agGrid/editors/AdaptableDateEditor/index.js +2 -2
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +2 -2
- package/src/components/Datepicker/index.d.ts +1 -1
- package/src/components/InfiniteTable/index.js +2 -2
- package/src/components/Modal/index.d.ts +1 -0
- package/src/components/Modal/index.js +4 -3
- package/src/components/Select/Select.d.ts +2 -0
- package/src/components/Select/Select.js +2 -2
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +39 -11
- package/src/metamodel/adaptable.metamodel.js +73 -32
- package/src/migration/AdaptableUpgradeHelper.d.ts +38 -0
- package/src/migration/AdaptableUpgradeHelper.js +48 -0
- package/src/migration/VersionUpgrade.d.ts +8 -0
- package/src/migration/VersionUpgrade.js +11 -0
- package/src/migration/VersionUpgrade17.d.ts +18 -0
- package/src/migration/VersionUpgrade17.js +342 -0
- package/src/migration/VersionUpgrade18.d.ts +5 -0
- package/src/migration/VersionUpgrade18.js +6 -0
- package/src/types.d.ts +7 -3
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/src/Utilities/Defaults/DefaultAdaptableOptions.d.ts +0 -2
- package/src/Utilities/Services/Interface/IRowEditService.d.ts +0 -3
- package/src/Utilities/Services/Interface/IRowEditService.js +0 -1
- package/src/agGrid/agGridHelper.d.ts +0 -57
- package/src/agGrid/agGridHelper.js +0 -686
- package/src/agGrid/agGridMenuHelper.d.ts +0 -46
- package/src/agGrid/agGridMenuHelper.js +0 -668
- /package/src/AdaptableOptions/{CommentsOptions.js → CommentOptions.js} +0 -0
- /package/src/AdaptableOptions/{NotesOptions.js → NoteOptions.js} +0 -0
|
@@ -1,668 +0,0 @@
|
|
|
1
|
-
import { ArrayExtensions } from '../Utilities/Extensions/ArrayExtensions';
|
|
2
|
-
import { iconToString } from '../components/icons';
|
|
3
|
-
import flatten from 'lodash/flatten';
|
|
4
|
-
import { isAdaptableElementIcon } from '../components/Icon';
|
|
5
|
-
import { logDeprecation } from '../Utilities/logDeprecation';
|
|
6
|
-
import { DEFAULT_ADAPTABLE_COLUMN_MENU_ORDER, DEFAULT_ADAPTABLE_CONTEXT_MENU_STRUCTURE, } from '../AdaptableOptions/MenuOptions';
|
|
7
|
-
// tslint:disable-next-line: class-name
|
|
8
|
-
export class agGridMenuHelper {
|
|
9
|
-
constructor(adaptable, gridOptions) {
|
|
10
|
-
this.adaptable = adaptable;
|
|
11
|
-
this.gridOptions = gridOptions;
|
|
12
|
-
this.buildGroupedModuleItems = (sortedMenuItems, adaptableMenuItems) => {
|
|
13
|
-
return sortedMenuItems
|
|
14
|
-
.map((moduleOrGroup) => {
|
|
15
|
-
if (typeof moduleOrGroup === 'object') {
|
|
16
|
-
const submenuItems = this.buildGroupedModuleItems(moduleOrGroup.modules, adaptableMenuItems);
|
|
17
|
-
// if there is only one item in the submenu, we don't need to show the submenu
|
|
18
|
-
if (submenuItems.length === 1) {
|
|
19
|
-
return submenuItems[0];
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
label: moduleOrGroup.title,
|
|
23
|
-
icon: moduleOrGroup.icon,
|
|
24
|
-
subItems: submenuItems,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
return adaptableMenuItems.find((menuItem) => menuItem.module === moduleOrGroup);
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
.filter((menuItem) => {
|
|
32
|
-
if (!menuItem) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
if (menuItem.subItems && menuItem.subItems.length === 0) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
destroy() {
|
|
43
|
-
this.adaptable = null;
|
|
44
|
-
this.gridOptions = null;
|
|
45
|
-
}
|
|
46
|
-
mapAdaptableMenuItemToSystemMenuItems(adaptableMenuItems) {
|
|
47
|
-
return (adaptableMenuItems !== null && adaptableMenuItems !== void 0 ? adaptableMenuItems : []).map((menuItem) => {
|
|
48
|
-
let subItems = menuItem.subItems;
|
|
49
|
-
if (subItems && subItems.length > 0) {
|
|
50
|
-
subItems = subItems.map((subItem) => this.mapAdaptableMenuItemToSystemMenuItems(subItem.subItems));
|
|
51
|
-
}
|
|
52
|
-
return Object.assign(Object.assign({}, menuItem), { menuType: 'Adaptable', subItems });
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
buildColumnMenu(params, originalGetMainMenuItems) {
|
|
56
|
-
var _a;
|
|
57
|
-
const menuOptions = this.adaptable.adaptableOptions.menuOptions;
|
|
58
|
-
const hasDeprecatedOptions = this.logMenuDeprecation('ColumnMenu');
|
|
59
|
-
const agGridMenuItems = (params.defaultItems ? [...params.defaultItems] : []);
|
|
60
|
-
if (!params.column) {
|
|
61
|
-
// return only AG Grid context if the Adaptable column is not found (should not happen)
|
|
62
|
-
return agGridMenuItems;
|
|
63
|
-
}
|
|
64
|
-
const adaptableColumn = this.adaptable.api.columnApi.getColumnWithColumnId((_a = params.column) === null || _a === void 0 ? void 0 : _a.getColId());
|
|
65
|
-
const menuContext = this.createColumnMenuContextObject(adaptableColumn, params.column);
|
|
66
|
-
const adaptableMenuItems = this.createAdaptableColumnMenuItems(menuContext);
|
|
67
|
-
// sort Adaptable menu items by default order
|
|
68
|
-
const structuredAdaptableMenuItems = this.buildGroupedModuleItems(DEFAULT_ADAPTABLE_COLUMN_MENU_ORDER, adaptableMenuItems);
|
|
69
|
-
// 1. first check if there is a custom column menu defined
|
|
70
|
-
if (typeof menuOptions.customColumnMenu === 'function') {
|
|
71
|
-
const defaultAgGridMenuItems = agGridMenuItems.map((itemName) => ({
|
|
72
|
-
menuType: 'AgGrid',
|
|
73
|
-
name: itemName,
|
|
74
|
-
}));
|
|
75
|
-
const defaultAdaptableMenuItems = adaptableMenuItems.map((adaptableItem) => (Object.assign({ menuType: 'Adaptable' }, adaptableItem)));
|
|
76
|
-
const customMenuItems = menuOptions
|
|
77
|
-
.customColumnMenu(Object.assign(Object.assign({}, menuContext), { defaultAgGridMenuItems,
|
|
78
|
-
defaultAdaptableMenuItems, structuredAdaptableMenuItems: this.mapAdaptableMenuItemToSystemMenuItems(structuredAdaptableMenuItems) }))
|
|
79
|
-
.filter(Boolean);
|
|
80
|
-
return customMenuItems
|
|
81
|
-
.map((customMenuItem) => this.mapCustomMenuItemToAgGridMenuDefinition(customMenuItem, menuContext))
|
|
82
|
-
.filter(Boolean);
|
|
83
|
-
}
|
|
84
|
-
if (hasDeprecatedOptions) {
|
|
85
|
-
return this.buildColumnMenuDeprecated(params, originalGetMainMenuItems);
|
|
86
|
-
}
|
|
87
|
-
// 2. if not, return the default context menu
|
|
88
|
-
const defaultContextMenu = [
|
|
89
|
-
...agGridMenuItems,
|
|
90
|
-
'separator',
|
|
91
|
-
...structuredAdaptableMenuItems.map((adaptableItem) => this.mapAdaptableMenuItemToAgGridMenuDefinition(adaptableItem)),
|
|
92
|
-
];
|
|
93
|
-
return defaultContextMenu;
|
|
94
|
-
}
|
|
95
|
-
buildContextMenu(params, originalGetContextMenuItems) {
|
|
96
|
-
var _a;
|
|
97
|
-
// we do this in order to refresh the internal state of selected cells (technically query the AG Grid cellRanges)
|
|
98
|
-
// (right-click selected the current cell, but this was not reflected in the internal state of the selected cells)
|
|
99
|
-
this.adaptable.setSelectedCells();
|
|
100
|
-
const menuOptions = this.adaptable.adaptableOptions.menuOptions;
|
|
101
|
-
const hasDeprecatedOptions = this.logMenuDeprecation('ContextMenu');
|
|
102
|
-
const agGridMenuItems = (params.defaultItems ? [...params.defaultItems] : []);
|
|
103
|
-
if (!params.column) {
|
|
104
|
-
// return only AG Grid context if the Adaptable column is not found (should not happen)
|
|
105
|
-
return agGridMenuItems;
|
|
106
|
-
}
|
|
107
|
-
const adaptableColumn = this.adaptable.api.columnApi.getColumnWithColumnId((_a = params.column) === null || _a === void 0 ? void 0 : _a.getColId());
|
|
108
|
-
const menuContext = this.createContextMenuContextObject(params, adaptableColumn);
|
|
109
|
-
const adaptableMenuItems = this.createAdaptableContextMenuItems(menuContext);
|
|
110
|
-
// sort Adaptable menu items by default order
|
|
111
|
-
const structuredAdaptableMenuItems = this.buildGroupedModuleItems(DEFAULT_ADAPTABLE_CONTEXT_MENU_STRUCTURE, adaptableMenuItems);
|
|
112
|
-
// 1. first check if there is a custom context menu defined
|
|
113
|
-
if (typeof menuOptions.customContextMenu === 'function') {
|
|
114
|
-
const defaultAgGridMenuItems = agGridMenuItems.map((itemName) => ({
|
|
115
|
-
menuType: 'AgGrid',
|
|
116
|
-
name: itemName,
|
|
117
|
-
}));
|
|
118
|
-
const defaultAdaptableMenuItems = adaptableMenuItems.map((adaptableItem) => (Object.assign({ menuType: 'Adaptable' }, adaptableItem)));
|
|
119
|
-
const customMenuItems = menuOptions
|
|
120
|
-
.customContextMenu(Object.assign(Object.assign({}, menuContext), { defaultAgGridMenuItems,
|
|
121
|
-
defaultAdaptableMenuItems, structuredAdaptableMenuItems: this.mapAdaptableMenuItemToSystemMenuItems(structuredAdaptableMenuItems) }))
|
|
122
|
-
.filter(Boolean);
|
|
123
|
-
return customMenuItems
|
|
124
|
-
.map((customMenuItem) => this.mapCustomMenuItemToAgGridMenuDefinition(customMenuItem, menuContext))
|
|
125
|
-
.filter(Boolean);
|
|
126
|
-
}
|
|
127
|
-
if (hasDeprecatedOptions) {
|
|
128
|
-
return this.buildContextMenuDeprecated(params, originalGetContextMenuItems);
|
|
129
|
-
}
|
|
130
|
-
// 2. if not, return the default context menu
|
|
131
|
-
const defaultContextMenu = [
|
|
132
|
-
...agGridMenuItems,
|
|
133
|
-
'separator',
|
|
134
|
-
...structuredAdaptableMenuItems.map((adaptableItem) => this.mapAdaptableMenuItemToAgGridMenuDefinition(adaptableItem)),
|
|
135
|
-
];
|
|
136
|
-
return defaultContextMenu;
|
|
137
|
-
}
|
|
138
|
-
createAdaptableColumnMenuItems(menuContext) {
|
|
139
|
-
let contextMenuItems = [];
|
|
140
|
-
this.adaptable.adaptableModules.forEach((s) => {
|
|
141
|
-
let menuItems = s.addColumnMenuItems(menuContext.adaptableColumn);
|
|
142
|
-
if (menuItems) {
|
|
143
|
-
contextMenuItems.push(...menuItems.filter(Boolean).filter((item) => item.isVisible !== false));
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
return contextMenuItems;
|
|
147
|
-
}
|
|
148
|
-
mapCustomMenuItemToAgGridMenuDefinition(customMenuItem, menuContext) {
|
|
149
|
-
var _a;
|
|
150
|
-
if (customMenuItem === '-') {
|
|
151
|
-
return 'separator';
|
|
152
|
-
}
|
|
153
|
-
if (customMenuItem.menuType === 'Group') {
|
|
154
|
-
return {
|
|
155
|
-
name: customMenuItem.label,
|
|
156
|
-
icon: this.mapAdaptableIconToAgGridIcon(customMenuItem.icon, {
|
|
157
|
-
fill: 'var(--ab-color-text-on-primary)',
|
|
158
|
-
}),
|
|
159
|
-
disabled: customMenuItem.disabled,
|
|
160
|
-
subMenu: !customMenuItem.disabled
|
|
161
|
-
? (_a = customMenuItem.subMenuItems) === null || _a === void 0 ? void 0 : _a.map((subMenuItem) => this.mapCustomMenuItemToAgGridMenuDefinition(subMenuItem, menuContext)).filter(Boolean)
|
|
162
|
-
: undefined,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
if (customMenuItem.menuType === 'AgGrid') {
|
|
166
|
-
return customMenuItem.name;
|
|
167
|
-
}
|
|
168
|
-
if (customMenuItem.menuType === 'Adaptable') {
|
|
169
|
-
return this.mapAdaptableMenuItemToAgGridMenuDefinition(customMenuItem);
|
|
170
|
-
}
|
|
171
|
-
if (customMenuItem.menuType === 'User') {
|
|
172
|
-
return this.mapUserMenuItemToAgGridMenuDefinition(customMenuItem, menuContext);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
mapAdaptableMenuItemToAgGridMenuDefinition(adaptableMenuItem) {
|
|
176
|
-
var _a;
|
|
177
|
-
return {
|
|
178
|
-
name: adaptableMenuItem.label,
|
|
179
|
-
action: adaptableMenuItem.onClick
|
|
180
|
-
? adaptableMenuItem.onClick
|
|
181
|
-
: adaptableMenuItem.reduxAction
|
|
182
|
-
? () => this.adaptable.api.internalApi.dispatchReduxAction(adaptableMenuItem.reduxAction)
|
|
183
|
-
: undefined,
|
|
184
|
-
icon: this.mapAdaptableIconToAgGridIcon(adaptableMenuItem.icon, {
|
|
185
|
-
fill: 'var(--ab-color-text-on-primary)',
|
|
186
|
-
}),
|
|
187
|
-
subMenu: (_a = adaptableMenuItem.subItems) === null || _a === void 0 ? void 0 : _a.map((subMenuItem) => this.mapAdaptableMenuItemToAgGridMenuDefinition(subMenuItem)),
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
mapUserMenuItemToAgGridMenuDefinition(userMenuItem, menuContext) {
|
|
191
|
-
var _a;
|
|
192
|
-
if (userMenuItem.hidden) {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
return {
|
|
196
|
-
name: userMenuItem.label,
|
|
197
|
-
action: () => (userMenuItem.onClick ? userMenuItem.onClick(menuContext) : null),
|
|
198
|
-
icon: this.mapAdaptableIconToAgGridIcon(userMenuItem.icon, {
|
|
199
|
-
fill: 'var(--ab-color-text-on-primary)',
|
|
200
|
-
}),
|
|
201
|
-
disabled: userMenuItem.disabled,
|
|
202
|
-
subMenu: (_a = userMenuItem.subMenuItems) === null || _a === void 0 ? void 0 : _a.map((subMenuItem) => {
|
|
203
|
-
return this.mapCustomMenuItemToAgGridMenuDefinition(subMenuItem, menuContext);
|
|
204
|
-
}).filter(Boolean),
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
logMenuDeprecation(type) {
|
|
208
|
-
let hasDeprecatedOptions = false;
|
|
209
|
-
if (type === 'ColumnMenu') {
|
|
210
|
-
// if any of the deprecated options has a non-default value, log a deprecation warning
|
|
211
|
-
const deprecatedProps = [
|
|
212
|
-
'columnMenuItems',
|
|
213
|
-
'columnMenuOrder',
|
|
214
|
-
'showAdaptableColumnMenu',
|
|
215
|
-
];
|
|
216
|
-
deprecatedProps.forEach((propName) => {
|
|
217
|
-
var _a, _b;
|
|
218
|
-
if ((_b = (_a = this.adaptable._rawAdaptableOptions) === null || _a === void 0 ? void 0 : _a.menuOptions) === null || _b === void 0 ? void 0 : _b[propName]) {
|
|
219
|
-
logDeprecation(this.adaptable.logger, 'MenuOptions', propName, 'customColumnMenu');
|
|
220
|
-
hasDeprecatedOptions = true;
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
if (type === 'ContextMenu') {
|
|
225
|
-
// if any of the deprecated options has a non-default value, log a deprecation warning
|
|
226
|
-
const deprecatedProps = [
|
|
227
|
-
'contextMenuItems',
|
|
228
|
-
'contextMenuOrder',
|
|
229
|
-
'showAdaptableContextMenu',
|
|
230
|
-
];
|
|
231
|
-
deprecatedProps.forEach((propName) => {
|
|
232
|
-
var _a, _b;
|
|
233
|
-
if ((_b = (_a = this.adaptable._rawAdaptableOptions) === null || _a === void 0 ? void 0 : _a.menuOptions) === null || _b === void 0 ? void 0 : _b[propName]) {
|
|
234
|
-
logDeprecation(this.adaptable.logger, 'MenuOptions', propName, 'customContextMenu');
|
|
235
|
-
hasDeprecatedOptions = true;
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
return hasDeprecatedOptions;
|
|
240
|
-
}
|
|
241
|
-
createAgGridMenuDefFromAdaptableMenu(adaptableMenuItem) {
|
|
242
|
-
const subMenuItems = ArrayExtensions.IsNotNullOrEmpty(adaptableMenuItem.subItems)
|
|
243
|
-
? adaptableMenuItem.subItems.map((amu) => {
|
|
244
|
-
return this.createAgGridMenuDefFromAdaptableMenu(amu);
|
|
245
|
-
})
|
|
246
|
-
: undefined;
|
|
247
|
-
return {
|
|
248
|
-
name: adaptableMenuItem.label,
|
|
249
|
-
action: adaptableMenuItem.onClick
|
|
250
|
-
? adaptableMenuItem.onClick
|
|
251
|
-
: adaptableMenuItem.reduxAction
|
|
252
|
-
? () => this.adaptable.api.internalApi.dispatchReduxAction(adaptableMenuItem.reduxAction)
|
|
253
|
-
: undefined,
|
|
254
|
-
icon: this.mapAdaptableIconToAgGridIcon(adaptableMenuItem.icon, {
|
|
255
|
-
fill: 'var(--ab-color-text-on-primary)',
|
|
256
|
-
}),
|
|
257
|
-
subMenu: subMenuItems,
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
createAgGridColumnMenuDefFromUserMenu(menuItem, menuContext) {
|
|
261
|
-
const fn = menuItem.onClick;
|
|
262
|
-
const disabled = menuItem.disabled && menuItem.disabled(menuContext);
|
|
263
|
-
const icon = typeof menuItem.icon === 'function' ? menuItem.icon(menuContext) : menuItem.icon;
|
|
264
|
-
return {
|
|
265
|
-
name: this.getLabelFromUserColumnMenuItem(menuItem, menuContext),
|
|
266
|
-
action: () => (fn ? fn(menuContext) : null),
|
|
267
|
-
icon: this.mapAdaptableIconToAgGridIcon(icon, {
|
|
268
|
-
fill: 'var(--ab-color-text-on-primary)',
|
|
269
|
-
}),
|
|
270
|
-
disabled: disabled,
|
|
271
|
-
subMenu: ArrayExtensions.IsNullOrEmpty(menuItem.subMenuItems)
|
|
272
|
-
? undefined
|
|
273
|
-
: menuItem.subMenuItems.map((subMenuItem) => {
|
|
274
|
-
return this.createAgGridColumnMenuDefFromUserMenu(subMenuItem, menuContext);
|
|
275
|
-
}),
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
createAgGridContextMenuDefFromUserMenu(menuItem, menuContext) {
|
|
279
|
-
const fn = menuItem.onClick;
|
|
280
|
-
const disabled = menuItem.disabled && menuItem.disabled(menuContext);
|
|
281
|
-
const icon = typeof menuItem.icon === 'function' ? menuItem.icon(menuContext) : menuItem.icon;
|
|
282
|
-
return {
|
|
283
|
-
name: this.getLabelFromUserContextMenuItem(menuItem, menuContext),
|
|
284
|
-
action: () => (fn ? fn(menuContext) : null),
|
|
285
|
-
icon: this.mapAdaptableIconToAgGridIcon(icon, {
|
|
286
|
-
fill: 'var(--ab-color-text-on-primary)',
|
|
287
|
-
}),
|
|
288
|
-
disabled: disabled,
|
|
289
|
-
subMenu: ArrayExtensions.IsNullOrEmpty(menuItem.subMenuItems)
|
|
290
|
-
? undefined
|
|
291
|
-
: menuItem.subMenuItems.map((subMenuItem) => {
|
|
292
|
-
return this.createAgGridContextMenuDefFromUserMenu(subMenuItem, menuContext);
|
|
293
|
-
}),
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
mapAdaptableIconToAgGridIcon(adaptableIcon, style) {
|
|
297
|
-
const icon = this.adaptable.api.userInterfaceApi.internalApi.prepareAdaptableIconDef(adaptableIcon);
|
|
298
|
-
if (isAdaptableElementIcon(icon)) {
|
|
299
|
-
let element = icon.element;
|
|
300
|
-
if (typeof element === 'string') {
|
|
301
|
-
return element;
|
|
302
|
-
}
|
|
303
|
-
// THe element neets to be cloned.
|
|
304
|
-
// when it is used in more than one plce the element is removed from the DOM
|
|
305
|
-
return element.cloneNode(true);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
return iconToString(icon, {
|
|
309
|
-
fill: 'var(--ab-color-text-on-primary)',
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
createAdaptableColumnMenuItemFromUserMenu(menuItem, menuContext) {
|
|
314
|
-
const fn = menuItem.onClick;
|
|
315
|
-
let adaptableMenuItem = {
|
|
316
|
-
module: 'General',
|
|
317
|
-
label: this.getLabelFromUserColumnMenuItem(menuItem, menuContext),
|
|
318
|
-
reduxAction: null,
|
|
319
|
-
onClick: () => (fn ? fn(menuContext) : null),
|
|
320
|
-
isVisible: true,
|
|
321
|
-
icon: menuItem.icon,
|
|
322
|
-
};
|
|
323
|
-
return adaptableMenuItem;
|
|
324
|
-
}
|
|
325
|
-
createAgGridColumnMenuItems(originalgetMainMenuItems, params) {
|
|
326
|
-
// if there was an initial implementation we init the list of menu items with this one; otherwise we take the default items
|
|
327
|
-
return originalgetMainMenuItems
|
|
328
|
-
? originalgetMainMenuItems(params)
|
|
329
|
-
: params.defaultItems.slice(0);
|
|
330
|
-
}
|
|
331
|
-
createAdaptableColumnMenuItems_DEPRECATED(adaptableColumn, menuContext) {
|
|
332
|
-
let columnMenuItems = [];
|
|
333
|
-
// First get all the Module based Adaptable Menu Items
|
|
334
|
-
const adaptableMenuItems = this.getAdaptableMenuItemsColumnHeader(adaptableColumn, menuContext);
|
|
335
|
-
// sort Adaptable menu items by default order
|
|
336
|
-
adaptableMenuItems.sort((first, second) => {
|
|
337
|
-
const firstPriority = DEFAULT_ADAPTABLE_COLUMN_MENU_ORDER.indexOf(first.module);
|
|
338
|
-
const secondPriority = DEFAULT_ADAPTABLE_COLUMN_MENU_ORDER.indexOf(second.module);
|
|
339
|
-
return firstPriority - secondPriority;
|
|
340
|
-
});
|
|
341
|
-
// And then convert them into Menu Item Defs
|
|
342
|
-
adaptableMenuItems.forEach((adaptableMenuItem) => {
|
|
343
|
-
let menuItem = this.createAgGridMenuDefFromAdaptableMenu(adaptableMenuItem);
|
|
344
|
-
columnMenuItems.push(menuItem);
|
|
345
|
-
});
|
|
346
|
-
return columnMenuItems;
|
|
347
|
-
}
|
|
348
|
-
createUserColumnMenuItems(menuContext) {
|
|
349
|
-
let columnMenuItems = [];
|
|
350
|
-
let userColumnMenuItems = this.getUserMenuItemsColumnHeader(menuContext);
|
|
351
|
-
if (ArrayExtensions.IsNotNullOrEmpty(userColumnMenuItems)) {
|
|
352
|
-
userColumnMenuItems.forEach((userMenuItem) => {
|
|
353
|
-
// And then convert them into Menu Item Defs
|
|
354
|
-
let menuItem = this.createAgGridColumnMenuDefFromUserMenu(userMenuItem, menuContext);
|
|
355
|
-
columnMenuItems.push(menuItem);
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
return columnMenuItems;
|
|
359
|
-
}
|
|
360
|
-
createColumnMenuContextObject(adaptableColumn, agGridColumn) {
|
|
361
|
-
return {
|
|
362
|
-
adaptableColumn: adaptableColumn,
|
|
363
|
-
agGridColumn: agGridColumn,
|
|
364
|
-
adaptableApi: this.adaptable.api,
|
|
365
|
-
userName: this.adaptable.adaptableOptions.userName,
|
|
366
|
-
adaptableId: this.adaptable.adaptableOptions.adaptableId,
|
|
367
|
-
isRowGroupColumn: this.adaptable.api.columnApi.isAutoRowGroupColumn(agGridColumn.getColId()),
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
createContextMenuContextObject(params, adaptableColumn) {
|
|
371
|
-
// lets build a picture of what has been right clicked. Will take time to get right but lets start
|
|
372
|
-
let isSingleSelectedColumn = false;
|
|
373
|
-
let isSelectedCell = false;
|
|
374
|
-
let isSelectedRow = false;
|
|
375
|
-
// row group columns dont provide an AdapTable Column so return bare minimum
|
|
376
|
-
if (!adaptableColumn) {
|
|
377
|
-
return {
|
|
378
|
-
isSelectedCell: false,
|
|
379
|
-
isSelectedRow: false,
|
|
380
|
-
gridCell: undefined,
|
|
381
|
-
adaptableColumn: undefined,
|
|
382
|
-
agGridColumn: params.column,
|
|
383
|
-
rowNode: params.node,
|
|
384
|
-
isGroupedNode: params.node ? params.node.group : false,
|
|
385
|
-
isSingleSelectedColumn: false,
|
|
386
|
-
isSingleSelectedCell: false,
|
|
387
|
-
primaryKeyValue: undefined,
|
|
388
|
-
adaptableApi: this.adaptable.api,
|
|
389
|
-
userName: this.adaptable.adaptableOptions.userName,
|
|
390
|
-
adaptableId: this.adaptable.adaptableOptions.adaptableId,
|
|
391
|
-
selectedCellInfo: undefined,
|
|
392
|
-
selectedRowInfo: undefined,
|
|
393
|
-
isRowGroupColumn: this.adaptable.api.columnApi.isAutoRowGroupColumn(params.column.getColId()),
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
const clickedCell = this.adaptable.getGridCellFromRowNode(params.node, adaptableColumn.columnId);
|
|
397
|
-
const selectedCellInfo = this.adaptable.api.gridApi.getSelectedCellInfo();
|
|
398
|
-
if (selectedCellInfo) {
|
|
399
|
-
let matchedCell = selectedCellInfo.gridCells.find((gc) => gc != null &&
|
|
400
|
-
gc.column == clickedCell.column &&
|
|
401
|
-
gc.primaryKeyValue == clickedCell.primaryKeyValue);
|
|
402
|
-
isSelectedCell = matchedCell != null;
|
|
403
|
-
if (isSelectedCell) {
|
|
404
|
-
isSingleSelectedColumn = ArrayExtensions.CorrectLength(selectedCellInfo.columns, 1);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
const selectedRowInfo = this.adaptable.api.gridApi.getSelectedRowInfo();
|
|
408
|
-
if (selectedRowInfo) {
|
|
409
|
-
const matchedPKValue = selectedRowInfo.gridRows.find((gr) => gr != null && gr.primaryKeyValue == clickedCell.primaryKeyValue);
|
|
410
|
-
isSelectedRow = matchedPKValue != null;
|
|
411
|
-
}
|
|
412
|
-
return {
|
|
413
|
-
isSelectedCell: isSelectedCell,
|
|
414
|
-
isSelectedRow: isSelectedRow,
|
|
415
|
-
gridCell: clickedCell,
|
|
416
|
-
adaptableColumn: adaptableColumn,
|
|
417
|
-
agGridColumn: params.column,
|
|
418
|
-
rowNode: params.node,
|
|
419
|
-
isGroupedNode: params.node ? params.node.group : false,
|
|
420
|
-
isSingleSelectedColumn: isSingleSelectedColumn,
|
|
421
|
-
isSingleSelectedCell: isSelectedCell && (selectedCellInfo === null || selectedCellInfo === void 0 ? void 0 : selectedCellInfo.gridCells.length) == 1,
|
|
422
|
-
primaryKeyValue: clickedCell ? clickedCell.primaryKeyValue : undefined,
|
|
423
|
-
adaptableApi: this.adaptable.api,
|
|
424
|
-
userName: this.adaptable.adaptableOptions.userName,
|
|
425
|
-
adaptableId: this.adaptable.adaptableOptions.adaptableId,
|
|
426
|
-
selectedCellInfo: selectedCellInfo,
|
|
427
|
-
selectedRowInfo: selectedRowInfo,
|
|
428
|
-
isRowGroupColumn: this.adaptable.api.columnApi.isAutoRowGroupColumn(params.column.getColId()),
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
createAgGridContextMenuItems(originalgetContextMenuItems, params) {
|
|
432
|
-
// if there was an initial implementation we init the list of menu items with this one, otherwise we take default items
|
|
433
|
-
// this allows us to ensure that devs can still create their own agGrid context menu without losing ours
|
|
434
|
-
return originalgetContextMenuItems
|
|
435
|
-
? originalgetContextMenuItems(params).slice(0)
|
|
436
|
-
: params.defaultItems
|
|
437
|
-
? params.defaultItems.slice(0)
|
|
438
|
-
: [];
|
|
439
|
-
}
|
|
440
|
-
createAdaptableContextMenuItems(menuContext) {
|
|
441
|
-
let contextMenuItems = [];
|
|
442
|
-
this.adaptable.adaptableModules.forEach((module) => {
|
|
443
|
-
let menuItems = module.addContextMenuItems(menuContext);
|
|
444
|
-
if (menuItems) {
|
|
445
|
-
contextMenuItems.push(...menuItems.filter(Boolean).filter((item) => item.isVisible !== false));
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
this.adaptable._emitSync('CreateAdaptableContextMenuItems', {
|
|
449
|
-
items: contextMenuItems,
|
|
450
|
-
menuContext: menuContext,
|
|
451
|
-
});
|
|
452
|
-
return contextMenuItems;
|
|
453
|
-
}
|
|
454
|
-
createAgGridAdaptableContextMenuItems(adaptableMenuItems, menuContext) {
|
|
455
|
-
// here we create agGrid Menu items based on Adaptable Menu Items
|
|
456
|
-
// user has ability to decide whether to show or not
|
|
457
|
-
let contextMenuItems = [];
|
|
458
|
-
let showAdaptableContextMenu = this.adaptable.adaptableOptions.menuOptions.showAdaptableContextMenu;
|
|
459
|
-
if (showAdaptableContextMenu == null || showAdaptableContextMenu !== false) {
|
|
460
|
-
adaptableMenuItems.forEach((adaptableMenuItem) => {
|
|
461
|
-
if (adaptableMenuItem) {
|
|
462
|
-
let addContextMenuItem = true;
|
|
463
|
-
if (showAdaptableContextMenu != null && typeof showAdaptableContextMenu === 'function') {
|
|
464
|
-
addContextMenuItem = showAdaptableContextMenu(adaptableMenuItem, menuContext);
|
|
465
|
-
}
|
|
466
|
-
if (addContextMenuItem) {
|
|
467
|
-
let menuItem = this.createAgGridMenuDefFromAdaptableMenu(adaptableMenuItem);
|
|
468
|
-
contextMenuItems.push(menuItem);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
return contextMenuItems;
|
|
474
|
-
}
|
|
475
|
-
createAgGridUserContextMenuItems(userContextMenuItems, menuContext) {
|
|
476
|
-
// here we create agGrid Menu items based on Adaptable Menu Items
|
|
477
|
-
// user has ability to decide whether to show or not
|
|
478
|
-
let contextMenuItems = [];
|
|
479
|
-
userContextMenuItems
|
|
480
|
-
.filter((userMenuItem) => !!userMenuItem)
|
|
481
|
-
.filter((userMenuItem) => {
|
|
482
|
-
return userMenuItem.hidden ? !userMenuItem.hidden(menuContext) : true;
|
|
483
|
-
})
|
|
484
|
-
.forEach((userMenuItem) => {
|
|
485
|
-
let menuItem = this.createAgGridContextMenuDefFromUserMenu(userMenuItem, menuContext);
|
|
486
|
-
contextMenuItems.push(menuItem);
|
|
487
|
-
});
|
|
488
|
-
return contextMenuItems;
|
|
489
|
-
}
|
|
490
|
-
// method to get all the Adaptable Menu Items - together with running the function where user can choose whether or not to display
|
|
491
|
-
getAdaptableMenuItemsColumnHeader(adaptableColumn, menuContext) {
|
|
492
|
-
const adaptableMenuItems = [];
|
|
493
|
-
let showAdaptableColumnMenu = this.adaptable.adaptableOptions.menuOptions.showAdaptableColumnMenu;
|
|
494
|
-
let runCheck = showAdaptableColumnMenu == null || showAdaptableColumnMenu !== false;
|
|
495
|
-
// if (adaptableColumn != null) {
|
|
496
|
-
this.adaptable.adaptableModules.forEach((s) => {
|
|
497
|
-
let menuItems = s.addColumnMenuItems(adaptableColumn);
|
|
498
|
-
if (menuItems) {
|
|
499
|
-
if (runCheck) {
|
|
500
|
-
menuItems.forEach((adaptableMenuItem) => {
|
|
501
|
-
if (adaptableMenuItem) {
|
|
502
|
-
let addColumnMenuItem = true;
|
|
503
|
-
if (showAdaptableColumnMenu != null &&
|
|
504
|
-
typeof showAdaptableColumnMenu === 'function') {
|
|
505
|
-
addColumnMenuItem = showAdaptableColumnMenu(adaptableMenuItem, menuContext);
|
|
506
|
-
}
|
|
507
|
-
if (addColumnMenuItem) {
|
|
508
|
-
adaptableMenuItems.push(adaptableMenuItem);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
else {
|
|
514
|
-
adaptableMenuItems.push(...menuItems);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
});
|
|
518
|
-
// }
|
|
519
|
-
return adaptableMenuItems;
|
|
520
|
-
}
|
|
521
|
-
getLabelFromUserColumnMenuItem(userColumnMenuItem, menuContext) {
|
|
522
|
-
return typeof userColumnMenuItem.label === 'function'
|
|
523
|
-
? userColumnMenuItem.label(menuContext)
|
|
524
|
-
: userColumnMenuItem.label;
|
|
525
|
-
}
|
|
526
|
-
getLabelFromUserContextMenuItem(userContextMenuItem, menuContext) {
|
|
527
|
-
return typeof userContextMenuItem.label === 'function'
|
|
528
|
-
? userContextMenuItem.label(menuContext)
|
|
529
|
-
: userContextMenuItem.label;
|
|
530
|
-
}
|
|
531
|
-
getUserMenuItemsColumnHeader(menuContext) {
|
|
532
|
-
var _a, _b;
|
|
533
|
-
return (_b = (_a = this.adaptable.adaptableOptions.menuOptions) === null || _a === void 0 ? void 0 : _a.columnMenuItems) === null || _b === void 0 ? void 0 : _b.filter((userMenuItem) => {
|
|
534
|
-
return userMenuItem.hidden ? !userMenuItem.hidden(menuContext) : true;
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
buildStandaloneColumnHeader(adaptableColumn) {
|
|
538
|
-
const agGridColumn = this.adaptable.api.columnApi.internalApi.getAgGridColumnForAdaptableColumn(adaptableColumn.columnId);
|
|
539
|
-
let menuContext = this.createColumnMenuContextObject(adaptableColumn, agGridColumn);
|
|
540
|
-
let returnMenuItems = [];
|
|
541
|
-
returnMenuItems.push(...this.getAdaptableMenuItemsColumnHeader(adaptableColumn, menuContext));
|
|
542
|
-
let userColumnMenuItems = this.getUserMenuItemsColumnHeader(menuContext);
|
|
543
|
-
if (ArrayExtensions.IsNotNullOrEmpty(userColumnMenuItems)) {
|
|
544
|
-
userColumnMenuItems.forEach((userMenuItem) => {
|
|
545
|
-
let adaptableMenuItem = this.createAdaptableColumnMenuItemFromUserMenu(userMenuItem, menuContext);
|
|
546
|
-
returnMenuItems.push(adaptableMenuItem);
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
return returnMenuItems;
|
|
550
|
-
}
|
|
551
|
-
/**
|
|
552
|
-
* !!! This should be deleted once MenuOptions loses all the deprecated options
|
|
553
|
-
*/
|
|
554
|
-
buildContextMenuDeprecated(params, originalGetContextMenuItems) {
|
|
555
|
-
let agGridContextMenuItems = [];
|
|
556
|
-
let adaptableContextMenuItems = [];
|
|
557
|
-
let userContextMenuItems = [];
|
|
558
|
-
const menuOptions = this.adaptable.adaptableOptions.menuOptions;
|
|
559
|
-
let showAdaptableContextMenu = menuOptions.showAdaptableContextMenu;
|
|
560
|
-
let hasAdaptableContextMenuItems = showAdaptableContextMenu == null || showAdaptableContextMenu !== false;
|
|
561
|
-
let userDefinedContextMenuItems = menuOptions.contextMenuItems;
|
|
562
|
-
let hasUserDefinedContextMenuItems = ArrayExtensions.IsNotNullOrEmpty(userDefinedContextMenuItems);
|
|
563
|
-
const agGridMenuItems = this.createAgGridContextMenuItems(originalGetContextMenuItems, params);
|
|
564
|
-
if (agGridMenuItems === null || agGridMenuItems === void 0 ? void 0 : agGridMenuItems.length) {
|
|
565
|
-
agGridContextMenuItems.push(...agGridMenuItems);
|
|
566
|
-
if (hasAdaptableContextMenuItems || hasUserDefinedContextMenuItems) {
|
|
567
|
-
agGridContextMenuItems.push('separator');
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
const adaptableMenuItems = [];
|
|
571
|
-
const agGridColumn = params.column;
|
|
572
|
-
let adaptableColumn;
|
|
573
|
-
if (agGridColumn) {
|
|
574
|
-
adaptableColumn = this.adaptable.api.columnApi.getColumnWithColumnId(agGridColumn.getColId());
|
|
575
|
-
// if (adaptableColumn != undefined) {
|
|
576
|
-
let menuContext = this.createContextMenuContextObject(params, adaptableColumn);
|
|
577
|
-
// keep it simple for now - if its a grouped cell then don't add the shipped menu items
|
|
578
|
-
// if (adaptableColumn && !params.node.group) {
|
|
579
|
-
const allAdaptableMenuItems = this.createAdaptableContextMenuItems(menuContext);
|
|
580
|
-
if (ArrayExtensions.IsNotNullOrEmpty(allAdaptableMenuItems)) {
|
|
581
|
-
adaptableMenuItems.push(...allAdaptableMenuItems);
|
|
582
|
-
}
|
|
583
|
-
adaptableMenuItems.sort((first, second) => {
|
|
584
|
-
const firstPriority = DEFAULT_ADAPTABLE_CONTEXT_MENU_STRUCTURE.indexOf(first.module);
|
|
585
|
-
const secondPriority = DEFAULT_ADAPTABLE_CONTEXT_MENU_STRUCTURE.indexOf(second.module);
|
|
586
|
-
return firstPriority - secondPriority;
|
|
587
|
-
});
|
|
588
|
-
// }
|
|
589
|
-
// create agGrid Menu items based on Adaptable Menu Items - user can decide whether to show or not
|
|
590
|
-
if (ArrayExtensions.IsNotNullOrEmpty(adaptableMenuItems) && hasAdaptableContextMenuItems) {
|
|
591
|
-
adaptableContextMenuItems.push(...this.createAgGridAdaptableContextMenuItems(adaptableMenuItems, menuContext));
|
|
592
|
-
}
|
|
593
|
-
// create agGrid Menu items based on User Menu Items - user can decide whether to show or not
|
|
594
|
-
if (hasUserDefinedContextMenuItems) {
|
|
595
|
-
userContextMenuItems.push(...this.createAgGridUserContextMenuItems(userDefinedContextMenuItems, menuContext));
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
const map = {
|
|
599
|
-
aggrid: agGridContextMenuItems,
|
|
600
|
-
adaptable: adaptableContextMenuItems,
|
|
601
|
-
user: userContextMenuItems,
|
|
602
|
-
};
|
|
603
|
-
const menuItemsArray = menuOptions.contextMenuOrder;
|
|
604
|
-
let arr = [];
|
|
605
|
-
if (menuItemsArray != null && typeof menuItemsArray === 'function') {
|
|
606
|
-
arr = menuItemsArray({
|
|
607
|
-
adaptableApi: this.adaptable.api,
|
|
608
|
-
userName: this.adaptable.adaptableOptions.userName,
|
|
609
|
-
adaptableId: this.adaptable.adaptableOptions.adaptableId,
|
|
610
|
-
column: adaptableColumn,
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
else {
|
|
614
|
-
arr = menuItemsArray;
|
|
615
|
-
}
|
|
616
|
-
return flatten(arr.map((c) => {
|
|
617
|
-
return map[c];
|
|
618
|
-
}));
|
|
619
|
-
}
|
|
620
|
-
/**
|
|
621
|
-
* !!! This should be deleted once MenuOptions loses all the deprecated options
|
|
622
|
-
*/
|
|
623
|
-
buildColumnMenuDeprecated(params, originalgetMainMenuItems) {
|
|
624
|
-
// couldnt find a way to listen for menu close. There is a Menu Item Select, but you can also close menu from filter and clicking outside menu....
|
|
625
|
-
const colId = params.column.getColId();
|
|
626
|
-
let agGridColumnMenuItems = [];
|
|
627
|
-
let adaptableColumnMenuItems = [];
|
|
628
|
-
let userColumnMenuItems = [];
|
|
629
|
-
const menuOptions = this.adaptable.adaptableOptions.menuOptions;
|
|
630
|
-
//First get Ag Grid Column Items
|
|
631
|
-
agGridColumnMenuItems.push(...this.createAgGridColumnMenuItems(originalgetMainMenuItems, params));
|
|
632
|
-
let showAdaptableColumnMenu = menuOptions.showAdaptableColumnMenu;
|
|
633
|
-
let hasAdaptableColumnMenuItems = showAdaptableColumnMenu == null || showAdaptableColumnMenu !== false;
|
|
634
|
-
if (hasAdaptableColumnMenuItems) {
|
|
635
|
-
agGridColumnMenuItems.push('separator');
|
|
636
|
-
}
|
|
637
|
-
const adaptableColumn = this.adaptable.api.columnApi.getColumnWithColumnId(colId);
|
|
638
|
-
const menuContext = this.createColumnMenuContextObject(adaptableColumn, params.column);
|
|
639
|
-
// if (adaptableColumn != undefined) {
|
|
640
|
-
if (hasAdaptableColumnMenuItems) {
|
|
641
|
-
adaptableColumnMenuItems.push(...this.createAdaptableColumnMenuItems_DEPRECATED(adaptableColumn, menuContext));
|
|
642
|
-
}
|
|
643
|
-
// }
|
|
644
|
-
// Finally get all the User Menu Items
|
|
645
|
-
userColumnMenuItems.push(...this.createUserColumnMenuItems(menuContext));
|
|
646
|
-
const map = {
|
|
647
|
-
aggrid: agGridColumnMenuItems,
|
|
648
|
-
adaptable: adaptableColumnMenuItems,
|
|
649
|
-
user: userColumnMenuItems,
|
|
650
|
-
};
|
|
651
|
-
const menuItemsArray = menuOptions.columnMenuOrder;
|
|
652
|
-
let arr = [];
|
|
653
|
-
if (menuItemsArray != null && typeof menuItemsArray === 'function') {
|
|
654
|
-
arr = menuItemsArray({
|
|
655
|
-
adaptableApi: this.adaptable.api,
|
|
656
|
-
userName: this.adaptable.adaptableOptions.userName,
|
|
657
|
-
adaptableId: this.adaptable.adaptableOptions.adaptableId,
|
|
658
|
-
column: adaptableColumn,
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
else {
|
|
662
|
-
arr = menuItemsArray;
|
|
663
|
-
}
|
|
664
|
-
return flatten(arr.map((c) => {
|
|
665
|
-
return map[c];
|
|
666
|
-
}));
|
|
667
|
-
}
|
|
668
|
-
}
|
|
File without changes
|
|
File without changes
|