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