@adaptabletools/adaptable 18.1.13 → 18.1.15-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 (156) 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/TeamSharingApiImpl.js +2 -6
  28. package/src/Api/Internal/AdaptableInternalApi.d.ts +2 -6
  29. package/src/Api/Internal/AdaptableInternalApi.js +5 -11
  30. package/src/Api/Internal/EntitlementInternalApi.d.ts +4 -0
  31. package/src/Api/Internal/EntitlementInternalApi.js +11 -0
  32. package/src/Api/Internal/ExportInternalApi.d.ts +33 -8
  33. package/src/Api/Internal/ExportInternalApi.js +576 -5
  34. package/src/Api/Internal/NamedQueryInternalApi.d.ts +0 -1
  35. package/src/Api/Internal/NamedQueryInternalApi.js +0 -4
  36. package/src/PredefinedConfig/AdaptableState.d.ts +0 -5
  37. package/src/PredefinedConfig/Common/FilterActionOnDataChange.d.ts +2 -1
  38. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  39. package/src/Redux/ActionsReducers/GridRedux.d.ts +6 -6
  40. package/src/Redux/ActionsReducers/GridRedux.js +8 -8
  41. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +3 -3
  42. package/src/Redux/ActionsReducers/LayoutRedux.js +9 -9
  43. package/src/Redux/ActionsReducers/NamedQueryRedux.d.ts +1 -1
  44. package/src/Redux/ActionsReducers/NamedQueryRedux.js +1 -1
  45. package/src/Redux/ActionsReducers/PluginsRedux.d.ts +2 -2
  46. package/src/Redux/ActionsReducers/PluginsRedux.js +2 -2
  47. package/src/Redux/Store/AdaptableReduxMerger.js +3 -3
  48. package/src/Redux/Store/AdaptableStore.js +2 -4
  49. package/src/Strategy/AdaptableModuleBase.js +1 -2
  50. package/src/Strategy/ColumnFilterModule.js +1 -2
  51. package/src/Strategy/ExportModule.js +17 -44
  52. package/src/Strategy/FlashingCellModule.js +2 -10
  53. package/src/Strategy/ScheduleModule.js +4 -6
  54. package/src/Strategy/SmartEditModule.js +1 -7
  55. package/src/Strategy/TeamSharingModule.js +2 -2
  56. package/src/Strategy/Utilities/Export/getExportColumnsViewItems.js +1 -1
  57. package/src/Strategy/Utilities/Export/getExportRowsViewItems.js +1 -3
  58. package/src/Utilities/Constants/FilterConstants.d.ts +10 -0
  59. package/src/Utilities/Constants/FilterConstants.js +8 -0
  60. package/src/Utilities/Constants/GeneralConstants.d.ts +41 -4
  61. package/src/Utilities/Constants/GeneralConstants.js +42 -3
  62. package/src/Utilities/Defaults/DefaultSettingsPanel.d.ts +0 -2
  63. package/src/Utilities/Defaults/DefaultSettingsPanel.js +0 -5
  64. package/src/Utilities/Extensions/ArrayExtensions.d.ts +14 -0
  65. package/src/Utilities/Extensions/ArrayExtensions.js +65 -0
  66. package/src/Utilities/Extensions/EnumExtensions.d.ts +0 -4
  67. package/src/Utilities/Extensions/EnumExtensions.js +2 -12
  68. package/src/Utilities/Helpers/AdaptableHelper.d.ts +4 -10
  69. package/src/Utilities/Helpers/AdaptableHelper.js +7 -59
  70. package/src/Utilities/Helpers/FormatHelper.d.ts +9 -0
  71. package/src/Utilities/Helpers/FormatHelper.js +26 -14
  72. package/src/Utilities/Helpers/Helper.d.ts +0 -10
  73. package/src/Utilities/Helpers/Helper.js +0 -70
  74. package/src/Utilities/Services/ChartingService.d.ts +2 -2
  75. package/src/Utilities/Services/ChartingService.js +5 -11
  76. package/src/Utilities/Services/ModuleService.js +35 -31
  77. package/src/Utilities/Services/RowEditService.js +1 -6
  78. package/src/Utilities/Services/RowSummaryService.js +2 -2
  79. package/src/Utilities/Services/ValidationService.js +2 -16
  80. package/src/View/Alert/AlertEmptyView.js +1 -2
  81. package/src/View/Charting/ChartingStatusBarPopover.js +1 -2
  82. package/src/View/Charting/useChartingElements.js +1 -1
  83. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +2 -6
  84. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +2 -4
  85. package/src/View/Components/FilterForm/QuickFilterForm.js +2 -12
  86. package/src/View/Components/ModuleValueSelector/index.js +2 -2
  87. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +2 -5
  88. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupBody.js +1 -3
  89. package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +2 -1
  90. package/src/View/Components/Popups/AdaptablePopupAlert.js +1 -7
  91. package/src/View/Components/ToolPanel/AdaptableToolPanel.js +6 -12
  92. package/src/View/Components/ToolPanel/CustomToolPanelContent.js +3 -23
  93. package/src/View/Components/ToolPanel/ToolPanelPopup.js +4 -5
  94. package/src/View/Components/ToolPanel/ToolPanelWrapper.js +1 -3
  95. package/src/View/Components/ValueSelector/index.js +2 -2
  96. package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +2 -2
  97. package/src/View/Dashboard/CustomDashboardButton.js +1 -6
  98. package/src/View/Dashboard/CustomToolbar.js +2 -9
  99. package/src/View/Dashboard/Dashboard.js +2 -4
  100. package/src/View/Dashboard/DashboardPopup.js +1 -3
  101. package/src/View/Dashboard/DashboardToolbarFactory.js +1 -2
  102. package/src/View/Dashboard/PinnedToolbarsSelector.js +1 -2
  103. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -3
  104. package/src/View/Export/ExportViewPanel.js +2 -4
  105. package/src/View/Export/Wizard/ReportSummaryWizard.js +2 -6
  106. package/src/View/GridFilter/GridFilterExpressionEditor.js +2 -2
  107. package/src/View/GridFilter/useGridFilterExpressionEditor.js +2 -6
  108. package/src/View/Layout/LayoutViewPanel.js +1 -1
  109. package/src/View/Layout/PivotDetailsPopoup.js +1 -7
  110. package/src/View/Layout/SaveLayoutButton.js +1 -3
  111. package/src/View/Layout/Wizard/sections/AggregationsSection.js +2 -2
  112. package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -2
  113. package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +2 -2
  114. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +2 -2
  115. package/src/View/Layout/Wizard/sections/RowSummarySection.js +2 -2
  116. package/src/View/Layout/Wizard/sections/SortSection.js +2 -2
  117. package/src/View/NamedQuery/Wizard/NamedQueryWizard.js +3 -3
  118. package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
  119. package/src/View/SystemStatus/SystemStatusPopup.js +1 -1
  120. package/src/View/Wizard/OnePageAdaptableWizard.js +2 -2
  121. package/src/agGrid/ActionColumnRenderer.js +8 -22
  122. package/src/agGrid/AdaptableAgGrid.d.ts +5 -7
  123. package/src/agGrid/AdaptableAgGrid.js +159 -148
  124. package/src/agGrid/AgGridAdapter.d.ts +0 -1
  125. package/src/agGrid/AgGridAdapter.js +8 -11
  126. package/src/agGrid/AgGridColumnAdapter.d.ts +3 -1
  127. package/src/agGrid/AgGridColumnAdapter.js +40 -14
  128. package/src/agGrid/BadgeRenderer.js +4 -22
  129. package/src/agGrid/FloatingFilterWrapper.js +21 -0
  130. package/src/agGrid/buildSortedColumnStateForLayout.d.ts +1 -1
  131. package/src/agGrid/buildSortedColumnStateForLayout.js +2 -2
  132. package/src/agGrid/defaultAdaptableOptions.js +35 -30
  133. package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +3 -15
  134. package/src/env.js +2 -2
  135. package/src/metamodel/adaptable.metamodel.d.ts +84 -8
  136. package/src/metamodel/adaptable.metamodel.js +1 -1
  137. package/src/types.d.ts +9 -9
  138. package/tsconfig.esm.tsbuildinfo +1 -1
  139. package/src/Redux/ActionsReducers/QueryRedux.d.ts +0 -10
  140. package/src/Redux/ActionsReducers/QueryRedux.js +0 -20
  141. package/src/Utilities/Helpers/FormatContentHelper.d.ts +0 -22
  142. package/src/Utilities/Helpers/FormatContentHelper.js +0 -34
  143. package/src/Utilities/Services/EntitlementService.d.ts +0 -14
  144. package/src/Utilities/Services/EntitlementService.js +0 -63
  145. package/src/Utilities/Services/Interface/IEntitlementService.d.ts +0 -10
  146. package/src/Utilities/Services/Interface/IEntitlementService.js +0 -1
  147. package/src/Utilities/Services/Interface/IReportService.d.ts +0 -27
  148. package/src/Utilities/Services/Interface/IReportService.js +0 -1
  149. package/src/Utilities/Services/ReportService.d.ts +0 -41
  150. package/src/Utilities/Services/ReportService.js +0 -603
  151. package/src/Utilities/isAdaptableObject.d.ts +0 -2
  152. package/src/Utilities/isAdaptableObject.js +0 -4
  153. package/src/Utilities/reorder.d.ts +0 -1
  154. package/src/Utilities/reorder.js +0 -13
  155. package/src/Utilities/sortWithOrder.d.ts +0 -11
  156. package/src/Utilities/sortWithOrder.js +0 -50
@@ -0,0 +1,11 @@
1
+ import { ApiBase } from '../Implementation/ApiBase';
2
+ export class EntitlementInternalApi extends ApiBase {
3
+ setModulesEntitlements() {
4
+ this.getAdaptableApi()
5
+ .internalApi.getModuleService()
6
+ .getModuleCollection()
7
+ .forEach((module) => {
8
+ module.setModuleEntitlement();
9
+ });
10
+ }
11
+ }
@@ -1,16 +1,14 @@
1
1
  import { ApiBase } from '../Implementation/ApiBase';
2
2
  import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
3
- import { Report } from '../../PredefinedConfig/ExportState';
3
+ import { Report, ReportData, SystemReportName } from '../../PredefinedConfig/ExportState';
4
4
  import { AdaptableColumnType } from '../../PredefinedConfig/Common/Types';
5
- import { ExcelDataType, ExcelStyle } from '@ag-grid-community/core';
5
+ import { ExcelDataType, ExcelStyle, IRowNode } from '@ag-grid-community/core';
6
6
  import { AdaptableColumn, AdaptableColumnDataType } from '../../PredefinedConfig/Common/AdaptableColumn';
7
- import { DataFormatType } from '../../AdaptableOptions/ExportOptions';
7
+ import { AdaptableReportColumn, CustomDestination, DataFormatType, SystemExportDestination } from '../../AdaptableOptions/ExportOptions';
8
8
  export declare class ExportInternalApi extends ApiBase {
9
- /**
10
- * Whether given data change affects given report
11
- * @param cellDataChangedInfo data change to check
12
- * @param report report to check
13
- */
9
+ private excelStylesCache;
10
+ private cellClassKey2excelStyleIdMap;
11
+ private excelStylesWithFormattedDate;
14
12
  isDataChangeInReport(cellDataChangedInfo: CellDataChangedInfo, report: Report): boolean;
15
13
  getExcelDataType(adaptableColumnType: string | string[] | AdaptableColumnType | AdaptableColumnType[]): ExcelDataType;
16
14
  isVisualDataExportInProgress(): boolean;
@@ -18,4 +16,31 @@ export declare class ExportInternalApi extends ApiBase {
18
16
  getCellExportFormatType(column: AdaptableColumn, columnDataType: AdaptableColumnDataType): DataFormatType;
19
17
  isDestinationEnabled(destination: string): boolean;
20
18
  getExcelStylesForVisualDataExport(original_excelStyles: ExcelStyle[]): ExcelStyle[];
19
+ getExcelStyleIdForCellClassKey(cellClassKey: string): string;
20
+ getExcelStyleWithFormattedDate(cellClassId: string): string;
21
+ createSystemReport(systemReportName: SystemReportName): Report;
22
+ isSystemReport(reportName: string): boolean;
23
+ isSystemReportActive(reportName: SystemReportName): boolean;
24
+ isSystemExportDestinationActive(exportDestination: SystemExportDestination): boolean;
25
+ getReportColumnScopeShortDescription(report: Report): string[];
26
+ getReportColumnScopeLongDescription(report: Report): string;
27
+ getReportExpressionDescription(report: Report, cols: AdaptableColumn[]): string;
28
+ getReportDataColumns(report: Report, includePrimaryKey?: boolean): AdaptableReportColumn[];
29
+ getReportDataRows(report: Report, columns: AdaptableReportColumn[], includePrimaryKey?: boolean): Record<string, any>[];
30
+ getReportData(report: Report, includePrimaryKey?: boolean): ReportData;
31
+ getReportDataAsArray(report: Report, includePrimaryKey?: boolean): any[][];
32
+ convertReportDataToArray(reportData: ReportData): any[][];
33
+ getRowObjectForColumnIds(rowNode: IRowNode, columnIds: string[]): Record<string, any>;
34
+ publishLiveLiveDataChangedEvent(reportDestination: 'ipushpull' | 'OpenFin', liveDataTrigger: 'Connected' | 'Disconnected' | 'SnapshotSent' | 'LiveDataStarted' | 'LiveDataStopped' | 'LiveDataUpdated', liveReport?: any): void;
35
+ getCellExportValueFromRowNode(rowNode: IRowNode, columnId: string): any;
36
+ getCellExportValueFromRawValue(rowNode: IRowNode, cellRawValue: any, columnId: string): any;
37
+ getReportFileName(reportName: string, destination: SystemExportDestination | CustomDestination): string;
38
+ private getCustomExportDateFormat;
39
+ private getCellExportValueFromRawValueByType;
40
+ buildExcelStylesForVisualReports(): ExcelStyle[];
41
+ createExcelStyleMemoization(): void;
42
+ private convertCSSToExcelStyle;
43
+ private resetExcelStyleMemoization;
44
+ private registerExcelStyle;
45
+ private registerExcelStyleWithFormattedDate;
21
46
  }
@@ -1,10 +1,22 @@
1
1
  import { ApiBase } from '../Implementation/ApiBase';
2
+ import { groupBy } from 'lodash';
3
+ import tinycolor from 'tinycolor2';
4
+ import { ExportDestination } from '../../PredefinedConfig/Common/Enums';
5
+ import { createUuid } from '../../PredefinedConfig/Uuid';
6
+ import { VISUAL_DATA_REPORT, ALL_DATA_REPORT, CURRENT_DATA_REPORT, SELECTED_CELLS_REPORT, SELECTED_ROWS_REPORT, } from '../../Utilities/Constants/GeneralConstants';
7
+ import { ExportModuleId } from '../../Utilities/Constants/ModuleConstants';
8
+ import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
9
+ import StringExtensions from '../../Utilities/Extensions/StringExtensions';
10
+ import FormatHelper, { DateFormatter } from '../../Utilities/Helpers/FormatHelper';
11
+ import { sanitizeStyle, getVariableColor, convertCSSAbsoluteFontSizeToPt, } from '../../Utilities/Helpers/StyleHelper';
12
+ import { createBaseContext } from '../../Utilities/ObjectFactory';
2
13
  export class ExportInternalApi extends ApiBase {
3
- /**
4
- * Whether given data change affects given report
5
- * @param cellDataChangedInfo data change to check
6
- * @param report report to check
7
- */
14
+ constructor() {
15
+ super(...arguments);
16
+ this.excelStylesCache = {};
17
+ this.cellClassKey2excelStyleIdMap = {};
18
+ this.excelStylesWithFormattedDate = {};
19
+ }
8
20
  isDataChangeInReport(cellDataChangedInfo, report) {
9
21
  // for All Data Report any data change is true so get out asap
10
22
  if (report.Name == 'All Data') {
@@ -140,4 +152,563 @@ export class ExportInternalApi extends ApiBase {
140
152
  getExcelStylesForVisualDataExport(original_excelStyles) {
141
153
  return [];
142
154
  }
155
+ getExcelStyleIdForCellClassKey(cellClassKey) {
156
+ return this.cellClassKey2excelStyleIdMap[cellClassKey];
157
+ }
158
+ getExcelStyleWithFormattedDate(cellClassId) {
159
+ return this.excelStylesWithFormattedDate[cellClassId];
160
+ }
161
+ createSystemReport(systemReportName) {
162
+ switch (systemReportName) {
163
+ case VISUAL_DATA_REPORT:
164
+ return {
165
+ Uuid: createUuid(),
166
+ Name: VISUAL_DATA_REPORT,
167
+ ReportColumnScope: 'VisibleColumns',
168
+ ReportRowScope: 'VisibleRows',
169
+ Query: undefined,
170
+ IsReadOnly: true,
171
+ };
172
+ case ALL_DATA_REPORT:
173
+ return {
174
+ Uuid: createUuid(),
175
+ Name: ALL_DATA_REPORT,
176
+ ReportColumnScope: 'AllColumns',
177
+ ReportRowScope: 'AllRows',
178
+ Query: undefined,
179
+ IsReadOnly: true,
180
+ };
181
+ case CURRENT_DATA_REPORT:
182
+ return {
183
+ Uuid: createUuid(),
184
+ Name: CURRENT_DATA_REPORT,
185
+ ReportColumnScope: 'VisibleColumns',
186
+ ReportRowScope: 'VisibleRows',
187
+ Query: undefined,
188
+ IsReadOnly: true,
189
+ };
190
+ case SELECTED_CELLS_REPORT:
191
+ return {
192
+ Uuid: createUuid(),
193
+ Name: SELECTED_CELLS_REPORT,
194
+ ReportColumnScope: 'SelectedColumns',
195
+ ReportRowScope: 'SelectedCellRows',
196
+ Query: undefined,
197
+ IsReadOnly: true,
198
+ };
199
+ case SELECTED_ROWS_REPORT:
200
+ return {
201
+ Uuid: createUuid(),
202
+ Name: SELECTED_ROWS_REPORT,
203
+ ReportColumnScope: 'VisibleColumns',
204
+ ReportRowScope: 'SelectedRows',
205
+ Query: undefined,
206
+ IsReadOnly: true,
207
+ };
208
+ }
209
+ }
210
+ isSystemReport(reportName) {
211
+ return (reportName == null ||
212
+ reportName == ALL_DATA_REPORT ||
213
+ reportName == CURRENT_DATA_REPORT ||
214
+ reportName == SELECTED_CELLS_REPORT ||
215
+ reportName == SELECTED_ROWS_REPORT ||
216
+ reportName == VISUAL_DATA_REPORT);
217
+ }
218
+ isSystemReportActive(reportName) {
219
+ if (reportName == SELECTED_CELLS_REPORT) {
220
+ return this.getAdaptableApi().gridApi.isGridRangeSelectable();
221
+ }
222
+ if (reportName == SELECTED_ROWS_REPORT) {
223
+ return this.getAdaptableApi().gridApi.isGridRowSelectable();
224
+ }
225
+ if (reportName === VISUAL_DATA_REPORT) {
226
+ return this.getAdaptableApi()
227
+ .exportApi.getAvailableExportDestinations()
228
+ .includes(ExportDestination.Excel);
229
+ }
230
+ return true;
231
+ }
232
+ isSystemExportDestinationActive(exportDestination) {
233
+ if (exportDestination === ExportDestination.Excel) {
234
+ return this.getAdaptableApi().exportApi.canExportToExcel();
235
+ }
236
+ return true;
237
+ }
238
+ getReportColumnScopeShortDescription(report) {
239
+ var _a, _b;
240
+ if (this.getAdaptableApi().exportApi.isExternalReport(report)) {
241
+ return ['[Custom Columns]'];
242
+ }
243
+ switch (report.ReportColumnScope) {
244
+ case 'AllColumns':
245
+ return ['[All Columns]'];
246
+ case 'VisibleColumns':
247
+ return ['[Visible Columns]'];
248
+ case 'SelectedColumns':
249
+ return ['[Selected Columns]'];
250
+ case 'ScopeColumns':
251
+ if ('ColumnIds' in (report === null || report === void 0 ? void 0 : report.Scope)) {
252
+ return (_b = (_a = report.Scope.ColumnIds).map) === null || _b === void 0 ? void 0 : _b.call(_a, (columnId) => { var _a; return (_a = this.getAdaptableApi().columnApi.getFriendlyNameForColumnId(columnId)) !== null && _a !== void 0 ? _a : columnId; });
253
+ }
254
+ return ['[Bespoke Columns]'];
255
+ }
256
+ }
257
+ getReportColumnScopeLongDescription(report) {
258
+ if (this.getAdaptableApi().exportApi.isExternalReport(report)) {
259
+ return '[Custom Columns]';
260
+ }
261
+ switch (report.ReportColumnScope) {
262
+ case 'AllColumns':
263
+ return '[All Columns]';
264
+ case 'VisibleColumns':
265
+ return '[Visible Columns]';
266
+ case 'SelectedColumns':
267
+ return '[Selected Columns]';
268
+ case 'ScopeColumns':
269
+ return this.getAdaptableApi().columnScopeApi.getScopeDescription(report.Scope);
270
+ }
271
+ }
272
+ getReportExpressionDescription(report, cols) {
273
+ if (this.getAdaptableApi().exportApi.isExternalReport(report)) {
274
+ return '[Custom Data]';
275
+ }
276
+ if (this.isSystemReport(report.Name)) {
277
+ if (report.Name == ALL_DATA_REPORT) {
278
+ return '[All Data]';
279
+ }
280
+ else if (report.Name == CURRENT_DATA_REPORT) {
281
+ return '[All Current Data]';
282
+ }
283
+ else if (report.Name == SELECTED_CELLS_REPORT) {
284
+ return '[Selected Cells Data]';
285
+ }
286
+ else if (report.Name == SELECTED_ROWS_REPORT) {
287
+ return '[Selected Rows Data]';
288
+ }
289
+ else if (report.Name == VISUAL_DATA_REPORT) {
290
+ return '[Current Data as WYSIWYG]';
291
+ }
292
+ }
293
+ else {
294
+ switch (report.ReportRowScope) {
295
+ case 'AllRows':
296
+ return '[All Rows]';
297
+ case 'VisibleRows':
298
+ return '[Visible Rows]';
299
+ case 'SelectedRows':
300
+ return '[Selected Rows]';
301
+ case 'ExpressionRows':
302
+ return this.getAdaptableApi().internalApi.getAdaptableQueryExpressionText(report.Query);
303
+ }
304
+ }
305
+ }
306
+ getReportDataColumns(report, includePrimaryKey = false) {
307
+ let reportColumns = [];
308
+ let gridColumns = this.getAdaptableApi().columnApi.getExportableColumns();
309
+ if (this.getAdaptableApi().exportApi.isExternalReport(report)) {
310
+ return reportColumns;
311
+ }
312
+ // first get the cols depending on the Column Scope
313
+ switch (report.ReportColumnScope) {
314
+ case 'AllColumns':
315
+ reportColumns = gridColumns;
316
+ break;
317
+ case 'VisibleColumns':
318
+ reportColumns = gridColumns.filter((c) => c.visible);
319
+ break;
320
+ case 'SelectedColumns':
321
+ // we extract the selected columns from the grid columns to preserve the grid column order
322
+ const selectedColumnIds = this.getAdaptableApi()
323
+ .gridApi.getSelectedCellInfo()
324
+ .columns.map((column) => column.columnId);
325
+ reportColumns = gridColumns.filter((gridColumn) => selectedColumnIds.includes(gridColumn.columnId));
326
+ break;
327
+ case 'ScopeColumns':
328
+ if ('ColumnIds' in report.Scope) {
329
+ reportColumns = report.Scope.ColumnIds.map((columnId) => this.getAdaptableApi().columnApi.getColumnWithColumnId(columnId)).filter((c) => c);
330
+ }
331
+ else {
332
+ reportColumns = this.getAdaptableApi().columnScopeApi.getColumnsForScope(report.Scope);
333
+ }
334
+ break;
335
+ }
336
+ if (includePrimaryKey) {
337
+ const pkColumn = reportColumns.find((column) => column.columnId === this.getAdaptableApi().optionsApi.getPrimaryKey());
338
+ // TODO simplify after we fix the IsPrimaryKey bug
339
+ // const pkColumn = reportColumns.find(column => column.IsPrimaryKey);
340
+ if (!pkColumn && !!this.getAdaptableApi().columnApi.getPrimaryKeyColumn()) {
341
+ reportColumns.push(this.getAdaptableApi().columnApi.getPrimaryKeyColumn());
342
+ }
343
+ }
344
+ return reportColumns.map((column) => {
345
+ var _a;
346
+ return ({
347
+ columnId: column.columnId,
348
+ friendlyName: column.friendlyName,
349
+ dataType: column.dataType,
350
+ field: (_a = column.field) !== null && _a !== void 0 ? _a : column.columnId,
351
+ });
352
+ });
353
+ }
354
+ getReportDataRows(report, columns, includePrimaryKey) {
355
+ var _a, _b;
356
+ if (ArrayExtensions.IsNullOrEmpty(columns)) {
357
+ return [];
358
+ }
359
+ const columnIds = columns.map((column) => column.columnId);
360
+ const resultRowData = [];
361
+ switch (report.ReportRowScope) {
362
+ case 'AllRows':
363
+ this.getAdaptableApi().internalApi.forAllRowNodesDo((rowNode) => {
364
+ resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
365
+ });
366
+ break;
367
+ case 'VisibleRows':
368
+ this.getAdaptableApi().internalApi.forAllVisibleRowNodesDo((rowNode) => {
369
+ resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
370
+ });
371
+ break;
372
+ case 'ExpressionRows':
373
+ this.getAdaptableApi().internalApi.forAllRowNodesDo((rowNode) => {
374
+ var _a;
375
+ if (this.getAdaptableApi()
376
+ .internalApi.getQueryLanguageService()
377
+ .evaluateBooleanExpression((_a = report.Query) === null || _a === void 0 ? void 0 : _a.BooleanExpression, ExportModuleId, rowNode)) {
378
+ resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
379
+ }
380
+ });
381
+ break;
382
+ case 'SelectedCellRows':
383
+ const selectedCellInfo = this.getAdaptableApi().gridApi.getSelectedCellInfo();
384
+ const { gridCells: GridCells } = selectedCellInfo;
385
+ let selectedCellsByPrimaryKey = groupBy(GridCells, 'primaryKeyValue');
386
+ // we iterate over all visibleRowNodes to preserve the current order
387
+ this.getAdaptableApi().internalApi.forAllVisibleRowNodesDo((rowNode) => {
388
+ const rowPrimaryKeyValue = this.getAdaptableApi().gridApi.getPrimaryKeyValueForRowNode(rowNode);
389
+ const selectedRowCells = selectedCellsByPrimaryKey[rowPrimaryKeyValue];
390
+ if (selectedRowCells) {
391
+ const selectedRowColumnIds = selectedRowCells.map((rowCell) => rowCell.column.columnId);
392
+ const selectedColumnIds = columnIds.filter((columnId) => selectedRowColumnIds.includes(columnId));
393
+ const row = this.getRowObjectForColumnIds(rowNode, selectedColumnIds);
394
+ if (includePrimaryKey) {
395
+ row[this.getAdaptableApi().optionsApi.getPrimaryKey()] = rowPrimaryKeyValue;
396
+ }
397
+ resultRowData.push(row);
398
+ }
399
+ });
400
+ break;
401
+ case 'SelectedRows':
402
+ const selectedRowInfo = this.getAdaptableApi().gridApi.getSelectedRowInfo();
403
+ 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 : [];
404
+ if (selectedGridRowPrimaryKeys.length) {
405
+ this.getAdaptableApi().internalApi.forAllRowNodesDo((rowNode) => {
406
+ const rowPrimaryKeyValue = this.getAdaptableApi().gridApi.getPrimaryKeyValueForRowNode(rowNode);
407
+ if (selectedGridRowPrimaryKeys.includes(rowPrimaryKeyValue)) {
408
+ resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
409
+ }
410
+ });
411
+ }
412
+ break;
413
+ }
414
+ return resultRowData;
415
+ }
416
+ getReportData(report, includePrimaryKey = false) {
417
+ if (this.getAdaptableApi().exportApi.isExternalReport(report)) {
418
+ return this.getAdaptableApi().exportApi.runExternalReport(report.Name);
419
+ }
420
+ const columns = this.getReportDataColumns(report, includePrimaryKey);
421
+ const rows = this.getReportDataRows(report, columns, includePrimaryKey);
422
+ return { columns, rows };
423
+ }
424
+ getReportDataAsArray(report, includePrimaryKey = false) {
425
+ const reportData = this.getReportData(report, includePrimaryKey);
426
+ return this.convertReportDataToArray(reportData);
427
+ }
428
+ convertReportDataToArray(reportData) {
429
+ return [
430
+ reportData.columns.map((column) => column.friendlyName),
431
+ ...reportData.rows.map((row) => reportData.columns.map((column) => row[column.columnId])),
432
+ ];
433
+ }
434
+ getRowObjectForColumnIds(rowNode, columnIds) {
435
+ return columnIds.reduce((result, columnId) => {
436
+ result[columnId] = this.getCellExportValueFromRowNode(rowNode, columnId);
437
+ return result;
438
+ }, {});
439
+ }
440
+ publishLiveLiveDataChangedEvent(reportDestination, liveDataTrigger, liveReport) {
441
+ const liveDataChangedInfo = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { reportDestination: reportDestination, liveDataTrigger: liveDataTrigger, liveReport: liveReport });
442
+ this.getAdaptableApi().eventApi.emit('LiveDataChanged', liveDataChangedInfo);
443
+ }
444
+ getCellExportValueFromRowNode(rowNode, columnId) {
445
+ return this.getCellExportValueFromRawValue(rowNode, this.getAdaptableApi().gridApi.getRawValueFromRowNode(rowNode, columnId), columnId);
446
+ }
447
+ getCellExportValueFromRawValue(rowNode, cellRawValue, columnId) {
448
+ if (StringExtensions.IsNullOrEmpty(cellRawValue)) {
449
+ return cellRawValue;
450
+ }
451
+ const column = this.getAdaptableApi().columnApi.getColumnWithColumnId(columnId);
452
+ const columnDataType = column.dataType;
453
+ // if this is a date column and there is a custom export date format provided, that will take precedence
454
+ if (columnDataType === 'Date' && !!this.getCustomExportDateFormat()) {
455
+ const exportDateFormat = this.getCustomExportDateFormat();
456
+ return FormatHelper.DateFormatter(cellRawValue, {
457
+ Pattern: exportDateFormat,
458
+ });
459
+ }
460
+ // otherwise check the general export format types
461
+ let cellExportFormat = this.getAdaptableApi().exportApi.internalApi.getCellExportFormatType(column, columnDataType);
462
+ return this.getCellExportValueFromRawValueByType(rowNode, cellRawValue, columnId, cellExportFormat);
463
+ }
464
+ getReportFileName(reportName, destination) {
465
+ let fileName;
466
+ const reportFilename = this.getAdaptableApi().optionsApi.getExportOptions().reportFilename;
467
+ if (reportFilename) {
468
+ const reportFileNameContext = Object.assign(Object.assign({}, createBaseContext(this.getAdaptableApi())), { reportName,
469
+ destination });
470
+ fileName = reportFilename(reportFileNameContext);
471
+ }
472
+ else {
473
+ fileName = StringExtensions.ReplaceEmptySpacesWithUnderscore(reportName);
474
+ if (this.getAdaptableApi().optionsApi.getExportOptions().appendFileTimestamp) {
475
+ fileName = `${fileName}_${DateFormatter(new Date(), {
476
+ Pattern: 'yyyyMMdd_HHmmss',
477
+ })}`;
478
+ }
479
+ }
480
+ return fileName;
481
+ }
482
+ getCustomExportDateFormat() {
483
+ return this.getAdaptableApi().optionsApi.getExportOptions().exportDateFormat;
484
+ }
485
+ getCellExportValueFromRawValueByType(rowNode, cellRawValue, columnId,
486
+ // default to rawValue if, for some reason, the configs provide invalid values
487
+ type = 'rawValue') {
488
+ return type === 'rawValue'
489
+ ? cellRawValue
490
+ : // type === formattedValue
491
+ this.getAdaptableApi().gridApi.getDisplayValueFromRawValue(rowNode, columnId, cellRawValue);
492
+ }
493
+ // aggregate and merge all acive Adaptable styles with the user proviided ExcelStyles
494
+ buildExcelStylesForVisualReports() {
495
+ // for historical reasons, the styles are merged as class variables
496
+ // we could/should refactor this to be more functional
497
+ this.createExcelStyleMemoization();
498
+ return Object.values(this.excelStylesCache);
499
+ }
500
+ createExcelStyleMemoization() {
501
+ this.resetExcelStyleMemoization();
502
+ // we memoize as much as possible, as this is called quite A LOT
503
+ const adaptableColumnMap = {};
504
+ const getAdaptableColumnWithColumnId = (columnId) => {
505
+ const memoizedColumn = adaptableColumnMap[columnId];
506
+ if (memoizedColumn) {
507
+ return memoizedColumn;
508
+ }
509
+ const abColumn = this.getAdaptableApi().columnApi.getColumnWithColumnId(columnId);
510
+ adaptableColumnMap[columnId] = abColumn;
511
+ return abColumn;
512
+ };
513
+ const formatColumnsWithDisplayFormatForColumn = {};
514
+ const getFormatColumnsWithDisplayFormatForColumn = (columnId) => {
515
+ const memoizedFormatColumns = formatColumnsWithDisplayFormatForColumn[columnId];
516
+ if (memoizedFormatColumns) {
517
+ return memoizedFormatColumns;
518
+ }
519
+ const abColumn = getAdaptableColumnWithColumnId(columnId);
520
+ const formatColumns = this.getAdaptableApi().formatColumnApi.internalApi.getFormatColumnsWithDisplayFormatForColumn(abColumn);
521
+ formatColumnsWithDisplayFormatForColumn[columnId] = formatColumns;
522
+ return formatColumns;
523
+ };
524
+ const displayedColumns = this.getAdaptableApi().agGridApi.getAllDisplayedColumns();
525
+ const colDefs = displayedColumns.map((column) => {
526
+ return column.getColDef();
527
+ });
528
+ const forAllVisibleRowNodesDoConfig = { includeGroupRows: true };
529
+ const agGridApi = this.getAdaptableApi().agGridApi;
530
+ const userExcelStyles = this.adaptable.agGridAdapter.getUserGridOptionsProperty('excelStyles') || [];
531
+ this.getAdaptableApi().internalApi.forAllVisibleRowNodesDo((node, rowIndex) => {
532
+ const rowParams = {
533
+ node,
534
+ data: node.data,
535
+ rowIndex,
536
+ api: agGridApi,
537
+ context: agGridApi.getGridOption('context') || {},
538
+ };
539
+ const getRowStyleFn = agGridApi.getGridOption('getRowStyle');
540
+ const rowStyle = getRowStyleFn ? getRowStyleFn(rowParams) : {};
541
+ displayedColumns.forEach((column, columnIndex) => {
542
+ var _a, _b, _c;
543
+ const colDef = colDefs[columnIndex];
544
+ const columnId = column.getId();
545
+ const adaptableColumn = this.getAdaptableApi().columnApi.getColumnWithColumnId(columnId);
546
+ const isDateCellExportedAsFormattedValue = this.isDateCellExportedAsFormattedValue(adaptableColumn);
547
+ let cellClassParams;
548
+ const getLazyCellClassParams = () => {
549
+ if (!cellClassParams) {
550
+ cellClassParams = {
551
+ colDef,
552
+ node,
553
+ column,
554
+ data: node.data,
555
+ value: this.getAdaptableApi().gridApi.getRawValueFromRowNode(node, columnId),
556
+ rowIndex,
557
+ api: agGridApi,
558
+ context: {},
559
+ };
560
+ }
561
+ return cellClassParams;
562
+ };
563
+ const cellStyle = typeof colDef.cellStyle === 'function'
564
+ ? colDef.cellStyle(getLazyCellClassParams())
565
+ : {};
566
+ const excelStyles = [];
567
+ // add user defined excel styles
568
+ let userColDefCellClass = this.adaptable.agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'cellClass');
569
+ const userDefinedCellClass = typeof userColDefCellClass === 'function'
570
+ ? userColDefCellClass(getLazyCellClassParams())
571
+ : userColDefCellClass;
572
+ const userDefinedExcelStyle = userDefinedCellClass &&
573
+ userExcelStyles.find((excelStyle) => {
574
+ var _a;
575
+ return typeof userDefinedCellClass === 'string'
576
+ ? userDefinedCellClass === excelStyle.id
577
+ : (_a = userDefinedCellClass === null || userDefinedCellClass === void 0 ? void 0 : userDefinedCellClass.includes) === null || _a === void 0 ? void 0 : _a.call(userDefinedCellClass, excelStyle.id);
578
+ });
579
+ if (userDefinedExcelStyle) {
580
+ excelStyles.push(userDefinedExcelStyle);
581
+ }
582
+ // add adaptable derived styles (format column etc.)
583
+ const adaptableStyle = Object.assign(Object.assign({}, rowStyle), Object.keys(cellStyle).reduce((result, key) => {
584
+ if (cellStyle[key] !== null) {
585
+ result[key] = cellStyle[key];
586
+ }
587
+ return result;
588
+ }, {}));
589
+ const sanitizedAdaptableStyle = sanitizeStyle(adaptableStyle);
590
+ if (Object.values(sanitizedAdaptableStyle).some((style) => style != null)) {
591
+ excelStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableStyle));
592
+ }
593
+ const excelDataType = this.getExcelDataType(colDef === null || colDef === void 0 ? void 0 : colDef.type);
594
+ const rawValue = this.getAdaptableApi().gridApi.getRawValueFromRowNode(node, column.getId());
595
+ // don't add the cell style if it has no adaptable custom styles
596
+ if (!excelStyles.length &&
597
+ // if this is a formatted Date value, we still need to add the AG GRID specific type & numberFormat below
598
+ !(excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue)) {
599
+ return;
600
+ }
601
+ const cellClassId = this.adaptable.agGridColumnAdapter.getExcelClassNameForCell(column.getId(), this.adaptable.getPrimaryKeyValueFromRowNode(node), userDefinedCellClass);
602
+ const finalCellExcelStyle = Object.assign({}, ...excelStyles);
603
+ if (excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue) {
604
+ let dateFormatPattern = this.getAdaptableApi().optionsApi.getExportOptions().exportDateFormat;
605
+ const abColumn = getAdaptableColumnWithColumnId(column.getColId());
606
+ if (!dateFormatPattern) {
607
+ const mostRelevantFormatColumn = this.getAdaptableApi().formatColumnApi.internalApi.getMostRelevantFormatColumnForColumn(getFormatColumnsWithDisplayFormatForColumn(column.getColId()), abColumn, { node, value: rawValue });
608
+ dateFormatPattern =
609
+ ((_a = mostRelevantFormatColumn === null || mostRelevantFormatColumn === void 0 ? void 0 : mostRelevantFormatColumn.DisplayFormat) === null || _a === void 0 ? void 0 : _a.Formatter) === 'DateFormatter' &&
610
+ ((_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);
611
+ }
612
+ if (dateFormatPattern) {
613
+ const normalisedValue = this.adaptable.getNormalisedValueFromRawValue(rawValue, abColumn);
614
+ if (normalisedValue) {
615
+ // we have to pass the date in the ISO format to Excel
616
+ // see https://www.ag-grid.com/javascript-data-grid/excel-export-data-types/#dates
617
+ // we can NOT use Date.toISOString() because we don't want the timezone corrections to kick in
618
+ const isoFormattedValue = DateFormatter(normalisedValue, {
619
+ Pattern: `yyyy-MM-dd'T'HH:mm:ss.SSS`,
620
+ });
621
+ if (isoFormattedValue) {
622
+ finalCellExcelStyle.dataType = 'DateTime';
623
+ finalCellExcelStyle.numberFormat = { format: dateFormatPattern };
624
+ // create a new cell key to ensure any user provided className does not interfere
625
+ const cellKey = this.adaptable.agGridColumnAdapter.getExcelClassNameForCell(column.getColId(), this.adaptable.getPrimaryKeyValueFromRowNode(node));
626
+ // we need to register so that later the cellProcessor will put the isoFormattedValue through (thus giving the formatting responsability to Excel)
627
+ this.registerExcelStyleWithFormattedDate(cellKey, isoFormattedValue);
628
+ }
629
+ }
630
+ }
631
+ }
632
+ this.registerExcelStyle(finalCellExcelStyle, cellClassId);
633
+ });
634
+ }, forAllVisibleRowNodesDoConfig);
635
+ }
636
+ convertCSSToExcelStyle(style) {
637
+ const getHexColor = (color) => {
638
+ const preparedColor = getVariableColor(color);
639
+ const t = tinycolor(preparedColor);
640
+ const a = t.getAlpha();
641
+ return tinycolor.mix(tinycolor('white'), t, a * 100).toHexString();
642
+ };
643
+ let result = {};
644
+ if (style.backgroundColor != null) {
645
+ result.interior = {
646
+ color: getHexColor(style.backgroundColor),
647
+ pattern: 'Solid',
648
+ };
649
+ }
650
+ if (style.borderColor != null) {
651
+ const excelBorder = {
652
+ color: style.borderColor,
653
+ lineStyle: 'Continuous',
654
+ weight: 1,
655
+ };
656
+ result.borders = {
657
+ borderBottom: excelBorder,
658
+ borderLeft: excelBorder,
659
+ borderRight: excelBorder,
660
+ borderTop: excelBorder,
661
+ };
662
+ }
663
+ if (style.textAlign) {
664
+ result.alignment = {
665
+ horizontal: StringExtensions.CapitaliseFirstLetter(style.textAlign),
666
+ };
667
+ }
668
+ if (style.color != null) {
669
+ if (!result.font) {
670
+ result.font = {};
671
+ }
672
+ result.font = {
673
+ color: getHexColor(style.color),
674
+ };
675
+ }
676
+ if (style.fontStyle === 'italic') {
677
+ if (!result.font) {
678
+ result.font = {};
679
+ }
680
+ result.font.italic = true;
681
+ }
682
+ if (style.fontWeight != null &&
683
+ (style.fontWeight === 'bold' || Number(style.fontWeight) >= 600)) {
684
+ if (!result.font) {
685
+ result.font = {};
686
+ }
687
+ result.font.bold = true;
688
+ }
689
+ if (style.fontSize != null) {
690
+ if (!result.font) {
691
+ result.font = {};
692
+ }
693
+ result.font.size = convertCSSAbsoluteFontSizeToPt(style.fontSize);
694
+ }
695
+ return result;
696
+ }
697
+ resetExcelStyleMemoization() {
698
+ this.excelStylesCache = {};
699
+ this.cellClassKey2excelStyleIdMap = {};
700
+ this.excelStylesWithFormattedDate = {};
701
+ }
702
+ registerExcelStyle(excelStyle, cellClassKey) {
703
+ const excelStyleKey = JSON.stringify(excelStyle);
704
+ if (!this.excelStylesCache[excelStyleKey]) {
705
+ const excelStyleId = createUuid();
706
+ const excelStyleWithId = Object.assign(Object.assign({}, excelStyle), { id: excelStyleId });
707
+ this.excelStylesCache[excelStyleKey] = excelStyleWithId;
708
+ }
709
+ this.cellClassKey2excelStyleIdMap[cellClassKey] = this.excelStylesCache[excelStyleKey].id;
710
+ }
711
+ registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
712
+ this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
713
+ }
143
714
  }
@@ -10,5 +10,4 @@ export declare class NamedQueryInternalApi extends ApiBase {
10
10
  * @param namedQueryName namedQuery name
11
11
  */
12
12
  getNamedQueryModuleReferences(namedQueryName: string): string[];
13
- cleanupQueryRedux(): void;
14
13
  }