@adaptabletools/adaptable 18.0.0-canary.4 → 18.0.0-canary.6

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.
Files changed (170) hide show
  1. package/agGrid.d.ts +4 -21
  2. package/agGrid.js +9 -26
  3. package/base.css +1 -1
  4. package/base.css.map +1 -1
  5. package/index.css +74 -68
  6. package/index.css.map +1 -1
  7. package/package.json +3 -4
  8. package/src/AdaptableInterfaces/IAdaptable.d.ts +55 -109
  9. package/src/AdaptableOptions/AdaptableOptions.d.ts +6 -0
  10. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +17 -0
  11. package/src/Api/AdaptableApi.d.ts +5 -0
  12. package/src/Api/ColumnFilterApi.d.ts +0 -5
  13. package/src/Api/Events/AdaptableReady.d.ts +3 -3
  14. package/src/Api/Events/GridDataChanged.d.ts +4 -4
  15. package/src/Api/GridApi.d.ts +14 -13
  16. package/src/Api/Implementation/ActionColumnApiImpl.d.ts +2 -0
  17. package/src/Api/Implementation/ActionColumnApiImpl.js +33 -0
  18. package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -0
  19. package/src/Api/Implementation/AdaptableApiImpl.js +3 -0
  20. package/src/Api/Implementation/ApiBase.d.ts +2 -1
  21. package/src/Api/Implementation/ApiBase.js +3 -0
  22. package/src/Api/Implementation/ColumnFilterApiImpl.d.ts +0 -1
  23. package/src/Api/Implementation/ColumnFilterApiImpl.js +0 -10
  24. package/src/Api/Implementation/CommentsApiImpl.js +2 -1
  25. package/src/Api/Implementation/ConfigApiImpl.js +8 -3
  26. package/src/Api/Implementation/GridApiImpl.d.ts +3 -3
  27. package/src/Api/Implementation/GridApiImpl.js +20 -14
  28. package/src/Api/Implementation/StatusBarApiImpl.d.ts +0 -1
  29. package/src/Api/Implementation/StatusBarApiImpl.js +0 -3
  30. package/src/Api/Implementation/ToolPanelApiImpl.js +6 -6
  31. package/src/Api/Internal/ActionRowInternalApi.d.ts +5 -1
  32. package/src/Api/Internal/ActionRowInternalApi.js +106 -0
  33. package/src/Api/Internal/AdaptableInternalApi.d.ts +3 -4
  34. package/src/Api/Internal/AdaptableInternalApi.js +10 -8
  35. package/src/Api/Internal/CalculatedColumnInternalApi.d.ts +2 -0
  36. package/src/Api/Internal/CalculatedColumnInternalApi.js +70 -0
  37. package/src/Api/Internal/ColumnFilterInternalApi.d.ts +1 -0
  38. package/src/Api/Internal/ColumnFilterInternalApi.js +11 -1
  39. package/src/Api/Internal/ColumnInternalApi.d.ts +4 -1
  40. package/src/Api/Internal/ColumnInternalApi.js +12 -0
  41. package/src/Api/Internal/CustomSortInternalApi.d.ts +3 -2
  42. package/src/Api/Internal/CustomSortInternalApi.js +32 -1
  43. package/src/Api/Internal/DataSetInternalApi.js +1 -1
  44. package/src/Api/Internal/FreeTextColumnInternalApi.d.ts +2 -0
  45. package/src/Api/Internal/FreeTextColumnInternalApi.js +59 -0
  46. package/src/Api/Internal/GridFilterInternalApi.js +1 -1
  47. package/src/Api/Internal/GridInternalApi.d.ts +21 -3
  48. package/src/Api/Internal/GridInternalApi.js +126 -7
  49. package/src/Api/Internal/TeamSharingInternalApi.js +1 -1
  50. package/src/EnvVars.d.ts +3 -0
  51. package/src/EnvVars.js +4 -0
  52. package/src/PredefinedConfig/Common/AggregationColumns.d.ts +1 -0
  53. package/src/PredefinedConfig/Common/AggregationColumns.js +3 -0
  54. package/src/PredefinedConfig/Common/DataUpdateConfig.d.ts +8 -0
  55. package/src/Redux/Store/AdaptableStore.d.ts +4 -6
  56. package/src/Redux/Store/AdaptableStore.js +22 -50
  57. package/src/Redux/Store/Interface/IAdaptableStore.d.ts +7 -1
  58. package/src/Strategy/AdaptableModuleBase.d.ts +2 -3
  59. package/src/Strategy/AdaptableModuleBase.js +4 -7
  60. package/src/Strategy/AlertModule.d.ts +1 -2
  61. package/src/Strategy/AlertModule.js +2 -55
  62. package/src/Strategy/CalculatedColumnModule.d.ts +2 -3
  63. package/src/Strategy/CalculatedColumnModule.js +5 -25
  64. package/src/Strategy/ChartingModule.d.ts +0 -1
  65. package/src/Strategy/ChartingModule.js +0 -21
  66. package/src/Strategy/ColumnFilterModule.d.ts +1 -2
  67. package/src/Strategy/ColumnFilterModule.js +1 -64
  68. package/src/Strategy/CommentsModule.d.ts +1 -0
  69. package/src/Strategy/CommentsModule.js +2 -1
  70. package/src/Strategy/CustomSortModule.js +1 -1
  71. package/src/Strategy/DashboardModule.d.ts +1 -2
  72. package/src/Strategy/DashboardModule.js +1 -8
  73. package/src/Strategy/DataChangeHistoryModule.d.ts +1 -0
  74. package/src/Strategy/DataChangeHistoryModule.js +3 -1
  75. package/src/Strategy/DataSetModule.d.ts +1 -1
  76. package/src/Strategy/DataSetModule.js +1 -1
  77. package/src/Strategy/FlashingCellModule.d.ts +1 -2
  78. package/src/Strategy/FlashingCellModule.js +2 -15
  79. package/src/Strategy/FormatColumnModule.d.ts +0 -2
  80. package/src/Strategy/FormatColumnModule.js +0 -47
  81. package/src/Strategy/FreeTextColumnModule.d.ts +0 -1
  82. package/src/Strategy/FreeTextColumnModule.js +0 -30
  83. package/src/Strategy/GridFilterModule.d.ts +0 -1
  84. package/src/Strategy/GridFilterModule.js +0 -37
  85. package/src/Strategy/Interface/IModule.d.ts +0 -1
  86. package/src/Strategy/LayoutModule.d.ts +1 -3
  87. package/src/Strategy/LayoutModule.js +6 -50
  88. package/src/Strategy/NamedQueryModule.d.ts +0 -1
  89. package/src/Strategy/NamedQueryModule.js +0 -19
  90. package/src/Strategy/PlusMinusModule.d.ts +1 -1
  91. package/src/Strategy/PlusMinusModule.js +1 -1
  92. package/src/Strategy/ScheduleModule.d.ts +1 -1
  93. package/src/Strategy/ScheduleModule.js +1 -1
  94. package/src/Strategy/ShortcutModule.d.ts +1 -1
  95. package/src/Strategy/ShortcutModule.js +1 -1
  96. package/src/Strategy/StyledColumnModule.d.ts +0 -1
  97. package/src/Strategy/StyledColumnModule.js +0 -21
  98. package/src/Strategy/TeamSharingModule.d.ts +1 -0
  99. package/src/Strategy/TeamSharingModule.js +5 -5
  100. package/src/Strategy/ToolPanelModule.d.ts +0 -1
  101. package/src/Strategy/ToolPanelModule.js +0 -23
  102. package/src/Utilities/Constants/GeneralConstants.d.ts +1 -0
  103. package/src/Utilities/Constants/GeneralConstants.js +1 -0
  104. package/src/Utilities/Helpers/AdaptableHelper.d.ts +0 -3
  105. package/src/Utilities/Helpers/AdaptableHelper.js +0 -58
  106. package/src/Utilities/Services/CellPopupService.js +0 -1
  107. package/src/Utilities/Services/LicenseService/index.d.ts +3 -0
  108. package/src/Utilities/Services/LicenseService/index.js +10 -3
  109. package/src/Utilities/Services/MetamodelService.d.ts +1 -1
  110. package/src/Utilities/Services/MetamodelService.js +6 -3
  111. package/src/Utilities/Services/RowEditService.d.ts +3 -2
  112. package/src/Utilities/Services/RowEditService.js +3 -1
  113. package/src/View/AdaptableView.js +0 -2
  114. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +2 -2
  115. package/src/View/CalculatedColumn/utils.d.ts +1 -1
  116. package/src/View/CellSummary/CellSummaryPopup.js +1 -1
  117. package/src/View/Components/Popups/AdaptableLoadingScreen.d.ts +6 -5
  118. package/src/View/Components/Popups/AdaptableLoadingScreen.js +19 -9
  119. package/src/View/CustomSort/CustomSortSummary.js +1 -1
  120. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -1
  121. package/src/View/GridFilter/GridFilterViewPanel.js +6 -2
  122. package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +2 -3
  123. package/src/View/Layout/Wizard/LayoutWizard.js +1 -1
  124. package/src/agGrid/ActionColumnRenderer.js +4 -4
  125. package/src/agGrid/Adaptable.d.ts +3 -455
  126. package/src/agGrid/Adaptable.js +8 -5292
  127. package/src/agGrid/AdaptableAgGrid.d.ts +336 -0
  128. package/src/agGrid/AdaptableAgGrid.js +3810 -0
  129. package/src/agGrid/AdaptableLogger.js +77 -11
  130. package/src/agGrid/AgGridAdapter.d.ts +54 -0
  131. package/src/agGrid/AgGridAdapter.js +549 -0
  132. package/src/agGrid/AgGridColumnAdapter.d.ts +56 -0
  133. package/src/agGrid/AgGridColumnAdapter.js +813 -0
  134. package/src/agGrid/AgGridMenuAdapter.d.ts +28 -0
  135. package/src/agGrid/AgGridMenuAdapter.js +271 -0
  136. package/src/agGrid/AgGridOptionsService.d.ts +11 -0
  137. package/src/agGrid/AgGridOptionsService.js +50 -0
  138. package/src/agGrid/BadgeRenderer.js +1 -1
  139. package/src/agGrid/CheckboxRenderer.js +1 -1
  140. package/src/agGrid/FilterWrapper.d.ts +2 -2
  141. package/src/agGrid/FilterWrapper.js +1 -1
  142. package/src/agGrid/attachAddaptableColumnTypes.d.ts +12 -12
  143. package/src/agGrid/defaultAdaptableOptions.d.ts +3 -0
  144. package/src/{Utilities/Defaults/DefaultAdaptableOptions.js → agGrid/defaultAdaptableOptions.js} +69 -8
  145. package/src/agGrid/editors/AdaptableDateEditor/index.js +2 -2
  146. package/src/agGrid/editors/AdaptableNumberEditor/index.js +2 -2
  147. package/src/components/Datepicker/index.d.ts +1 -1
  148. package/src/components/InfiniteTable/index.js +2 -2
  149. package/src/components/Modal/index.d.ts +1 -0
  150. package/src/components/Modal/index.js +4 -3
  151. package/src/env.js +2 -2
  152. package/src/metamodel/adaptable.metamodel.d.ts +9 -9
  153. package/src/metamodel/adaptable.metamodel.js +7 -0
  154. package/src/migration/AdaptableUpgradeHelper.d.ts +38 -0
  155. package/src/migration/AdaptableUpgradeHelper.js +48 -0
  156. package/src/migration/VersionUpgrade.d.ts +8 -0
  157. package/src/migration/VersionUpgrade.js +11 -0
  158. package/src/migration/VersionUpgrade17.d.ts +18 -0
  159. package/src/migration/VersionUpgrade17.js +342 -0
  160. package/src/migration/VersionUpgrade18.d.ts +5 -0
  161. package/src/migration/VersionUpgrade18.js +6 -0
  162. package/src/types.d.ts +5 -4
  163. package/tsconfig.esm.tsbuildinfo +1 -1
  164. package/src/Utilities/Defaults/DefaultAdaptableOptions.d.ts +0 -2
  165. package/src/Utilities/Services/Interface/IRowEditService.d.ts +0 -3
  166. package/src/Utilities/Services/Interface/IRowEditService.js +0 -1
  167. package/src/agGrid/agGridHelper.d.ts +0 -57
  168. package/src/agGrid/agGridHelper.js +0 -686
  169. package/src/agGrid/agGridMenuHelper.d.ts +0 -46
  170. package/src/agGrid/agGridMenuHelper.js +0 -668
@@ -1,686 +0,0 @@
1
- import { createUuid } from '../PredefinedConfig/Uuid';
2
- import { AlertModule } from '../Strategy/AlertModule';
3
- import { BulkUpdateModule } from '../Strategy/BulkUpdateModule';
4
- import { CalculatedColumnModule } from '../Strategy/CalculatedColumnModule';
5
- import { CellSummaryModule } from '../Strategy/CellSummaryModule';
6
- import { ChartingModule } from '../Strategy/ChartingModule';
7
- import { ColumnInfoModule } from '../Strategy/ColumnInfoModule';
8
- import { CustomSortModule } from '../Strategy/CustomSortModule';
9
- import { DashboardModule } from '../Strategy/DashboardModule';
10
- import { DataChangeHistoryModule } from '../Strategy/DataChangeHistoryModule';
11
- import { DataImportModule } from '../Strategy/DataImportModule';
12
- import { DataSetModule } from '../Strategy/DataSetModule';
13
- import { ExportModule } from '../Strategy/ExportModule';
14
- import { Fdc3Module } from '../Strategy/Fdc3Module';
15
- import { ColumnFilterModule } from '../Strategy/ColumnFilterModule';
16
- import { FlashingCellModule } from '../Strategy/FlashingCellModule';
17
- import { FormatColumnModule } from '../Strategy/FormatColumnModule';
18
- import { FreeTextColumnModule } from '../Strategy/FreeTextColumnModule';
19
- import { GridFilterModule } from '../Strategy/GridFilterModule';
20
- import { GridInfoModule } from '../Strategy/GridInfoModule';
21
- import { LayoutModule } from '../Strategy/LayoutModule';
22
- import { NamedQueryModule } from '../Strategy/NamedQueryModule';
23
- import { NotesModule } from '../Strategy/NotesModule';
24
- import { PlusMinusModule } from '../Strategy/PlusMinusModule';
25
- import { QuickSearchModule } from '../Strategy/QuickSearchModule';
26
- import { ScheduleModule } from '../Strategy/ScheduleModule';
27
- import { SettingsPanelModule } from '../Strategy/SettingsPanelModule';
28
- import { ShortcutModule } from '../Strategy/ShortcutModule';
29
- import { SmartEditModule } from '../Strategy/SmartEditModule';
30
- import { StateManagementModule } from '../Strategy/StateManagementModule';
31
- import { StatusBarModule } from '../Strategy/StatusBarModule';
32
- import { StyledColumnModule } from '../Strategy/StyledColumnModule';
33
- import { SystemStatusModule } from '../Strategy/SystemStatusModule';
34
- import { TeamSharingModule } from '../Strategy/TeamSharingModule';
35
- import { ThemeModule } from '../Strategy/ThemeModule';
36
- import { ToolPanelModule } from '../Strategy/ToolPanelModule';
37
- import * as GeneralConstants from '../Utilities/Constants/GeneralConstants';
38
- import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME, ADAPTABLE_ROW_ACTION_BUTTONS, ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME, } from '../Utilities/Constants/GeneralConstants';
39
- import * as ModuleConstants from '../Utilities/Constants/ModuleConstants';
40
- import { ArrayExtensions } from '../Utilities/Extensions/ArrayExtensions';
41
- import { StringExtensions } from '../Utilities/Extensions/StringExtensions';
42
- import { Helper } from '../Utilities/Helpers/Helper';
43
- import UIHelper from '../View/UIHelper';
44
- import { getBadgeRendererForColumn } from './BadgeRenderer';
45
- import { getPercentBarRendererForColumn } from './PercentBarRenderer';
46
- import { CommentsModule } from '../Strategy/CommentsModule';
47
- import tinycolor from 'tinycolor2';
48
- /**
49
- * Adaptable AG Grid implementation is getting really big and unwieldy
50
- * So lets put some of the more obvious 'Helper' functions here
51
- * This is a bit crap - it should take a GridOptions object...
52
- */
53
- // tslint:disable-next-line: class-name
54
- export class agGridHelper {
55
- constructor(adaptable, gridOptions) {
56
- this.adaptable = adaptable;
57
- this.gridOptions = gridOptions;
58
- this.initialAgGridColDefs = {};
59
- }
60
- destroy() {
61
- this.adaptable = null;
62
- this.gridOptions = null;
63
- }
64
- getAgGridLightThemeName() {
65
- // we try not to call these two methods, as we try to detect the default grid
66
- // theme from the grid container element - users should set their aggrid theme in html, on the container element
67
- // so we read it from there. if we don't find it there, we'll call this method, as a last resort.
68
- return 'ag-theme-balham';
69
- }
70
- getAgGridDarkThemeName() {
71
- return 'ag-theme-balham-dark';
72
- }
73
- setUpModules() {
74
- const modules = new Map();
75
- const api = this.adaptable.api;
76
- // this is order is semi important as it currently decides the order of the items in the Column Menu
77
- // so we put Dashboard first and then the rest in alphabetical order with Grid Info last
78
- modules.set(ModuleConstants.DashboardModuleId, new DashboardModule(api));
79
- modules.set(ModuleConstants.AlertModuleId, new AlertModule(api));
80
- modules.set(ModuleConstants.FlashingCellModuleId, new FlashingCellModule(api));
81
- modules.set(ModuleConstants.BulkUpdateModuleId, new BulkUpdateModule(api));
82
- modules.set(ModuleConstants.CalculatedColumnModuleId, new CalculatedColumnModule(api));
83
- modules.set(ModuleConstants.CellSummaryModuleId, new CellSummaryModule(api));
84
- modules.set(ModuleConstants.CustomSortModuleId, new CustomSortModule(api));
85
- modules.set(ModuleConstants.DataChangeHistoryModuleId, new DataChangeHistoryModule(api));
86
- modules.set(ModuleConstants.DataImportModuleId, new DataImportModule(api));
87
- modules.set(ModuleConstants.DataSetModuleId, new DataSetModule(api));
88
- modules.set(ModuleConstants.ExportModuleId, new ExportModule(api));
89
- modules.set(ModuleConstants.ColumnFilterModuleId, new ColumnFilterModule(api));
90
- modules.set(ModuleConstants.FormatColumnModuleId, new FormatColumnModule(api));
91
- modules.set(ModuleConstants.FreeTextColumnModuleId, new FreeTextColumnModule(api));
92
- modules.set(ModuleConstants.LayoutModuleId, new LayoutModule(api));
93
- modules.set(ModuleConstants.PlusMinusModuleId, new PlusMinusModule(api));
94
- modules.set(ModuleConstants.QuickSearchModuleId, new QuickSearchModule(api));
95
- modules.set(ModuleConstants.ScheduleModuleId, new ScheduleModule(api));
96
- modules.set(ModuleConstants.SmartEditModuleId, new SmartEditModule(api));
97
- modules.set(ModuleConstants.ShortcutModuleId, new ShortcutModule(api));
98
- modules.set(ModuleConstants.StateManagementModuleId, new StateManagementModule(api));
99
- modules.set(ModuleConstants.TeamSharingModuleId, new TeamSharingModule(api));
100
- modules.set(ModuleConstants.ToolPanelModuleId, new ToolPanelModule(api));
101
- modules.set(ModuleConstants.SystemStatusModuleId, new SystemStatusModule(api));
102
- modules.set(ModuleConstants.ThemeModuleId, new ThemeModule(api));
103
- modules.set(ModuleConstants.GridInfoModuleId, new GridInfoModule(api));
104
- modules.set(ModuleConstants.ColumnInfoModuleId, new ColumnInfoModule(api));
105
- modules.set(ModuleConstants.SettingsPanelModuleId, new SettingsPanelModule(api));
106
- modules.set(ModuleConstants.StatusBarModuleId, new StatusBarModule(api));
107
- modules.set(ModuleConstants.ChartingModuleId, new ChartingModule(api));
108
- modules.set(ModuleConstants.NotesModuleId, new NotesModule(api));
109
- modules.set(ModuleConstants.StyledColumnModuleId, new StyledColumnModule(api));
110
- modules.set(ModuleConstants.Fdc3ModuleId, new Fdc3Module(api));
111
- modules.set(ModuleConstants.GridFilterModuleId, new GridFilterModule(api));
112
- modules.set(ModuleConstants.NamedQueryModuleId, new NamedQueryModule(api));
113
- modules.set(ModuleConstants.CommentsModuleId, new CommentsModule(api));
114
- return modules;
115
- }
116
- TrySetUpNodeIds(hasAutogeneratedPrimaryKey) {
117
- if (StringExtensions.IsNullOrEmpty(this.adaptable.adaptableOptions.primaryKey)) {
118
- // if no valid pk then always false
119
- return false;
120
- }
121
- if (Helper.objectExists(this.gridOptions.getRowId)) {
122
- return true;
123
- }
124
- const primaryKey = this.adaptable.adaptableOptions.primaryKey;
125
- if (hasAutogeneratedPrimaryKey) {
126
- this.gridOptions.getRowId = (params) => {
127
- // if the PK value is autogenerated, we need to make sure that the rowData has a valid PK value
128
- // this should be taken care of in the Adaptable.[loadDataSource/setDataSource/updateRows]() methods, but the users will always make silly decisions
129
- // so just to be safe we'll check here and add a PK value is missing
130
- // thus adding a side-effect in a getter, but what can we do against it?! :)
131
- if (Helper.objectNotExists(params.data[primaryKey])) {
132
- params.data[primaryKey] = createUuid();
133
- }
134
- return params.data[primaryKey];
135
- };
136
- }
137
- else {
138
- this.gridOptions.getRowId = (params) => {
139
- var _a;
140
- if (params.data[primaryKey]) {
141
- return params.data[primaryKey];
142
- }
143
- // row does not have primary key => might be a group row
144
- const parentKeys = (_a = params.parentKeys) !== null && _a !== void 0 ? _a : [];
145
- const values = Object.values(params.data);
146
- if (values.length) {
147
- const id = [...parentKeys, values[0]].join('/');
148
- return id;
149
- }
150
- };
151
- }
152
- return true;
153
- }
154
- createPercentBarRendererComp(styledColumn, abColumn) {
155
- return getPercentBarRendererForColumn(styledColumn, abColumn, this.adaptable.api);
156
- }
157
- createBadgeRendererComp(styledColumn, abColumn) {
158
- return getBadgeRendererForColumn(styledColumn, abColumn, this.adaptable.api);
159
- }
160
- getCleanValue(value) {
161
- if (typeof value === 'string') {
162
- return value;
163
- }
164
- if (value == null || value == 'null' || value == undefined || value == 'undefined') {
165
- return undefined;
166
- }
167
- return String(value) || '';
168
- }
169
- getRenderedValue(colDef, valueToRender) {
170
- const render = colDef.cellRenderer;
171
- if (typeof render === 'string') {
172
- return this.getCleanValue(valueToRender);
173
- }
174
- return render({ value: valueToRender }) || '';
175
- }
176
- createAdaptableColumnFromAgGridColumn(agGridColumn, colsToGroups) {
177
- const colId = agGridColumn.getColId();
178
- const colDef = agGridColumn.getColDef();
179
- const ColumnId = colId;
180
- const pkColumn = this.adaptable.adaptableOptions.primaryKey;
181
- const ColumnGroup = colsToGroups === null || colsToGroups === void 0 ? void 0 : colsToGroups[ColumnId];
182
- const isRealColumnGroup = ColumnGroup
183
- ? ColumnGroup.columnGroupId !== ColumnGroup.friendlyName
184
- : false;
185
- const isActionRowButtonColumn = this.adaptable.api.columnApi.internalApi.isActionRowButtonColumn(colId);
186
- const isFdc3MainActionColumn = this.adaptable.api.fdc3Api.internalApi.isFdc3MainActionColumn(colId);
187
- let friendlyName;
188
- const colExists = this.adaptable.api.columnApi.doesColumnExist(ColumnId);
189
- if (colExists) {
190
- friendlyName = this.adaptable.api.columnApi.getFriendlyNameForColumnId(ColumnId);
191
- }
192
- else {
193
- const displayName = this.gridOptions.columnApi.getDisplayNameForColumn(agGridColumn, 'header');
194
- const columnFriendlyName = this.adaptable.adaptableOptions.columnOptions.columnFriendlyName;
195
- const customFriendlyName = typeof columnFriendlyName === 'function'
196
- ? columnFriendlyName({
197
- colId: colId,
198
- agColumn: agGridColumn,
199
- columnGroup: isRealColumnGroup ? ColumnGroup : undefined,
200
- displayName: displayName,
201
- })
202
- : null;
203
- friendlyName =
204
- customFriendlyName !== null && customFriendlyName !== void 0 ? customFriendlyName : (isActionRowButtonColumn
205
- ? ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME
206
- : isFdc3MainActionColumn
207
- ? ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME
208
- : displayName);
209
- // Add Column Group;s friendlyname to the Column Friendly Name if its in a legitimate Column Group
210
- if (this.adaptable.adaptableOptions.columnOptions.addColumnGroupToColumnFriendlyName &&
211
- colDef.columnGroupShow &&
212
- ColumnGroup &&
213
- ColumnGroup.columnGroupId !== ColumnGroup.friendlyName) {
214
- friendlyName += ' [' + ColumnGroup.friendlyName + ']';
215
- }
216
- }
217
- if (!this.initialAgGridColDefs[colId]) {
218
- this.initialAgGridColDefs[colId] = Object.assign({}, agGridColumn.getUserProvidedColDef());
219
- }
220
- const dataType = this.getColumnDataType(agGridColumn, false);
221
- const abColumn = {
222
- Uuid: createUuid(),
223
- columnId: ColumnId,
224
- field: colDef.field,
225
- friendlyName: friendlyName,
226
- isPrimaryKey: ColumnId === pkColumn,
227
- dataType: dataType,
228
- visible: agGridColumn.isVisible(),
229
- readOnly: this.isColumnReadonly(colDef),
230
- columnGroup: ColumnGroup,
231
- fieldOnly: this.isColumnFieldonly(colDef),
232
- sortable: this.isColumnSortable(colDef),
233
- filterable: this.isColumnFilterable(colDef),
234
- groupable: this.isColumnRowGroupable(colDef),
235
- pivotable: this.isColumnPivotable(colDef),
236
- aggregatable: this.isColumnAggregetable(colDef),
237
- availableAggregationFunctions: null,
238
- aggregationFunction: null,
239
- moveable: this.isColumnMoveable(colDef),
240
- hideable: this.isColumnHideable(colDef),
241
- queryable: this.isColumnQueryable(colDef, ColumnId, friendlyName, dataType),
242
- exportable: this.isColumnExportable(colDef, ColumnId, friendlyName, dataType),
243
- isGrouped: this.isColumnRowGrouped(colDef),
244
- isFixed: this.isColumnFixed(colDef),
245
- pinned: this.getColumnPinnedPosition(colDef),
246
- isExcludedFromQuickSearch: false,
247
- isSparkline: this.isColumnSparkline(colDef),
248
- };
249
- if (abColumn.aggregatable) {
250
- abColumn.availableAggregationFunctions = this.getColumnAggregationFunctions(colDef);
251
- if (typeof colDef.aggFunc === 'string') {
252
- abColumn.aggregationFunction = colDef.aggFunc;
253
- }
254
- }
255
- // lets set this here one as the function cannot change the result so dont need to run it each time
256
- let excludeColumnFromQuickSearch = this.adaptable.adaptableOptions.quickSearchOptions.excludeColumnFromQuickSearch;
257
- if (excludeColumnFromQuickSearch) {
258
- if (excludeColumnFromQuickSearch(abColumn)) {
259
- abColumn.isExcludedFromQuickSearch = true;
260
- }
261
- }
262
- return abColumn;
263
- }
264
- buildAdaptableToolPanelDef() {
265
- return {
266
- id: GeneralConstants.ADAPTABLE_TOOLPANEL_ID,
267
- toolPanel: GeneralConstants.ADAPTABLE_TOOLPANEL_COMPONENT,
268
- labelDefault: GeneralConstants.ADAPTABLE,
269
- labelKey: 'adaptable',
270
- iconKey: 'menu',
271
- width: UIHelper.getAdaptableToolPanelWidth(),
272
- minWidth: UIHelper.getAdaptableToolPanelWidth(),
273
- // maxWidth = undefined,
274
- };
275
- }
276
- isSideBarDefObject(sidebarDef) {
277
- return Array.isArray(sidebarDef === null || sidebarDef === void 0 ? void 0 : sidebarDef.toolPanels);
278
- }
279
- mapToolPanelDefs(toolPanelDefs = []) {
280
- // if it's an alias for the adaptable tool panel, map it to a ToolPanelDef, otherwise return it as it is
281
- return toolPanelDefs.map((toolPanelDef) => toolPanelDef === GeneralConstants.ADAPTABLE_TOOLPANEL_ID
282
- ? this.buildAdaptableToolPanelDef()
283
- : toolPanelDef);
284
- }
285
- // This method reselects cells - only IF they are in a single column
286
- // Might be able to change that later
287
- // We do this by gettng the selected cells, clearing the selection and then re-applying
288
- reselectSelectedCells() {
289
- const selectedCellRanges = this.gridOptions.api.getCellRanges();
290
- if (ArrayExtensions.CorrectLength(selectedCellRanges, 1)) {
291
- const selectedCellRange = selectedCellRanges[0];
292
- const cellRangeParams = {
293
- rowStartIndex: selectedCellRange.startRow.rowIndex,
294
- rowEndIndex: selectedCellRange.endRow.rowIndex,
295
- columns: selectedCellRange.columns,
296
- };
297
- this.gridOptions.api.clearRangeSelection();
298
- this.gridOptions.api.addCellRange(cellRangeParams);
299
- }
300
- }
301
- fireCellSelectionChangedEvent() {
302
- let cellSelectionChangedInfo = {
303
- adaptableApi: this.adaptable.api,
304
- selectedCellInfo: this.adaptable.api.gridApi.getGridState().SelectedCellInfo,
305
- // selectedRowInfo: this.adaptable.api.gridApi.getGridState().SelectedRowInfo,
306
- userName: this.adaptable.api.optionsApi.getUserName(),
307
- adaptableId: this.adaptable.api.optionsApi.getAdaptableId(),
308
- };
309
- this.adaptable.api.eventApi.emit('CellSelectionChanged', cellSelectionChangedInfo);
310
- }
311
- fireRowSelectionChangedEvent() {
312
- let rowSelectionChangedInfo = {
313
- adaptableApi: this.adaptable.api,
314
- // selectedCellInfo: this.adaptable.api.gridApi.getGridState().SelectedCellInfo,
315
- selectedRowInfo: this.adaptable.api.gridApi.getGridState().SelectedRowInfo,
316
- userName: this.adaptable.api.optionsApi.getUserName(),
317
- adaptableId: this.adaptable.api.optionsApi.getAdaptableId(),
318
- };
319
- this.adaptable.api.eventApi.emit('RowSelectionChanged', rowSelectionChangedInfo);
320
- }
321
- isColumnReadonly(colDef) {
322
- // if the column has conditional/dynamic editability, we assume some rows may be editable
323
- if (colDef && typeof colDef.editable === 'function') {
324
- return false;
325
- }
326
- // otherwise we evaluate the colDef.editable property (columns are NOT editable by default)
327
- return !colDef.editable;
328
- }
329
- isColumnFieldonly(colDef) {
330
- if (colDef.hide == true && colDef.initialHide == true && colDef.lockVisible == true) {
331
- return true;
332
- }
333
- return false;
334
- }
335
- isColumnSortable(colDef) {
336
- if (colDef && colDef.sortable != null) {
337
- return colDef.sortable;
338
- }
339
- return false;
340
- }
341
- isColumnRowGroupable(colDef) {
342
- if (colDef && colDef.enableRowGroup != null) {
343
- return colDef.enableRowGroup;
344
- }
345
- return false;
346
- }
347
- isColumnPivotable(colDef) {
348
- if (colDef && colDef.enablePivot != null) {
349
- return colDef.enablePivot;
350
- }
351
- return false;
352
- }
353
- isColumnAggregetable(colDef) {
354
- if (colDef && colDef.enableValue != null) {
355
- return colDef.enableValue;
356
- }
357
- return false;
358
- }
359
- getColumnAggregationFunctions(colDef) {
360
- return colDef.allowedAggFuncs || ['sum', 'min', 'max', 'count', 'avg', 'first', 'last']; // those are the default fns aggrid supports out-of-the-box
361
- }
362
- isColumnMoveable(colDef) {
363
- if (!colDef) {
364
- return false;
365
- }
366
- if (colDef.suppressMovable != null && colDef.suppressMovable == true) {
367
- return false;
368
- }
369
- if (this.isColumnFixed(colDef)) {
370
- return false;
371
- }
372
- return true;
373
- }
374
- isColumnQueryable(colDef, columnId, friendlyName, datatype) {
375
- if (!colDef) {
376
- return false;
377
- }
378
- if (colDef.colId === ADAPTABLE_ROW_ACTION_BUTTONS) {
379
- return false;
380
- }
381
- const abColumnBase = {
382
- columnId: columnId,
383
- friendlyName: friendlyName,
384
- dataType: datatype,
385
- };
386
- return this.adaptable.api.expressionApi.isColumnQueryable(abColumnBase);
387
- }
388
- isColumnExportable(colDef, columnId, friendlyName, datatype) {
389
- if (!colDef) {
390
- return false;
391
- }
392
- if (colDef.colId === ADAPTABLE_ROW_ACTION_BUTTONS) {
393
- return false;
394
- }
395
- const abColumnBase = {
396
- columnId,
397
- friendlyName,
398
- dataType: datatype,
399
- };
400
- return this.adaptable.api.exportApi.isColumnExportable(abColumnBase);
401
- }
402
- isColumnHideable(colDef) {
403
- if (!colDef) {
404
- return false;
405
- }
406
- if (colDef.lockVisible != null && colDef.lockVisible == true) {
407
- return false;
408
- }
409
- return true;
410
- }
411
- isColumnFilterable(colDef) {
412
- // follow agGrid logic which is that ONLY filterable if explicitly set
413
- if (this.adaptable.EntitlementService.getEntitlementAccessLevelForModule(ModuleConstants.ColumnFilterModuleId) == 'Hidden') {
414
- return false;
415
- }
416
- return colDef != null && colDef.filter != null && colDef.filter != false;
417
- }
418
- getColumnPinnedPosition(colDef) {
419
- return colDef.pinned
420
- ? colDef.pinned === 'left' || colDef.pinned === true
421
- ? 'left'
422
- : 'right'
423
- : false;
424
- }
425
- // used for AG Grid when the column is FixedPinned, meaning it should never be unpinned
426
- isColumnFixed(colDef) {
427
- if (!colDef) {
428
- return false;
429
- }
430
- if (colDef.lockPosition != null && colDef.lockPosition == true) {
431
- return true;
432
- }
433
- if (colDef.lockPinned != null && colDef.lockPinned == true) {
434
- return true;
435
- }
436
- return false;
437
- }
438
- isColumnRowGrouped(colDef) {
439
- if (!colDef) {
440
- return false;
441
- }
442
- if (colDef.rowGroup != null && colDef.rowGroup == true) {
443
- return true;
444
- }
445
- if (colDef.rowGroupIndex != null) {
446
- return true;
447
- }
448
- return false;
449
- }
450
- isColumnSparkline(colDef) {
451
- // see https://www.ag-grid.com/javascript-data-grid/sparklines-overview/#enabling-sparklines
452
- return (colDef === null || colDef === void 0 ? void 0 : colDef.cellRenderer) === 'agSparklineCellRenderer';
453
- }
454
- getColumnDataType(column, logWarning = true) {
455
- // Some columns can have no ID or Title. we return string as a consequence but it needs testing
456
- if (!column) {
457
- this.adaptable.logger.warn('column is undefined returning String for Type');
458
- return 'String';
459
- }
460
- let dataType = 'Unknown';
461
- // get the column type if already in store (and not unknown)
462
- const existingColumn = this.adaptable.api.columnApi.getColumnWithColumnId(column.getId(), logWarning);
463
- if (existingColumn && existingColumn.dataType != 'Unknown') {
464
- return existingColumn.dataType;
465
- }
466
- // check for column type
467
- const colType = column.getColDef().type;
468
- if (colType) {
469
- if (Array.isArray(colType)) {
470
- colType.forEach((c) => {
471
- if (dataType == 'Unknown') {
472
- dataType = this.getAbColDefValue(c);
473
- }
474
- });
475
- }
476
- else {
477
- dataType = this.getAbColDefValue(colType);
478
- }
479
- if (dataType != 'Unknown') {
480
- return dataType;
481
- }
482
- }
483
- const model = this.gridOptions.api.getModel();
484
- if (model == null) {
485
- this.adaptable.logger.warn(`No model so returning type "Unknown" for Column: "${column.getColId()}"`);
486
- return 'Unknown';
487
- }
488
- let row = model.getRow(0);
489
- if (row == null) {
490
- // possible that there will be no data.
491
- this.adaptable.logger.warn(`No data in grid so returning type "Unknown" for Column: "${column.getColId()}"`);
492
- return 'Unknown';
493
- }
494
- // if it's a group we need the content of the group
495
- if (row.group) {
496
- const childNodes = row.childrenAfterGroup;
497
- if (ArrayExtensions.IsNullOrEmpty(childNodes)) {
498
- this.adaptable.logger.warn(`No data in grid so returning type "Unknown" for Column: "${column.getColId()}"`);
499
- return 'Unknown';
500
- }
501
- row = childNodes[0];
502
- }
503
- const value = this.gridOptions.api.getValue(column, row);
504
- if (value instanceof Date) {
505
- dataType = 'Date';
506
- }
507
- else if (Array.isArray(value) && value.length && typeof value[0] === 'number') {
508
- dataType = 'Unknown';
509
- }
510
- else {
511
- switch (typeof value) {
512
- case 'string':
513
- dataType = 'String';
514
- break;
515
- case 'number':
516
- dataType = 'Number';
517
- break;
518
- case 'boolean':
519
- dataType = 'Boolean';
520
- break;
521
- case 'object':
522
- dataType = 'Object';
523
- break;
524
- default:
525
- break;
526
- }
527
- }
528
- this.adaptable.logger.warn(`No defined type for column '${column.getColId()}'. Defaulting to type of first value: ${dataType}`);
529
- return dataType;
530
- }
531
- getAbColDefValue(colType) {
532
- if (colType == 'numericColumn') {
533
- return 'Number';
534
- }
535
- if (colType.startsWith('abColDef')) {
536
- const abColType = colType;
537
- switch (abColType) {
538
- case 'abColDefNumber':
539
- return 'Number';
540
- case 'abColDefString':
541
- return 'String';
542
- case 'abColDefBoolean':
543
- return 'Boolean';
544
- case 'abColDefDate':
545
- return 'Date';
546
- case 'abColDefObject':
547
- return 'Object';
548
- case 'abColDefStringArray':
549
- return 'StringArray';
550
- case 'abColDefNumberArray':
551
- return 'NumberArray';
552
- case 'abColDefTupleNumberArray':
553
- return 'TupleNumberArray';
554
- case 'abColDefObjectNumberArray':
555
- return 'ObjectNumberArray';
556
- default:
557
- return 'Unknown';
558
- }
559
- }
560
- return 'Unknown';
561
- }
562
- getAgGridDataType(dataType) {
563
- if (!dataType) {
564
- return 'abColDefString';
565
- }
566
- switch (dataType) {
567
- case 'Boolean':
568
- return 'abColDefBoolean';
569
- case 'Date':
570
- return 'abColDefDate';
571
- case 'Number':
572
- return 'abColDefNumber';
573
- case 'Object':
574
- return 'abColDefObject';
575
- case 'String':
576
- return 'abColDefString';
577
- case 'NumberArray':
578
- return 'abColDefNumberArray';
579
- case 'TupleNumberArray':
580
- return 'abColDefTupleNumberArray';
581
- case 'ObjectNumberArray':
582
- return 'abColDefObjectNumberArray';
583
- default:
584
- return 'abColDefCustom';
585
- }
586
- }
587
- checkShouldClearExistingFiltersOrSearches() {
588
- // if they have selected to clear column filters on startup then do it
589
- if (this.adaptable.adaptableOptions.columnFilterOptions.clearColumnFiltersOnStartUp) {
590
- if (ArrayExtensions.IsNotNullOrEmpty(this.adaptable.api.columnFilterApi.getColumnFilters())) {
591
- this.adaptable.logger.warn('Clearing existing Column Filters as "clearColumnFiltersOnStartUp" is true');
592
- this.adaptable.api.columnFilterApi.clearColumnFilters();
593
- }
594
- }
595
- // if they have selected to clear the Grid filter on startup then do it
596
- if (this.adaptable.adaptableOptions.gridFilterOptions.clearGridFilterOnStartUp) {
597
- if (StringExtensions.IsNotNullOrEmpty(this.adaptable.api.gridFilterApi.getCurrentGridFilterExpression())) {
598
- this.adaptable.logger.warn('Clearing existing Grid Filter as "clearGridFilterOnStartUp" is true');
599
- this.adaptable.api.gridFilterApi.setGridFilterExpression('');
600
- }
601
- }
602
- // if they have selected to clear searches on startup then do it
603
- if (this.adaptable.adaptableOptions.quickSearchOptions.clearQuickSearchOnStartUp) {
604
- if (StringExtensions.IsNotNullOrEmpty(this.adaptable.api.quickSearchApi.getQuickSearchState().QuickSearchText)) {
605
- this.adaptable.logger.warn('Clearing existing Searches as "clearQuickSearchOnStartUp" is true');
606
- this.adaptable.api.quickSearchApi.clearQuickSearch();
607
- }
608
- }
609
- }
610
- runAdaptableGroupComparerFunction() {
611
- const adaptable = this.adaptable;
612
- return function compareItemsOfCustomSort(params) {
613
- const { nodeA, nodeB } = params;
614
- let firstGroupedColumn = adaptable.getFirstGroupedColumn();
615
- if (firstGroupedColumn) {
616
- const definedColumnComparator = adaptable.getActiveColumnComparator(firstGroupedColumn.columnId, adaptable.api.customSortApi.getCustomSortForColumn(firstGroupedColumn.columnId), adaptable.api.customSortApi.internalApi.getCustomSortComparer(firstGroupedColumn));
617
- if (definedColumnComparator) {
618
- return definedColumnComparator(nodeA.key, nodeB.key);
619
- }
620
- const sortOder = adaptable.api.layoutApi.getCurrentLayoutColumnSort(firstGroupedColumn.columnId);
621
- if (sortOder === 'Desc') {
622
- return nodeA.key > nodeB.key ? -1 : 1;
623
- }
624
- }
625
- // if no comparator available, just sort alphanumerically
626
- if (nodeA.key == nodeB.key) {
627
- return 0;
628
- }
629
- return nodeA.key < nodeB.key ? -1 : 1;
630
- };
631
- }
632
- getCurrentIPPStyle() {
633
- const headerFirstCol = document
634
- .querySelectorAll('.ag-header-cell')
635
- .item(0);
636
- const header = document.querySelector('.ag-header');
637
- const headerColStyle = header ? window.getComputedStyle(header, null) : null;
638
- const firstRow = document.querySelector('.ag-row-even');
639
- const firstRowStyle = firstRow ? window.getComputedStyle(firstRow, null) : null;
640
- const secondRow = document.querySelector('.ag-row-odd');
641
- const secondRowStyle = secondRow
642
- ? window.getComputedStyle(secondRow, null)
643
- : {
644
- backgroundColor: '#fff',
645
- };
646
- return {
647
- Header: {
648
- headerColor: tinycolor(headerColStyle.color).toHexString(),
649
- headerBackColor: tinycolor(headerColStyle.backgroundColor).toHexString(),
650
- headerFontFamily: headerColStyle.fontFamily,
651
- headerFontSize: headerColStyle.fontSize,
652
- headerFontStyle: headerColStyle.fontStyle,
653
- headerFontWeight: headerColStyle.fontWeight,
654
- height: Number(headerColStyle.height.replace('px', '')),
655
- Columns: this.adaptable.api.columnApi.getColumns().map((col) => {
656
- const headerColumn = document.querySelector(`.ag-header-cell[col-id='${col.columnId}']`);
657
- const headerColumnStyle = window.getComputedStyle(headerColumn || headerFirstCol, null);
658
- return {
659
- columnFriendlyName: col.friendlyName,
660
- width: Number(headerColumnStyle.width.replace('px', '')),
661
- textAlign: headerColumnStyle.textAlign,
662
- };
663
- }),
664
- },
665
- Row: {
666
- color: tinycolor(firstRowStyle.color).toHexString(),
667
- backColor: tinycolor(firstRowStyle.backgroundColor).toHexString(),
668
- altBackColor: tinycolor(secondRowStyle.backgroundColor).toHexString(),
669
- fontFamily: firstRowStyle.fontFamily,
670
- fontSize: firstRowStyle.fontSize,
671
- fontStyle: firstRowStyle.fontStyle,
672
- fontWeight: firstRowStyle.fontWeight,
673
- height: Number(firstRowStyle.height.replace('px', '')),
674
- Columns: this.adaptable.api.columnApi.getColumns().map((col) => {
675
- const cellElement = document.querySelector(`.ag-cell[col-id='${col.columnId}']`);
676
- const headerColumnStyle = window.getComputedStyle(cellElement || firstRow, null);
677
- return {
678
- columnFriendlyName: col.friendlyName,
679
- width: Number(headerColumnStyle.width.replace('px', '')),
680
- textAlign: headerColumnStyle.textAlign,
681
- };
682
- }),
683
- },
684
- };
685
- }
686
- }