@adaptabletools/adaptable-cjs 18.1.14 → 19.0.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/package.json +2 -2
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -5
  3. package/src/AdaptableOptions/AlertOptions.d.ts +2 -1
  4. package/src/AdaptableOptions/ChartingOptions.d.ts +5 -1
  5. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +5 -1
  6. package/src/AdaptableOptions/DashboardOptions.d.ts +5 -1
  7. package/src/AdaptableOptions/FlashingCellOptions.d.ts +5 -1
  8. package/src/AdaptableOptions/LayoutOptions.d.ts +5 -1
  9. package/src/AdaptableOptions/NotificationsOptions.d.ts +6 -2
  10. package/src/AdaptableOptions/SettingsPanelOptions.d.ts +5 -1
  11. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +1 -1
  12. package/src/Api/ChartingApi.d.ts +2 -2
  13. package/src/Api/ColumnApi.d.ts +6 -0
  14. package/src/Api/ConfigApi.d.ts +22 -2
  15. package/src/Api/Events/LiveDataChanged.d.ts +1 -1
  16. package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -1
  17. package/src/Api/Implementation/ChartingApiImpl.d.ts +1 -1
  18. package/src/Api/Implementation/ChartingApiImpl.js +2 -2
  19. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  20. package/src/Api/Implementation/ColumnApiImpl.js +3 -0
  21. package/src/Api/Implementation/ConfigApiImpl.d.ts +4 -1
  22. package/src/Api/Implementation/ConfigApiImpl.js +16 -1
  23. package/src/Api/Implementation/EntitlementApiImpl.d.ts +4 -1
  24. package/src/Api/Implementation/EntitlementApiImpl.js +31 -6
  25. package/src/Api/Implementation/ExportApiImpl.js +5 -7
  26. package/src/Api/Implementation/GridApiImpl.js +1 -1
  27. package/src/Api/Implementation/LayoutApiImpl.d.ts +2 -0
  28. package/src/Api/Implementation/LayoutApiImpl.js +61 -0
  29. package/src/Api/Implementation/TeamSharingApiImpl.js +2 -6
  30. package/src/Api/Internal/AdaptableInternalApi.d.ts +2 -6
  31. package/src/Api/Internal/AdaptableInternalApi.js +5 -11
  32. package/src/Api/Internal/EntitlementInternalApi.d.ts +4 -0
  33. package/src/Api/Internal/EntitlementInternalApi.js +15 -0
  34. package/src/Api/Internal/ExportInternalApi.d.ts +33 -8
  35. package/src/Api/Internal/ExportInternalApi.js +577 -5
  36. package/src/Api/Internal/NamedQueryInternalApi.d.ts +0 -1
  37. package/src/Api/Internal/NamedQueryInternalApi.js +0 -5
  38. package/src/Api/LayoutApi.d.ts +7 -0
  39. package/src/PredefinedConfig/AdaptableState.d.ts +0 -5
  40. package/src/PredefinedConfig/Common/ExtendedLayoutInfo.d.ts +12 -0
  41. package/src/PredefinedConfig/Common/FilterActionOnDataChange.d.ts +2 -1
  42. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  43. package/src/Redux/ActionsReducers/GridRedux.d.ts +6 -6
  44. package/src/Redux/ActionsReducers/GridRedux.js +11 -11
  45. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +3 -3
  46. package/src/Redux/ActionsReducers/LayoutRedux.js +10 -10
  47. package/src/Redux/ActionsReducers/NamedQueryRedux.d.ts +1 -1
  48. package/src/Redux/ActionsReducers/NamedQueryRedux.js +1 -1
  49. package/src/Redux/ActionsReducers/PluginsRedux.d.ts +2 -2
  50. package/src/Redux/ActionsReducers/PluginsRedux.js +3 -3
  51. package/src/Redux/Store/AdaptableReduxMerger.js +3 -3
  52. package/src/Redux/Store/AdaptableStore.js +2 -4
  53. package/src/Strategy/AdaptableModuleBase.js +1 -2
  54. package/src/Strategy/ColumnFilterModule.js +1 -2
  55. package/src/Strategy/ExportModule.js +17 -44
  56. package/src/Strategy/FlashingCellModule.js +2 -10
  57. package/src/Strategy/ScheduleModule.js +4 -6
  58. package/src/Strategy/SmartEditModule.js +1 -7
  59. package/src/Strategy/TeamSharingModule.js +2 -2
  60. package/src/Strategy/Utilities/Export/getExportColumnsViewItems.js +1 -1
  61. package/src/Strategy/Utilities/Export/getExportRowsViewItems.js +1 -3
  62. package/src/Utilities/Constants/FilterConstants.d.ts +10 -0
  63. package/src/Utilities/Constants/FilterConstants.js +11 -0
  64. package/src/Utilities/Constants/GeneralConstants.d.ts +41 -4
  65. package/src/Utilities/Constants/GeneralConstants.js +44 -5
  66. package/src/Utilities/Defaults/DefaultSettingsPanel.d.ts +0 -2
  67. package/src/Utilities/Defaults/DefaultSettingsPanel.js +1 -6
  68. package/src/Utilities/Extensions/ArrayExtensions.d.ts +14 -0
  69. package/src/Utilities/Extensions/ArrayExtensions.js +68 -1
  70. package/src/Utilities/Extensions/EnumExtensions.d.ts +0 -4
  71. package/src/Utilities/Extensions/EnumExtensions.js +3 -15
  72. package/src/Utilities/Helpers/AdaptableHelper.d.ts +4 -10
  73. package/src/Utilities/Helpers/AdaptableHelper.js +10 -64
  74. package/src/Utilities/Helpers/FormatHelper.d.ts +9 -0
  75. package/src/Utilities/Helpers/FormatHelper.js +26 -14
  76. package/src/Utilities/Helpers/Helper.d.ts +0 -10
  77. package/src/Utilities/Helpers/Helper.js +1 -76
  78. package/src/Utilities/Services/ChartingService.d.ts +2 -2
  79. package/src/Utilities/Services/ChartingService.js +5 -11
  80. package/src/Utilities/Services/ModuleService.js +35 -31
  81. package/src/Utilities/Services/RowEditService.js +1 -6
  82. package/src/Utilities/Services/RowSummaryService.js +2 -2
  83. package/src/Utilities/Services/ValidationService.js +2 -16
  84. package/src/View/Alert/AlertEmptyView.js +1 -2
  85. package/src/View/Charting/ChartingStatusBarPopover.js +1 -2
  86. package/src/View/Charting/useChartingElements.js +1 -1
  87. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +2 -6
  88. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +2 -4
  89. package/src/View/Components/FilterForm/QuickFilterForm.js +2 -12
  90. package/src/View/Components/ModuleValueSelector/index.js +2 -2
  91. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +2 -5
  92. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupBody.js +1 -3
  93. package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +2 -1
  94. package/src/View/Components/Popups/AdaptablePopupAlert.js +1 -7
  95. package/src/View/Components/ToolPanel/AdaptableToolPanel.js +6 -12
  96. package/src/View/Components/ToolPanel/CustomToolPanelContent.js +3 -23
  97. package/src/View/Components/ToolPanel/ToolPanelPopup.js +4 -5
  98. package/src/View/Components/ToolPanel/ToolPanelWrapper.js +1 -3
  99. package/src/View/Components/ValueSelector/index.js +2 -2
  100. package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +2 -2
  101. package/src/View/Dashboard/CustomDashboardButton.js +1 -6
  102. package/src/View/Dashboard/CustomToolbar.js +2 -9
  103. package/src/View/Dashboard/Dashboard.js +2 -4
  104. package/src/View/Dashboard/DashboardPopup.js +1 -3
  105. package/src/View/Dashboard/DashboardToolbarFactory.js +1 -2
  106. package/src/View/Dashboard/PinnedToolbarsSelector.js +1 -2
  107. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -3
  108. package/src/View/Export/ExportViewPanel.js +2 -4
  109. package/src/View/Export/Wizard/ReportSummaryWizard.js +2 -6
  110. package/src/View/GridFilter/GridFilterExpressionEditor.js +2 -2
  111. package/src/View/GridFilter/useGridFilterExpressionEditor.js +2 -6
  112. package/src/View/Layout/LayoutViewPanel.js +1 -1
  113. package/src/View/Layout/PivotDetailsPopoup.js +1 -7
  114. package/src/View/Layout/SaveLayoutButton.js +1 -3
  115. package/src/View/Layout/Wizard/sections/AggregationsSection.js +2 -2
  116. package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -2
  117. package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +2 -2
  118. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +2 -2
  119. package/src/View/Layout/Wizard/sections/RowSummarySection.js +2 -2
  120. package/src/View/Layout/Wizard/sections/SortSection.js +2 -2
  121. package/src/View/NamedQuery/Wizard/NamedQueryWizard.js +3 -3
  122. package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
  123. package/src/View/SystemStatus/SystemStatusPopup.js +1 -1
  124. package/src/View/Wizard/OnePageAdaptableWizard.js +2 -2
  125. package/src/agGrid/ActionColumnRenderer.js +8 -22
  126. package/src/agGrid/AdaptableAgGrid.d.ts +6 -7
  127. package/src/agGrid/AdaptableAgGrid.js +164 -145
  128. package/src/agGrid/AgGridAdapter.d.ts +0 -1
  129. package/src/agGrid/AgGridAdapter.js +7 -10
  130. package/src/agGrid/AgGridColumnAdapter.d.ts +3 -1
  131. package/src/agGrid/AgGridColumnAdapter.js +39 -13
  132. package/src/agGrid/BadgeRenderer.js +4 -22
  133. package/src/agGrid/FloatingFilterWrapper.js +21 -0
  134. package/src/agGrid/buildSortedColumnStateForLayout.d.ts +1 -1
  135. package/src/agGrid/buildSortedColumnStateForLayout.js +2 -2
  136. package/src/agGrid/defaultAdaptableOptions.js +35 -30
  137. package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +3 -15
  138. package/src/env.js +2 -2
  139. package/src/metamodel/adaptable.metamodel.d.ts +89 -8
  140. package/src/metamodel/adaptable.metamodel.js +1 -1
  141. package/src/types.d.ts +10 -9
  142. package/tsconfig.cjs.tsbuildinfo +1 -1
  143. package/src/Redux/ActionsReducers/QueryRedux.d.ts +0 -10
  144. package/src/Redux/ActionsReducers/QueryRedux.js +0 -25
  145. package/src/Utilities/Helpers/FormatContentHelper.d.ts +0 -22
  146. package/src/Utilities/Helpers/FormatContentHelper.js +0 -39
  147. package/src/Utilities/Services/EntitlementService.d.ts +0 -14
  148. package/src/Utilities/Services/EntitlementService.js +0 -67
  149. package/src/Utilities/Services/Interface/IEntitlementService.d.ts +0 -10
  150. package/src/Utilities/Services/Interface/IReportService.d.ts +0 -27
  151. package/src/Utilities/Services/Interface/IReportService.js +0 -2
  152. package/src/Utilities/Services/ReportService.d.ts +0 -41
  153. package/src/Utilities/Services/ReportService.js +0 -608
  154. package/src/Utilities/isAdaptableObject.d.ts +0 -2
  155. package/src/Utilities/isAdaptableObject.js +0 -8
  156. package/src/Utilities/reorder.d.ts +0 -1
  157. package/src/Utilities/reorder.js +0 -17
  158. package/src/Utilities/sortWithOrder.d.ts +0 -11
  159. package/src/Utilities/sortWithOrder.js +0 -54
  160. /package/src/{Utilities/Services/Interface/IEntitlementService.js → PredefinedConfig/Common/ExtendedLayoutInfo.js} +0 -0
@@ -1,608 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReportService = void 0;
4
- const tslib_1 = require("tslib");
5
- const groupBy_1 = tslib_1.__importDefault(require("lodash/groupBy"));
6
- const Enums_1 = require("../../PredefinedConfig/Common/Enums");
7
- const GeneralConstants_1 = require("../Constants/GeneralConstants");
8
- const ArrayExtensions_1 = tslib_1.__importDefault(require("../Extensions/ArrayExtensions"));
9
- const FormatHelper_1 = tslib_1.__importStar(require("../Helpers/FormatHelper"));
10
- const StringExtensions_1 = tslib_1.__importDefault(require("../Extensions/StringExtensions"));
11
- const ModuleConstants_1 = require("../Constants/ModuleConstants");
12
- const uuid_1 = require("../../components/utils/uuid");
13
- const ObjectFactory_1 = require("../ObjectFactory");
14
- const StyleHelper_1 = require("../Helpers/StyleHelper");
15
- const tinycolor2_1 = tslib_1.__importDefault(require("tinycolor2"));
16
- class ReportService {
17
- constructor(adaptableApi) {
18
- this.adaptableApi = adaptableApi;
19
- this.excelStylesCache = {};
20
- this.cellClassKey2excelStyleIdMap = {};
21
- this.excelStylesWithFormattedDate = {};
22
- this.adaptableApi = adaptableApi;
23
- }
24
- destroy() {
25
- // TO DO
26
- }
27
- getExcelStyleIdForCellClassKey(cellClassKey) {
28
- return this.cellClassKey2excelStyleIdMap[cellClassKey];
29
- }
30
- getExcelStyleWithFormattedDate(cellClassId) {
31
- return this.excelStylesWithFormattedDate[cellClassId];
32
- }
33
- CreateSystemReport(systemReportName) {
34
- switch (systemReportName) {
35
- case GeneralConstants_1.VISUAL_DATA_REPORT:
36
- return {
37
- Uuid: (0, uuid_1.createUuid)(),
38
- Name: GeneralConstants_1.VISUAL_DATA_REPORT,
39
- ReportColumnScope: 'VisibleColumns',
40
- ReportRowScope: 'VisibleRows',
41
- Query: undefined,
42
- IsReadOnly: true,
43
- };
44
- case GeneralConstants_1.ALL_DATA_REPORT:
45
- return {
46
- Uuid: (0, uuid_1.createUuid)(),
47
- Name: GeneralConstants_1.ALL_DATA_REPORT,
48
- ReportColumnScope: 'AllColumns',
49
- ReportRowScope: 'AllRows',
50
- Query: undefined,
51
- IsReadOnly: true,
52
- };
53
- case GeneralConstants_1.CURRENT_DATA_REPORT:
54
- return {
55
- Uuid: (0, uuid_1.createUuid)(),
56
- Name: GeneralConstants_1.CURRENT_DATA_REPORT,
57
- ReportColumnScope: 'VisibleColumns',
58
- ReportRowScope: 'VisibleRows',
59
- Query: undefined,
60
- IsReadOnly: true,
61
- };
62
- case GeneralConstants_1.SELECTED_CELLS_REPORT:
63
- return {
64
- Uuid: (0, uuid_1.createUuid)(),
65
- Name: GeneralConstants_1.SELECTED_CELLS_REPORT,
66
- ReportColumnScope: 'SelectedColumns',
67
- ReportRowScope: 'SelectedCellRows',
68
- Query: undefined,
69
- IsReadOnly: true,
70
- };
71
- case GeneralConstants_1.SELECTED_ROWS_REPORT:
72
- return {
73
- Uuid: (0, uuid_1.createUuid)(),
74
- Name: GeneralConstants_1.SELECTED_ROWS_REPORT,
75
- ReportColumnScope: 'VisibleColumns',
76
- ReportRowScope: 'SelectedRows',
77
- Query: undefined,
78
- IsReadOnly: true,
79
- };
80
- }
81
- }
82
- IsSystemReport(reportName) {
83
- return (reportName == null ||
84
- reportName == GeneralConstants_1.ALL_DATA_REPORT ||
85
- reportName == GeneralConstants_1.CURRENT_DATA_REPORT ||
86
- reportName == GeneralConstants_1.SELECTED_CELLS_REPORT ||
87
- reportName == GeneralConstants_1.SELECTED_ROWS_REPORT ||
88
- reportName == GeneralConstants_1.VISUAL_DATA_REPORT);
89
- }
90
- IsSystemReportActive(reportName) {
91
- if (reportName == GeneralConstants_1.SELECTED_CELLS_REPORT) {
92
- return this.adaptableApi.gridApi.isGridRangeSelectable();
93
- }
94
- if (reportName == GeneralConstants_1.SELECTED_ROWS_REPORT) {
95
- return this.adaptableApi.gridApi.isGridRowSelectable();
96
- }
97
- if (reportName === GeneralConstants_1.VISUAL_DATA_REPORT) {
98
- return this.adaptableApi.exportApi
99
- .getAvailableExportDestinations()
100
- .includes(Enums_1.ExportDestination.Excel);
101
- }
102
- return true;
103
- }
104
- IsSystemExportDestinationActive(exportDestination) {
105
- if (exportDestination === Enums_1.ExportDestination.Excel) {
106
- return this.adaptableApi.exportApi.canExportToExcel();
107
- }
108
- return true;
109
- }
110
- GetReportColumnScopeShortDescription(report) {
111
- var _a, _b;
112
- if (this.adaptableApi.exportApi.isExternalReport(report)) {
113
- return ['[Custom Columns]'];
114
- }
115
- switch (report.ReportColumnScope) {
116
- case 'AllColumns':
117
- return ['[All Columns]'];
118
- case 'VisibleColumns':
119
- return ['[Visible Columns]'];
120
- case 'SelectedColumns':
121
- return ['[Selected Columns]'];
122
- case 'ScopeColumns':
123
- if ('ColumnIds' in (report === null || report === void 0 ? void 0 : report.Scope)) {
124
- return (_b = (_a = report.Scope.ColumnIds).map) === null || _b === void 0 ? void 0 : _b.call(_a, (columnId) => { var _a; return (_a = this.adaptableApi.columnApi.getFriendlyNameForColumnId(columnId)) !== null && _a !== void 0 ? _a : columnId; });
125
- }
126
- return ['[Bespoke Columns]'];
127
- }
128
- }
129
- GetReportColumnScopeLongDescription(report) {
130
- if (this.adaptableApi.exportApi.isExternalReport(report)) {
131
- return '[Custom Columns]';
132
- }
133
- switch (report.ReportColumnScope) {
134
- case 'AllColumns':
135
- return '[All Columns]';
136
- case 'VisibleColumns':
137
- return '[Visible Columns]';
138
- case 'SelectedColumns':
139
- return '[Selected Columns]';
140
- case 'ScopeColumns':
141
- return this.adaptableApi.columnScopeApi.getScopeDescription(report.Scope);
142
- }
143
- }
144
- GetReportExpressionDescription(report, cols) {
145
- if (this.adaptableApi.exportApi.isExternalReport(report)) {
146
- return '[Custom Data]';
147
- }
148
- if (this.IsSystemReport(report.Name)) {
149
- if (report.Name == GeneralConstants_1.ALL_DATA_REPORT) {
150
- return '[All Data]';
151
- }
152
- else if (report.Name == GeneralConstants_1.CURRENT_DATA_REPORT) {
153
- return '[All Current Data]';
154
- }
155
- else if (report.Name == GeneralConstants_1.SELECTED_CELLS_REPORT) {
156
- return '[Selected Cells Data]';
157
- }
158
- else if (report.Name == GeneralConstants_1.SELECTED_ROWS_REPORT) {
159
- return '[Selected Rows Data]';
160
- }
161
- else if (report.Name == GeneralConstants_1.VISUAL_DATA_REPORT) {
162
- return '[Current Data as WYSIWYG]';
163
- }
164
- }
165
- else {
166
- switch (report.ReportRowScope) {
167
- case 'AllRows':
168
- return '[All Rows]';
169
- case 'VisibleRows':
170
- return '[Visible Rows]';
171
- case 'SelectedRows':
172
- return '[Selected Rows]';
173
- case 'ExpressionRows':
174
- return this.adaptableApi.internalApi.getAdaptableQueryExpressionText(report.Query);
175
- }
176
- }
177
- }
178
- getReportDataColumns(report, includePrimaryKey = false) {
179
- let reportColumns = [];
180
- let gridColumns = this.adaptableApi.columnApi.getExportableColumns();
181
- if (this.adaptableApi.exportApi.isExternalReport(report)) {
182
- return reportColumns;
183
- }
184
- // first get the cols depending on the Column Scope
185
- switch (report.ReportColumnScope) {
186
- case 'AllColumns':
187
- reportColumns = gridColumns;
188
- break;
189
- case 'VisibleColumns':
190
- reportColumns = gridColumns.filter((c) => c.visible);
191
- break;
192
- case 'SelectedColumns':
193
- // we extract the selected columns from the grid columns to preserve the grid column order
194
- const selectedColumnIds = this.adaptableApi.gridApi
195
- .getSelectedCellInfo()
196
- .columns.map((column) => column.columnId);
197
- reportColumns = gridColumns.filter((gridColumn) => selectedColumnIds.includes(gridColumn.columnId));
198
- break;
199
- case 'ScopeColumns':
200
- if ('ColumnIds' in report.Scope) {
201
- reportColumns = report.Scope.ColumnIds.map((columnId) => this.adaptableApi.columnApi.getColumnWithColumnId(columnId)).filter((c) => c);
202
- }
203
- else {
204
- reportColumns = this.adaptableApi.columnScopeApi.getColumnsForScope(report.Scope);
205
- }
206
- break;
207
- }
208
- if (includePrimaryKey) {
209
- const pkColumn = reportColumns.find((column) => column.columnId === this.adaptableApi.optionsApi.getPrimaryKey());
210
- // TODO simplify after we fix the IsPrimaryKey bug
211
- // const pkColumn = reportColumns.find(column => column.IsPrimaryKey);
212
- if (!pkColumn && !!this.adaptableApi.columnApi.getPrimaryKeyColumn()) {
213
- reportColumns.push(this.adaptableApi.columnApi.getPrimaryKeyColumn());
214
- }
215
- }
216
- return reportColumns.map((column) => {
217
- var _a;
218
- return ({
219
- columnId: column.columnId,
220
- friendlyName: column.friendlyName,
221
- dataType: column.dataType,
222
- field: (_a = column.field) !== null && _a !== void 0 ? _a : column.columnId,
223
- });
224
- });
225
- }
226
- getReportDataRows(report, columns, includePrimaryKey) {
227
- var _a, _b;
228
- if (ArrayExtensions_1.default.IsNullOrEmpty(columns)) {
229
- return [];
230
- }
231
- const columnIds = columns.map((column) => column.columnId);
232
- const resultRowData = [];
233
- switch (report.ReportRowScope) {
234
- case 'AllRows':
235
- this.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
236
- resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
237
- });
238
- break;
239
- case 'VisibleRows':
240
- this.adaptableApi.internalApi.forAllVisibleRowNodesDo((rowNode) => {
241
- resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
242
- });
243
- break;
244
- case 'ExpressionRows':
245
- this.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
246
- var _a;
247
- if (this.adaptableApi.internalApi
248
- .getQueryLanguageService()
249
- .evaluateBooleanExpression((_a = report.Query) === null || _a === void 0 ? void 0 : _a.BooleanExpression, ModuleConstants_1.ExportModuleId, rowNode)) {
250
- resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
251
- }
252
- });
253
- break;
254
- case 'SelectedCellRows':
255
- const selectedCellInfo = this.adaptableApi.gridApi.getSelectedCellInfo();
256
- const { gridCells: GridCells } = selectedCellInfo;
257
- let selectedCellsByPrimaryKey = (0, groupBy_1.default)(GridCells, 'primaryKeyValue');
258
- // we iterate over all visibleRowNodes to preserve the current order
259
- this.adaptableApi.internalApi.forAllVisibleRowNodesDo((rowNode) => {
260
- const rowPrimaryKeyValue = this.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(rowNode);
261
- const selectedRowCells = selectedCellsByPrimaryKey[rowPrimaryKeyValue];
262
- if (selectedRowCells) {
263
- const selectedRowColumnIds = selectedRowCells.map((rowCell) => rowCell.column.columnId);
264
- const selectedColumnIds = columnIds.filter((columnId) => selectedRowColumnIds.includes(columnId));
265
- const row = this.getRowObjectForColumnIds(rowNode, selectedColumnIds);
266
- if (includePrimaryKey) {
267
- row[this.adaptableApi.optionsApi.getPrimaryKey()] = rowPrimaryKeyValue;
268
- }
269
- resultRowData.push(row);
270
- }
271
- });
272
- break;
273
- case 'SelectedRows':
274
- const selectedRowInfo = this.adaptableApi.gridApi.getSelectedRowInfo();
275
- const selectedGridRowPrimaryKeys = (_b = (_a = selectedRowInfo === null || selectedRowInfo === void 0 ? void 0 : selectedRowInfo.gridRows) === null || _a === void 0 ? void 0 : _a.filter((gr) => gr.rowInfo.isGroup == false).map((gridRow) => gridRow.primaryKeyValue)) !== null && _b !== void 0 ? _b : [];
276
- if (selectedGridRowPrimaryKeys.length) {
277
- this.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
278
- const rowPrimaryKeyValue = this.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(rowNode);
279
- if (selectedGridRowPrimaryKeys.includes(rowPrimaryKeyValue)) {
280
- resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
281
- }
282
- });
283
- }
284
- break;
285
- }
286
- return resultRowData;
287
- }
288
- getReportData(report, includePrimaryKey = false) {
289
- if (this.adaptableApi.exportApi.isExternalReport(report)) {
290
- return this.adaptableApi.exportApi.runExternalReport(report.Name);
291
- }
292
- const columns = this.getReportDataColumns(report, includePrimaryKey);
293
- const rows = this.getReportDataRows(report, columns, includePrimaryKey);
294
- return { columns, rows };
295
- }
296
- getReportDataAsArray(report, includePrimaryKey = false) {
297
- const reportData = this.getReportData(report, includePrimaryKey);
298
- return this.convertReportDataToArray(reportData);
299
- }
300
- convertReportDataToArray(reportData) {
301
- return [
302
- reportData.columns.map((column) => column.friendlyName),
303
- ...reportData.rows.map((row) => reportData.columns.map((column) => row[column.columnId])),
304
- ];
305
- }
306
- getRowObjectForColumnIds(rowNode, columnIds) {
307
- return columnIds.reduce((result, columnId) => {
308
- result[columnId] = this.getCellExportValueFromRowNode(rowNode, columnId);
309
- return result;
310
- }, {});
311
- }
312
- PublishLiveLiveDataChangedEvent(reportDestination, liveDataTrigger, liveReport) {
313
- const liveDataChangedInfo = {
314
- adaptableApi: this.adaptableApi,
315
- reportDestination: reportDestination,
316
- liveDataTrigger: liveDataTrigger,
317
- liveReport: liveReport,
318
- userName: this.adaptableApi.optionsApi.getUserName(),
319
- adaptableId: this.adaptableApi.optionsApi.getAdaptableId(),
320
- };
321
- this.adaptableApi.eventApi.emit('LiveDataChanged', liveDataChangedInfo);
322
- }
323
- getCellExportValueFromRowNode(rowNode, columnId) {
324
- return this.getCellExportValueFromRawValue(rowNode, this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, columnId), columnId);
325
- }
326
- getCellExportValueFromRawValue(rowNode, cellRawValue, columnId) {
327
- if (StringExtensions_1.default.IsNullOrEmpty(cellRawValue)) {
328
- return cellRawValue;
329
- }
330
- const column = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
331
- const columnDataType = column.dataType;
332
- // if this is a date column and there is a custom export date format provided, that will take precedence
333
- if (columnDataType === 'Date' && !!this.getCustomExportDateFormat()) {
334
- const exportDateFormat = this.getCustomExportDateFormat();
335
- return FormatHelper_1.default.DateFormatter(cellRawValue, {
336
- Pattern: exportDateFormat,
337
- });
338
- }
339
- // otherwise check the general export format types
340
- let cellExportFormat = this.adaptableApi.exportApi.internalApi.getCellExportFormatType(column, columnDataType);
341
- return this.getCellExportValueFromRawValueByType(rowNode, cellRawValue, columnId, cellExportFormat);
342
- }
343
- getReportFileName(reportName, destination) {
344
- let fileName;
345
- const reportFilename = this.adaptableApi.optionsApi.getExportOptions().reportFilename;
346
- if (reportFilename) {
347
- const reportFileNameContext = Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(this.adaptableApi)), { reportName,
348
- destination });
349
- fileName = reportFilename(reportFileNameContext);
350
- }
351
- else {
352
- fileName = StringExtensions_1.default.ReplaceEmptySpacesWithUnderscore(reportName);
353
- if (this.adaptableApi.optionsApi.getExportOptions().appendFileTimestamp) {
354
- fileName = `${fileName}_${(0, FormatHelper_1.DateFormatter)(new Date(), {
355
- Pattern: 'yyyyMMdd_HHmmss',
356
- })}`;
357
- }
358
- }
359
- return fileName;
360
- }
361
- getCustomExportDateFormat() {
362
- return this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
363
- }
364
- getCellExportValueFromRawValueByType(rowNode, cellRawValue, columnId,
365
- // default to rawValue if, for some reason, the configs provide invalid values
366
- type = 'rawValue') {
367
- return type === 'rawValue'
368
- ? cellRawValue
369
- : // type === formattedValue
370
- this.adaptableApi.gridApi.getDisplayValueFromRawValue(rowNode, columnId, cellRawValue);
371
- }
372
- // aggregate and merge all acive Adaptable styles with the user proviided ExcelStyles
373
- buildExcelStylesForVisualReports() {
374
- // for historical reasons, the styles are merged as class variables
375
- // we could/should refactor this to be more functional
376
- this.createExcelStyleMemoization();
377
- return Object.values(this.excelStylesCache);
378
- }
379
- createExcelStyleMemoization() {
380
- this.resetExcelStyleMemoization();
381
- // we memoize as much as possible, as this is called quite A LOT
382
- const adaptableColumnMap = {};
383
- const getAdaptableColumnWithColumnId = (columnId) => {
384
- const memoizedColumn = adaptableColumnMap[columnId];
385
- if (memoizedColumn) {
386
- return memoizedColumn;
387
- }
388
- const abColumn = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
389
- adaptableColumnMap[columnId] = abColumn;
390
- return abColumn;
391
- };
392
- const formatColumnsWithDisplayFormatForColumn = {};
393
- const getFormatColumnsWithDisplayFormatForColumn = (columnId) => {
394
- const memoizedFormatColumns = formatColumnsWithDisplayFormatForColumn[columnId];
395
- if (memoizedFormatColumns) {
396
- return memoizedFormatColumns;
397
- }
398
- const abColumn = getAdaptableColumnWithColumnId(columnId);
399
- const formatColumns = this.adaptableApi.formatColumnApi.internalApi.getFormatColumnsWithDisplayFormatForColumn(abColumn);
400
- formatColumnsWithDisplayFormatForColumn[columnId] = formatColumns;
401
- return formatColumns;
402
- };
403
- const displayedColumns = this.adaptableApi.agGridApi.getAllDisplayedColumns();
404
- const colDefs = displayedColumns.map((column) => {
405
- return column.getColDef();
406
- });
407
- const forAllVisibleRowNodesDoConfig = { includeGroupRows: true };
408
- const agGridApi = this.adaptableApi.agGridApi;
409
- const userExcelStyles = this.adaptableApi.internalApi
410
- .getAdaptableInstance()
411
- .agGridAdapter.getUserGridOptionsProperty('excelStyles') || [];
412
- this.adaptableApi.internalApi.forAllVisibleRowNodesDo((node, rowIndex) => {
413
- const rowParams = {
414
- node,
415
- data: node.data,
416
- rowIndex,
417
- api: agGridApi,
418
- columnApi: null,
419
- context: agGridApi.getGridOption('context') || {},
420
- };
421
- const getRowStyleFn = agGridApi.getGridOption('getRowStyle');
422
- const rowStyle = getRowStyleFn ? getRowStyleFn(rowParams) : {};
423
- displayedColumns.forEach((column, columnIndex) => {
424
- var _a, _b, _c;
425
- const colDef = colDefs[columnIndex];
426
- const columnId = column.getId();
427
- const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
428
- const isDateCellExportedAsFormattedValue = this.adaptableApi.exportApi.internalApi.isDateCellExportedAsFormattedValue(adaptableColumn);
429
- let cellClassParams;
430
- const getLazyCellClassParams = () => {
431
- if (!cellClassParams) {
432
- cellClassParams = {
433
- colDef,
434
- node,
435
- column,
436
- data: node.data,
437
- value: this.adaptableApi.gridApi.getRawValueFromRowNode(node, columnId),
438
- rowIndex,
439
- api: agGridApi,
440
- columnApi: null,
441
- context: {},
442
- };
443
- }
444
- return cellClassParams;
445
- };
446
- const cellStyle = typeof colDef.cellStyle === 'function' ? colDef.cellStyle(getLazyCellClassParams()) : {};
447
- const excelStyles = [];
448
- // add user defined excel styles
449
- let userColDefCellClass = this.adaptableApi.internalApi
450
- .getAdaptableInstance()
451
- .agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'cellClass');
452
- const userDefinedCellClass = typeof userColDefCellClass === 'function'
453
- ? userColDefCellClass(getLazyCellClassParams())
454
- : userColDefCellClass;
455
- const userDefinedExcelStyle = userDefinedCellClass &&
456
- userExcelStyles.find((excelStyle) => {
457
- var _a;
458
- return typeof userDefinedCellClass === 'string'
459
- ? userDefinedCellClass === excelStyle.id
460
- : (_a = userDefinedCellClass === null || userDefinedCellClass === void 0 ? void 0 : userDefinedCellClass.includes) === null || _a === void 0 ? void 0 : _a.call(userDefinedCellClass, excelStyle.id);
461
- });
462
- if (userDefinedExcelStyle) {
463
- excelStyles.push(userDefinedExcelStyle);
464
- }
465
- // add adaptable derived styles (format column etc.)
466
- const adaptableStyle = Object.assign(Object.assign({}, rowStyle), Object.keys(cellStyle).reduce((result, key) => {
467
- if (cellStyle[key] !== null) {
468
- result[key] = cellStyle[key];
469
- }
470
- return result;
471
- }, {}));
472
- const sanitizedAdaptableStyle = (0, StyleHelper_1.sanitizeStyle)(adaptableStyle);
473
- if (Object.values(sanitizedAdaptableStyle).some((style) => style != null)) {
474
- excelStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableStyle));
475
- }
476
- const excelDataType = this.adaptableApi.exportApi.internalApi.getExcelDataType(colDef === null || colDef === void 0 ? void 0 : colDef.type);
477
- const rawValue = this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId());
478
- // don't add the cell style if it has no adaptable custom styles
479
- if (!excelStyles.length &&
480
- // if this is a formatted Date value, we still need to add the AG GRID specific type & numberFormat below
481
- !(excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue)) {
482
- return;
483
- }
484
- const cellClassId = this.adaptableApi.internalApi
485
- .getAdaptableInstance()
486
- .agGridColumnAdapter.getExcelClassNameForCell(column.getId(), this.adaptableApi.internalApi
487
- .getAdaptableInstance()
488
- .getPrimaryKeyValueFromRowNode(node), userDefinedCellClass);
489
- const finalCellExcelStyle = Object.assign({}, ...excelStyles);
490
- if (excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue) {
491
- let dateFormatPattern = this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
492
- const abColumn = getAdaptableColumnWithColumnId(column.getColId());
493
- if (!dateFormatPattern) {
494
- const mostRelevantFormatColumn = this.adaptableApi.formatColumnApi.internalApi.getMostRelevantFormatColumnForColumn(getFormatColumnsWithDisplayFormatForColumn(column.getColId()), abColumn, { node, value: rawValue });
495
- dateFormatPattern =
496
- ((_a = mostRelevantFormatColumn === null || mostRelevantFormatColumn === void 0 ? void 0 : mostRelevantFormatColumn.DisplayFormat) === null || _a === void 0 ? void 0 : _a.Formatter) === 'DateFormatter' &&
497
- ((_c = (_b = mostRelevantFormatColumn === null || mostRelevantFormatColumn === void 0 ? void 0 : mostRelevantFormatColumn.DisplayFormat) === null || _b === void 0 ? void 0 : _b.Options) === null || _c === void 0 ? void 0 : _c.Pattern);
498
- }
499
- if (dateFormatPattern) {
500
- const normalisedValue = this.adaptableApi.internalApi
501
- .getAdaptableInstance()
502
- .getNormalisedValueFromRawValue(rawValue, abColumn);
503
- if (normalisedValue) {
504
- // we have to pass the date in the ISO format to Excel
505
- // see https://www.ag-grid.com/javascript-data-grid/excel-export-data-types/#dates
506
- // we can NOT use Date.toISOString() because we don't want the timezone corrections to kick in
507
- const isoFormattedValue = (0, FormatHelper_1.DateFormatter)(normalisedValue, {
508
- Pattern: `yyyy-MM-dd'T'HH:mm:ss.SSS`,
509
- });
510
- if (isoFormattedValue) {
511
- finalCellExcelStyle.dataType = 'DateTime';
512
- finalCellExcelStyle.numberFormat = { format: dateFormatPattern };
513
- // create a new cell key to ensure any user provided className does not interfere
514
- const cellKey = this.adaptableApi.internalApi
515
- .getAdaptableInstance()
516
- .agGridColumnAdapter.getExcelClassNameForCell(column.getColId(), this.adaptableApi.internalApi
517
- .getAdaptableInstance()
518
- .getPrimaryKeyValueFromRowNode(node));
519
- // we need to register so that later the cellProcessor will put the isoFormattedValue through (thus giving the formatting responsability to Excel)
520
- this.registerExcelStyleWithFormattedDate(cellKey, isoFormattedValue);
521
- }
522
- }
523
- }
524
- }
525
- this.registerExcelStyle(finalCellExcelStyle, cellClassId);
526
- });
527
- }, forAllVisibleRowNodesDoConfig);
528
- }
529
- convertCSSToExcelStyle(style) {
530
- const getHexColor = (color) => {
531
- const preparedColor = (0, StyleHelper_1.getVariableColor)(color);
532
- const t = (0, tinycolor2_1.default)(preparedColor);
533
- const a = t.getAlpha();
534
- return tinycolor2_1.default.mix((0, tinycolor2_1.default)('white'), t, a * 100).toHexString();
535
- };
536
- let result = {};
537
- if (style.backgroundColor != null) {
538
- result.interior = {
539
- color: getHexColor(style.backgroundColor),
540
- pattern: 'Solid',
541
- };
542
- }
543
- if (style.borderColor != null) {
544
- const excelBorder = {
545
- color: style.borderColor,
546
- lineStyle: 'Continuous',
547
- weight: 1,
548
- };
549
- result.borders = {
550
- borderBottom: excelBorder,
551
- borderLeft: excelBorder,
552
- borderRight: excelBorder,
553
- borderTop: excelBorder,
554
- };
555
- }
556
- if (style.textAlign) {
557
- result.alignment = {
558
- horizontal: StringExtensions_1.default.CapitaliseFirstLetter(style.textAlign),
559
- };
560
- }
561
- if (style.color != null) {
562
- if (!result.font) {
563
- result.font = {};
564
- }
565
- result.font = {
566
- color: getHexColor(style.color),
567
- };
568
- }
569
- if (style.fontStyle === 'italic') {
570
- if (!result.font) {
571
- result.font = {};
572
- }
573
- result.font.italic = true;
574
- }
575
- if (style.fontWeight != null &&
576
- (style.fontWeight === 'bold' || Number(style.fontWeight) >= 600)) {
577
- if (!result.font) {
578
- result.font = {};
579
- }
580
- result.font.bold = true;
581
- }
582
- if (style.fontSize != null) {
583
- if (!result.font) {
584
- result.font = {};
585
- }
586
- result.font.size = (0, StyleHelper_1.convertCSSAbsoluteFontSizeToPt)(style.fontSize);
587
- }
588
- return result;
589
- }
590
- resetExcelStyleMemoization() {
591
- this.excelStylesCache = {};
592
- this.cellClassKey2excelStyleIdMap = {};
593
- this.excelStylesWithFormattedDate = {};
594
- }
595
- registerExcelStyle(excelStyle, cellClassKey) {
596
- const excelStyleKey = JSON.stringify(excelStyle);
597
- if (!this.excelStylesCache[excelStyleKey]) {
598
- const excelStyleId = (0, uuid_1.createUuid)();
599
- const excelStyleWithId = Object.assign(Object.assign({}, excelStyle), { id: excelStyleId });
600
- this.excelStylesCache[excelStyleKey] = excelStyleWithId;
601
- }
602
- this.cellClassKey2excelStyleIdMap[cellClassKey] = this.excelStylesCache[excelStyleKey].id;
603
- }
604
- registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
605
- this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
606
- }
607
- }
608
- exports.ReportService = ReportService;
@@ -1,2 +0,0 @@
1
- import { AdaptableObject } from '../PredefinedConfig/Common/AdaptableObject';
2
- export declare const isAdaptableObject: (object: unknown) => object is AdaptableObject;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAdaptableObject = void 0;
4
- // pretty primitive type guard for AdaptableObject, but currently there is no better/safer way
5
- const isAdaptableObject = (object) => {
6
- return object != undefined && typeof object['Uuid'] === 'string';
7
- };
8
- exports.isAdaptableObject = isAdaptableObject;
@@ -1 +0,0 @@
1
- export declare const reorder: (list: any[], startIndex: number, endIndex: number) => any[];
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reorder = void 0;
4
- const reorder = (list, startIndex, endIndex) => {
5
- const result = [...list];
6
- if (startIndex > list.length - 1) {
7
- // not much that we can do if the dragged item is out of bounds...
8
- return result;
9
- }
10
- if (endIndex > list.length - 1) {
11
- endIndex = list.length - 1;
12
- }
13
- const [removed] = result.splice(startIndex, 1);
14
- result.splice(endIndex, 0, removed);
15
- return result;
16
- };
17
- exports.reorder = reorder;
@@ -1,11 +0,0 @@
1
- export declare function sortWithOrderArray<T>(arr: T[], order: T[],
2
- /**
3
- *
4
- * The array can contain items which are not listed in the order array.
5
- * So sortUnorderedItems decides whether to leave these items untouched
6
- * in the current order in which they are in the array (sortUnorderedItems: false)
7
- * or to sort them using normal comparison rules
8
- */
9
- { sortUnorderedItems: sortUnorderedItems }: {
10
- sortUnorderedItems: boolean;
11
- }): T[];