@adaptabletools/adaptable 15.2.0-canary.1 → 15.2.0-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.cjs.js +114 -114
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +10 -4
- package/src/AdaptableOptions/ExportOptions.d.ts +52 -2
- package/src/Api/GridApi.d.ts +10 -2
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -0
- package/src/Api/Implementation/AdaptableApiImpl.js +6 -0
- package/src/Api/Implementation/ExportApiImpl.d.ts +2 -3
- package/src/Api/Implementation/GridApiImpl.d.ts +6 -2
- package/src/Api/Implementation/GridApiImpl.js +4 -1
- package/src/Api/Implementation/LayoutApiImpl.js +1 -1
- package/src/Api/Internal/AdaptableInternalApi.d.ts +8 -2
- package/src/Api/Internal/AdaptableInternalApi.js +4 -4
- package/src/Api/Internal/LayoutInternalApi.js +1 -1
- package/src/PredefinedConfig/ExportState.d.ts +1 -1
- package/src/Strategy/ExportModule.d.ts +2 -1
- package/src/Strategy/ExportModule.js +78 -29
- package/src/Strategy/LayoutModule.js +1 -1
- package/src/Utilities/Services/Interface/IReportService.d.ts +4 -2
- package/src/Utilities/Services/ReportService.d.ts +3 -2
- package/src/Utilities/Services/ReportService.js +27 -25
- package/src/Utilities/waitForTimeout.d.ts +1 -0
- package/src/Utilities/waitForTimeout.js +12 -0
- package/src/View/Export/ExportTablePopup.js +7 -5
- package/src/agGrid/Adaptable.d.ts +10 -4
- package/src/agGrid/Adaptable.js +19 -10
- package/src/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/src/metamodel/adaptable.metamodel.d.ts +40 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "15.2.0-canary.
|
|
3
|
+
"version": "15.2.0-canary.3",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
package/publishTimestamp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: 1680872029172;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChartModel, ChartRef, Column,
|
|
1
|
+
import { ChartModel, ChartRef, Column, IRowNode, ModuleNames, RowModelType, StatusPanelDef } from '@ag-grid-community/core';
|
|
2
2
|
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
3
3
|
import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
4
4
|
import { ColumnSort } from '../PredefinedConfig/Common/ColumnSort';
|
|
@@ -196,8 +196,14 @@ export interface IAdaptable {
|
|
|
196
196
|
includeGroupRows?: boolean;
|
|
197
197
|
filterFn?: (rowNode: IRowNode) => boolean;
|
|
198
198
|
}): void;
|
|
199
|
-
forAllVisibleRowNodesDo(func: (rowNode: IRowNode) => void
|
|
200
|
-
|
|
199
|
+
forAllVisibleRowNodesDo(func: (rowNode: IRowNode, rowIndex: number) => void, config?: {
|
|
200
|
+
includeGroupRows?: boolean;
|
|
201
|
+
filterFn?: (rowNode: IRowNode) => boolean;
|
|
202
|
+
}): void;
|
|
203
|
+
getVisibleRowNodes(config?: {
|
|
204
|
+
includeGroupRows?: boolean;
|
|
205
|
+
filterFn?: (rowNode: IRowNode) => boolean;
|
|
206
|
+
}): IRowNode[];
|
|
201
207
|
getAllRowNodes(config?: {
|
|
202
208
|
includeGroupRows?: boolean;
|
|
203
209
|
filterFn?: (rowNode: IRowNode) => boolean;
|
|
@@ -229,7 +235,7 @@ export interface IAdaptable {
|
|
|
229
235
|
showChart(chart: ChartDefinition, container?: HTMLElement): ChartRef;
|
|
230
236
|
getChartRef(chardId: string): ChartRef;
|
|
231
237
|
getChartModels(): ChartModel[];
|
|
232
|
-
|
|
238
|
+
getRowModelType(): RowModelType;
|
|
233
239
|
getCurrentIPPStyle(): IPPStyle;
|
|
234
240
|
getDefaultIPPStyle(): IPPStyle;
|
|
235
241
|
getRowCount(): number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AdaptableForm } from '../PredefinedConfig/Common/AdaptableForm';
|
|
2
2
|
import { FormContext } from '../PredefinedConfig/Common/FormContext';
|
|
3
3
|
import { Report, ReportData, SystemReportNames } from '../PredefinedConfig/ExportState';
|
|
4
|
-
import {
|
|
4
|
+
import { AdaptableColumnDataType, BaseContext } from '../types';
|
|
5
5
|
/**
|
|
6
6
|
* Options regarding Exporting data from AdapTable
|
|
7
7
|
*/
|
|
@@ -29,6 +29,8 @@ export interface ExportOptions {
|
|
|
29
29
|
customDestinations?: CustomDestination[];
|
|
30
30
|
/**
|
|
31
31
|
* Reports generated entirely by users (and not AdapTable)
|
|
32
|
+
*
|
|
33
|
+
* @deprecated It will be renamed to `externalReports` in version 16
|
|
32
34
|
*/
|
|
33
35
|
serverReports?: ServerReport[];
|
|
34
36
|
/**
|
|
@@ -57,6 +59,54 @@ export interface ExportOptions {
|
|
|
57
59
|
* @defaultValue true
|
|
58
60
|
*/
|
|
59
61
|
isColumnExportable?: (exportableColumnContext: ExportableColumnContext) => boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Function invoked when a Report is run, enabling you to preload the data before it is exported.
|
|
64
|
+
* If the function returns a `ReportData` object, that will be used as the data for the Report;
|
|
65
|
+
* if it returns `TRUE`, the Report will be run as normal, using the data from the grid;
|
|
66
|
+
* if it returns `FALSE`, the Report will be cancelled.
|
|
67
|
+
*/
|
|
68
|
+
preProcessExport?: (context: PreProcessExportContext) => boolean | Promise<ReportData | boolean>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Context provided to `ExportOptions.processExport()` callback
|
|
72
|
+
*/
|
|
73
|
+
export interface PreProcessExportContext extends BaseContext {
|
|
74
|
+
/**
|
|
75
|
+
* The report to be exported
|
|
76
|
+
*/
|
|
77
|
+
report: Report;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the columns which would be included in the report based on the `Report.ReportColumnScope`
|
|
80
|
+
* @param includePrimaryKey - whether to include the primary key column (defaults to `false`)
|
|
81
|
+
*/
|
|
82
|
+
getReportColumns: (includePrimaryKey?: boolean) => AdaptableReportColumn[];
|
|
83
|
+
/**
|
|
84
|
+
* Returns the row data which would be included in the report based on the `Report.ReportRowScope`
|
|
85
|
+
* @param reportColumns - the columns to include in the report
|
|
86
|
+
* @param includePrimaryKey - whether to include the primary key column (defaults to `false`)
|
|
87
|
+
*/
|
|
88
|
+
getReportRowData: (reportColumns: AdaptableReportColumn[], includePrimaryKey?: boolean) => Record<string, any>[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Column which is included in a Report
|
|
92
|
+
*/
|
|
93
|
+
export interface AdaptableReportColumn {
|
|
94
|
+
/**
|
|
95
|
+
* ColumnID
|
|
96
|
+
*/
|
|
97
|
+
columnId: string;
|
|
98
|
+
/**
|
|
99
|
+
* Column Header
|
|
100
|
+
*/
|
|
101
|
+
friendlyName: string;
|
|
102
|
+
/**
|
|
103
|
+
* Field name to get the value from the row data (defaults to `columnId`)
|
|
104
|
+
*/
|
|
105
|
+
field?: string;
|
|
106
|
+
/**
|
|
107
|
+
* DataType of the Column
|
|
108
|
+
*/
|
|
109
|
+
dataType: AdaptableColumnDataType;
|
|
60
110
|
}
|
|
61
111
|
/**
|
|
62
112
|
* Format of exported Data - 'rawValue' or 'formattedValue'
|
|
@@ -137,5 +187,5 @@ export interface ExportableColumnContext extends BaseContext {
|
|
|
137
187
|
/**
|
|
138
188
|
* Column to be exported
|
|
139
189
|
*/
|
|
140
|
-
adaptableColumn:
|
|
190
|
+
adaptableColumn: AdaptableReportColumn;
|
|
141
191
|
}
|
package/src/Api/GridApi.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { CellHighlightInfo } from '../PredefinedConfig/Common/CellHighlightInfo'
|
|
|
9
9
|
import { RowHighlightInfo } from '../PredefinedConfig/Common/RowHighlightInfo';
|
|
10
10
|
import { AdaptableModule } from '../PredefinedConfig/Common/Types';
|
|
11
11
|
import { AccessLevel } from '../PredefinedConfig/Common/Entitlement';
|
|
12
|
-
import { GridOptions, IRowNode } from '@ag-grid-community/core';
|
|
12
|
+
import { GridOptions, IRowNode, RowModelType } from '@ag-grid-community/core';
|
|
13
13
|
import { GridCellRange } from '../PredefinedConfig/Selection/GridCellRange';
|
|
14
14
|
import { RowsHighlightInfo } from '../PredefinedConfig/Common/RowsHighlightInfo';
|
|
15
15
|
/**
|
|
@@ -211,8 +211,12 @@ export interface GridApi {
|
|
|
211
211
|
getFirstDisplayedRowNode(): IRowNode | undefined;
|
|
212
212
|
/**
|
|
213
213
|
* Retrieves all filtered Row Nodes currently in the Grid (i.e. after applying the current filter)
|
|
214
|
+
* @param config - configuration
|
|
214
215
|
*/
|
|
215
|
-
getVisibleRowNodes(
|
|
216
|
+
getVisibleRowNodes(config?: {
|
|
217
|
+
includeGroupRows?: boolean;
|
|
218
|
+
filterFn?: (rowNode: IRowNode) => boolean;
|
|
219
|
+
}): IRowNode[];
|
|
216
220
|
/**
|
|
217
221
|
* Retrieves all Row Nodes currently in the Grid (by default excluding the group rows)
|
|
218
222
|
* @param config - configuration
|
|
@@ -481,6 +485,10 @@ export interface GridApi {
|
|
|
481
485
|
* Opens Settings Panel with Grid Info section selected and visible
|
|
482
486
|
*/
|
|
483
487
|
openGridInfoSettingsPanel(): void;
|
|
488
|
+
/**
|
|
489
|
+
* Returns the current AG Grid Row Model Type
|
|
490
|
+
*/
|
|
491
|
+
getRowModelType(): RowModelType;
|
|
484
492
|
/**
|
|
485
493
|
* TO BE REMOVED
|
|
486
494
|
*/
|
|
@@ -101,4 +101,6 @@ export declare class AdaptableApiImpl implements AdaptableApi {
|
|
|
101
101
|
logSuccess(message: string, ...optionalParams: any[]): void;
|
|
102
102
|
logWarn(message: string, ...optionalParams: any[]): void;
|
|
103
103
|
logError(message: string, ...optionalParams: any[]): void;
|
|
104
|
+
consoleError(message: string, ...optionalParams: any[]): void;
|
|
105
|
+
consoleWarn(message: string, ...optionalParams: any[]): void;
|
|
104
106
|
}
|
|
@@ -161,5 +161,11 @@ class AdaptableApiImpl {
|
|
|
161
161
|
logError(message, ...optionalParams) {
|
|
162
162
|
this.adaptable.logger.error(message, optionalParams);
|
|
163
163
|
}
|
|
164
|
+
consoleError(message, ...optionalParams) {
|
|
165
|
+
this.adaptable.logger.consoleError(message, optionalParams);
|
|
166
|
+
}
|
|
167
|
+
consoleWarn(message, ...optionalParams) {
|
|
168
|
+
this.adaptable.logger.consoleWarn(message, optionalParams);
|
|
169
|
+
}
|
|
164
170
|
}
|
|
165
171
|
exports.AdaptableApiImpl = AdaptableApiImpl;
|
|
@@ -3,11 +3,10 @@ import { ExportState, Report, ReportData, ReportSchedule, SystemReportNames } fr
|
|
|
3
3
|
import { ApiBase } from './ApiBase';
|
|
4
4
|
import { AdaptableForm } from '../../PredefinedConfig/Common/AdaptableForm';
|
|
5
5
|
import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
6
|
-
import { CustomDestination, ExportFormContext, ServerReport } from '../../AdaptableOptions/ExportOptions';
|
|
6
|
+
import { AdaptableReportColumn, CustomDestination, ExportFormContext, ServerReport } from '../../AdaptableOptions/ExportOptions';
|
|
7
7
|
import { ExportDestination } from '../../PredefinedConfig/Common/Enums';
|
|
8
8
|
import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
|
|
9
9
|
import { ExportInternalApi } from '../Internal/ExportInternalApi';
|
|
10
|
-
import { AdaptableColumnBase } from '../../types';
|
|
11
10
|
export declare class ExportApiImpl extends ApiBase implements ExportApi {
|
|
12
11
|
internalApi: ExportInternalApi;
|
|
13
12
|
constructor(adaptable: IAdaptable);
|
|
@@ -43,5 +42,5 @@ export declare class ExportApiImpl extends ApiBase implements ExportApi {
|
|
|
43
42
|
isServerReport(report: Report): boolean;
|
|
44
43
|
runServerReport(serverReportName: string): ReportData | undefined;
|
|
45
44
|
getReportDataForReport(reportName: string): ReportData | undefined;
|
|
46
|
-
isColumnExportable(adaptableColumn:
|
|
45
|
+
isColumnExportable(adaptableColumn: AdaptableReportColumn): boolean;
|
|
47
46
|
}
|
|
@@ -8,7 +8,7 @@ import { ColumnSort } from '../../PredefinedConfig/Common/ColumnSort';
|
|
|
8
8
|
import { DataUpdateConfig } from '../../PredefinedConfig/Common/DataUpdateConfig';
|
|
9
9
|
import { CellHighlightInfo } from '../../PredefinedConfig/Common/CellHighlightInfo';
|
|
10
10
|
import { RowHighlightInfo } from '../../PredefinedConfig/Common/RowHighlightInfo';
|
|
11
|
-
import { GridOptions, IRowNode } from '@ag-grid-community/core';
|
|
11
|
+
import { GridOptions, IRowNode, RowModelType } from '@ag-grid-community/core';
|
|
12
12
|
import { GridCellRange } from '../../PredefinedConfig/Selection/GridCellRange';
|
|
13
13
|
import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
14
14
|
import { AdaptableModule } from '../../PredefinedConfig/Common/Types';
|
|
@@ -70,7 +70,10 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
|
|
|
70
70
|
selectColumns(columnIds: string[]): void;
|
|
71
71
|
getFirstRowNode(): IRowNode;
|
|
72
72
|
getFirstDisplayedRowNode(): IRowNode;
|
|
73
|
-
getVisibleRowNodes(
|
|
73
|
+
getVisibleRowNodes(config?: {
|
|
74
|
+
includeGroupRows?: boolean;
|
|
75
|
+
filterFn?: (rowNode: IRowNode) => boolean;
|
|
76
|
+
}): IRowNode[];
|
|
74
77
|
getAllRowNodes(config?: {
|
|
75
78
|
includeGroupRows?: boolean;
|
|
76
79
|
filterFn?: (rowNode: IRowNode) => boolean;
|
|
@@ -136,4 +139,5 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
|
|
|
136
139
|
getGridContainerElement(): HTMLElement | null;
|
|
137
140
|
showGridInfoPopup(): void;
|
|
138
141
|
openGridInfoSettingsPanel(): void;
|
|
142
|
+
getRowModelType(): RowModelType;
|
|
139
143
|
}
|
|
@@ -262,7 +262,7 @@ class GridApiImpl extends ApiBase_1.ApiBase {
|
|
|
262
262
|
getFirstDisplayedRowNode() {
|
|
263
263
|
return this.adaptable.getFirstDisplayedRowNode();
|
|
264
264
|
}
|
|
265
|
-
getVisibleRowNodes() {
|
|
265
|
+
getVisibleRowNodes(config) {
|
|
266
266
|
return this.adaptable.getVisibleRowNodes();
|
|
267
267
|
}
|
|
268
268
|
getAllRowNodes(config) {
|
|
@@ -515,5 +515,8 @@ class GridApiImpl extends ApiBase_1.ApiBase {
|
|
|
515
515
|
openGridInfoSettingsPanel() {
|
|
516
516
|
this.showModulePopup(ModuleConstants.GridInfoModuleId);
|
|
517
517
|
}
|
|
518
|
+
getRowModelType() {
|
|
519
|
+
return this.adaptable.getRowModelType();
|
|
520
|
+
}
|
|
518
521
|
}
|
|
519
522
|
exports.GridApiImpl = GridApiImpl;
|
|
@@ -258,7 +258,7 @@ class LayoutApiImpl extends ApiBase_1.ApiBase {
|
|
|
258
258
|
ColumnFilters: true,
|
|
259
259
|
ColumnSorts: true,
|
|
260
260
|
};
|
|
261
|
-
if (this.
|
|
261
|
+
if (this.getGridApi().getRowModelType() === 'viewport') {
|
|
262
262
|
layoutSupportedFeatures.RowGroupedColumns = false;
|
|
263
263
|
layoutSupportedFeatures.AggregationColumns = false;
|
|
264
264
|
layoutSupportedFeatures.PivotColumns = false;
|
|
@@ -77,8 +77,14 @@ export declare class AdaptableInternalApi extends ApiBase {
|
|
|
77
77
|
getRowEditService(): IRowEditService;
|
|
78
78
|
getModules(): IModuleCollection;
|
|
79
79
|
getModuleFriendlyName(adaptableModule: AdaptableModule): string;
|
|
80
|
-
forAllRowNodesDo(func: (rowNode: IRowNode) => void
|
|
81
|
-
|
|
80
|
+
forAllRowNodesDo(func: (rowNode: IRowNode) => void, config?: {
|
|
81
|
+
includeGroupRows?: boolean;
|
|
82
|
+
filterFn?: (rowNode: IRowNode) => boolean;
|
|
83
|
+
}): void;
|
|
84
|
+
forAllVisibleRowNodesDo(func: (rowNode: IRowNode) => void, config?: {
|
|
85
|
+
includeGroupRows?: boolean;
|
|
86
|
+
filterFn?: (rowNode: IRowNode) => boolean;
|
|
87
|
+
}): void;
|
|
82
88
|
getLabelForButton(button: AdaptableButton<BaseContext>, context: BaseContext): string | undefined;
|
|
83
89
|
getTooltipForButton(button: AdaptableButton<BaseContext>, context: BaseContext): string | undefined;
|
|
84
90
|
getStyleForButton(button: AdaptableButton<BaseContext>, context: BaseContext): ButtonStyle | undefined;
|
|
@@ -143,11 +143,11 @@ class AdaptableInternalApi extends ApiBase_1.ApiBase {
|
|
|
143
143
|
var _a, _b;
|
|
144
144
|
return ((_b = (_a = this.adaptable.ModuleService.getModuleInfoByModule(adaptableModule)) === null || _a === void 0 ? void 0 : _a.FriendlyName) !== null && _b !== void 0 ? _b : adaptableModule);
|
|
145
145
|
}
|
|
146
|
-
forAllRowNodesDo(func) {
|
|
147
|
-
this.adaptable.forAllRowNodesDo(func);
|
|
146
|
+
forAllRowNodesDo(func, config) {
|
|
147
|
+
this.adaptable.forAllRowNodesDo(func, config);
|
|
148
148
|
}
|
|
149
|
-
forAllVisibleRowNodesDo(func) {
|
|
150
|
-
this.adaptable.forAllVisibleRowNodesDo(func);
|
|
149
|
+
forAllVisibleRowNodesDo(func, config) {
|
|
150
|
+
this.adaptable.forAllVisibleRowNodesDo(func, config);
|
|
151
151
|
}
|
|
152
152
|
getLabelForButton(button, context) {
|
|
153
153
|
if (!button.label) {
|
|
@@ -117,7 +117,7 @@ class LayoutInternalApi extends ApiBase_1.ApiBase {
|
|
|
117
117
|
ColumnFilters: true,
|
|
118
118
|
ColumnSorts: true,
|
|
119
119
|
};
|
|
120
|
-
if (this.
|
|
120
|
+
if (this.getGridApi().getRowModelType() === 'viewport') {
|
|
121
121
|
layoutSupportedFeatures.RowGroupedColumns = false;
|
|
122
122
|
layoutSupportedFeatures.AggregationColumns = false;
|
|
123
123
|
layoutSupportedFeatures.PivotColumns = false;
|
|
@@ -13,7 +13,8 @@ export declare class ExportModule extends AdaptableModuleBase implements IExport
|
|
|
13
13
|
getExplicitlyReferencedColumnIds(report: Report): string[];
|
|
14
14
|
getReferencedNamedQueryNames(report: Report): string[];
|
|
15
15
|
addContextMenuItems(menuContext: ContextMenuContext): AdaptableMenuItem[] | undefined;
|
|
16
|
-
export(report: Report, exportDestination: ExportDestination | string): void
|
|
16
|
+
export(report: Report, exportDestination: ExportDestination | string): Promise<void>;
|
|
17
|
+
private preProcessExport;
|
|
17
18
|
private isCustomDestination;
|
|
18
19
|
private convertReportToJSON;
|
|
19
20
|
private openReportInTablePopup;
|
|
@@ -21,6 +21,7 @@ const ExportSelector_1 = require("../View/Export/ExportSelector");
|
|
|
21
21
|
const SystemRedux_1 = require("../Redux/ActionsReducers/SystemRedux");
|
|
22
22
|
const windowFactory_1 = require("../View/Components/Popups/WindowPopups/windowFactory");
|
|
23
23
|
const Uuid_1 = require("../PredefinedConfig/Uuid");
|
|
24
|
+
const waitForTimeout_1 = require("../Utilities/waitForTimeout");
|
|
24
25
|
class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
25
26
|
constructor(api) {
|
|
26
27
|
super(ModuleConstants.ExportModuleId, ModuleConstants.ExportFriendlyName, 'export-data', 'ExportPopup', 'Export data from the Grid to numerous locations in numerous formatso', api);
|
|
@@ -70,12 +71,46 @@ class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
70
71
|
},
|
|
71
72
|
];
|
|
72
73
|
}
|
|
73
|
-
export(report, exportDestination) {
|
|
74
|
+
async export(report, exportDestination) {
|
|
75
|
+
var _a;
|
|
76
|
+
const cleanupExportProcess = () => {
|
|
77
|
+
this.api.internalApi.dispatchReduxAction((0, SystemRedux_1.SystemVisualExportEnd)());
|
|
78
|
+
this.api.internalApi.hideProgressIndicator();
|
|
79
|
+
};
|
|
74
80
|
if (report.Name === GeneralConstants_1.VISUAL_DATA_REPORT) {
|
|
75
81
|
this.api.internalApi.dispatchReduxAction((0, SystemRedux_1.SystemVisualExportBegin)());
|
|
76
82
|
}
|
|
77
|
-
this.api.internalApi.
|
|
78
|
-
|
|
83
|
+
this.api.internalApi.dispatchReduxAction((0, SystemRedux_1.SystemProgressIndicatorShow)(`${report.Name} Export in progress...`));
|
|
84
|
+
try {
|
|
85
|
+
// waitForTimeout required to give the ProgressIndicator rendering a head-start (see rAF in ProgressIndicator implementation)
|
|
86
|
+
await (0, waitForTimeout_1.waitForTimeout)(16);
|
|
87
|
+
if (report.Name === GeneralConstants_1.VISUAL_DATA_REPORT) {
|
|
88
|
+
this.api.logInfo(`Export ${report.Name} (${exportDestination})`);
|
|
89
|
+
this.api.exportApi.exportVisualDataToExcel();
|
|
90
|
+
// WYSIWYG is fully delegated to the AG Grid excel export, so we don't need to do anything else
|
|
91
|
+
cleanupExportProcess();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const preProcessedExport = await this.preProcessExport(report);
|
|
95
|
+
let reportData;
|
|
96
|
+
if (preProcessedExport === false) {
|
|
97
|
+
this.api.logInfo(`Export ${report.Name} (${exportDestination}) cancelled by preProcessExport()`);
|
|
98
|
+
cleanupExportProcess();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
else if (preProcessedExport === true) {
|
|
102
|
+
this.api.logInfo(`Export ${report.Name} (${exportDestination}) using data from the grid`);
|
|
103
|
+
reportData = this.api.internalApi.getReportService().getReportData(report);
|
|
104
|
+
}
|
|
105
|
+
else if ((preProcessedExport === null || preProcessedExport === void 0 ? void 0 : preProcessedExport.rows) == undefined ||
|
|
106
|
+
(preProcessedExport === null || preProcessedExport === void 0 ? void 0 : preProcessedExport.columns) == undefined) {
|
|
107
|
+
this.api.logWarn(`Export ${report.Name} (${exportDestination}) : preProcessExport() returned an invalid ReportData object, fallback to data from the grid`);
|
|
108
|
+
reportData = this.api.internalApi.getReportService().getReportData(report);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.api.logInfo(`Export ${report.Name} (${exportDestination}) using data from preProcessExport()`);
|
|
112
|
+
reportData = preProcessedExport;
|
|
113
|
+
}
|
|
79
114
|
if (this.isCustomDestination(exportDestination)) {
|
|
80
115
|
const customDestination = (_a = this.api.optionsApi
|
|
81
116
|
.getAdaptableOptions()
|
|
@@ -90,7 +125,8 @@ class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
90
125
|
return new Promise((resolve) => {
|
|
91
126
|
setTimeout(() => {
|
|
92
127
|
const preparedContext = Object.assign(Object.assign({}, context), { report,
|
|
93
|
-
customDestination,
|
|
128
|
+
customDestination,
|
|
129
|
+
reportData });
|
|
94
130
|
resolve(preparedContext);
|
|
95
131
|
}, 20);
|
|
96
132
|
});
|
|
@@ -100,7 +136,7 @@ class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
100
136
|
else if (customDestination) {
|
|
101
137
|
const reportContext = {
|
|
102
138
|
report: report,
|
|
103
|
-
reportData
|
|
139
|
+
reportData,
|
|
104
140
|
adaptableApi: this.api,
|
|
105
141
|
};
|
|
106
142
|
customDestination.onExport(reportContext);
|
|
@@ -109,33 +145,49 @@ class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
109
145
|
else {
|
|
110
146
|
switch (exportDestination) {
|
|
111
147
|
case Enums_1.ExportDestination.Excel:
|
|
112
|
-
|
|
113
|
-
// WYSIWYG is fully delegated to the AG Grid excel export
|
|
114
|
-
this.api.exportApi.exportVisualDataToExcel();
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
this.convertReportToExcel(report);
|
|
118
|
-
}
|
|
148
|
+
this.convertReportToExcel(report, reportData);
|
|
119
149
|
break;
|
|
120
150
|
case Enums_1.ExportDestination.Clipboard:
|
|
121
|
-
this.copyToClipboard(report);
|
|
151
|
+
this.copyToClipboard(report, reportData);
|
|
122
152
|
break;
|
|
123
153
|
case Enums_1.ExportDestination.CSV:
|
|
124
|
-
this.convertReportToCsv(report);
|
|
154
|
+
this.convertReportToCsv(report, reportData);
|
|
125
155
|
break;
|
|
126
156
|
case Enums_1.ExportDestination.JSON:
|
|
127
|
-
this.convertReportToJSON(report);
|
|
157
|
+
this.convertReportToJSON(report, reportData);
|
|
128
158
|
break;
|
|
129
159
|
case Enums_1.ExportDestination.Table:
|
|
130
|
-
this.openReportInTablePopup(report);
|
|
160
|
+
this.openReportInTablePopup(report, reportData);
|
|
131
161
|
break;
|
|
132
162
|
}
|
|
133
163
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
this.api.
|
|
138
|
-
|
|
164
|
+
cleanupExportProcess();
|
|
165
|
+
}
|
|
166
|
+
catch (e) {
|
|
167
|
+
this.api.consoleError(`Error while exporting ${report.Name}}`, e);
|
|
168
|
+
cleanupExportProcess();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async preProcessExport(report) {
|
|
172
|
+
const preProcessExportFn = this.api.optionsApi.getAdaptableOptions().exportOptions.preProcessExport;
|
|
173
|
+
if (preProcessExportFn) {
|
|
174
|
+
this.api.logInfo(`Export ${report.Name} : preProcessExport()`);
|
|
175
|
+
return preProcessExportFn({
|
|
176
|
+
report,
|
|
177
|
+
adaptableApi: this.api,
|
|
178
|
+
getReportColumns: (includePrimaryKey) => {
|
|
179
|
+
return this.api.internalApi
|
|
180
|
+
.getReportService()
|
|
181
|
+
.getReportDataColumns(report, includePrimaryKey);
|
|
182
|
+
},
|
|
183
|
+
getReportRowData: (reportColumns, includePrimaryKey) => {
|
|
184
|
+
return this.api.internalApi
|
|
185
|
+
.getReportService()
|
|
186
|
+
.getReportDataRows(report, reportColumns, includePrimaryKey);
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return true;
|
|
139
191
|
}
|
|
140
192
|
isCustomDestination(exportDestination) {
|
|
141
193
|
if (Object.values(Enums_1.ExportDestination).some((val) => val === exportDestination)) {
|
|
@@ -143,8 +195,7 @@ class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
143
195
|
}
|
|
144
196
|
return this.api.exportApi.isExportDestinationCustom(exportDestination);
|
|
145
197
|
}
|
|
146
|
-
convertReportToJSON(report) {
|
|
147
|
-
const reportData = this.api.internalApi.getReportService().getReportData(report);
|
|
198
|
+
convertReportToJSON(report, reportData) {
|
|
148
199
|
if (this.isEmptyReportData(reportData)) {
|
|
149
200
|
this.showEmptyExportWarning();
|
|
150
201
|
return;
|
|
@@ -153,8 +204,7 @@ class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
153
204
|
const jsonFileName = this.api.internalApi.getReportService().getReportFileName(report.Name) + '.json';
|
|
154
205
|
Helper_1.Helper.createDownloadedFile(jsonContent, jsonFileName, 'application/json');
|
|
155
206
|
}
|
|
156
|
-
openReportInTablePopup(report) {
|
|
157
|
-
const reportData = this.api.internalApi.getReportService().getReportData(report, true);
|
|
207
|
+
openReportInTablePopup(report, reportData) {
|
|
158
208
|
if (this.isEmptyReportData(reportData)) {
|
|
159
209
|
this.showEmptyExportWarning();
|
|
160
210
|
return;
|
|
@@ -191,7 +241,7 @@ class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
191
241
|
popupProps,
|
|
192
242
|
});
|
|
193
243
|
}
|
|
194
|
-
convertReportToCsv(report) {
|
|
244
|
+
convertReportToCsv(report, reportData) {
|
|
195
245
|
const csvContent = this.createCSVContent(report);
|
|
196
246
|
if (StringExtensions_1.default.IsNullOrEmpty(csvContent)) {
|
|
197
247
|
this.showEmptyExportWarning();
|
|
@@ -200,15 +250,14 @@ class ExportModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
200
250
|
const csvFileName = this.api.internalApi.getReportService().getReportFileName(report.Name) + '.csv';
|
|
201
251
|
Helper_1.Helper.createDownloadedFile(csvContent, csvFileName, 'text/csv;encoding:utf-8');
|
|
202
252
|
}
|
|
203
|
-
convertReportToExcel(report) {
|
|
204
|
-
const reportData = this.api.internalApi.getReportService().getReportData(report);
|
|
253
|
+
convertReportToExcel(report, reportData) {
|
|
205
254
|
if (this.isEmptyReportData(reportData)) {
|
|
206
255
|
this.showEmptyExportWarning();
|
|
207
256
|
return;
|
|
208
257
|
}
|
|
209
258
|
this.api.exportApi.exportDataToExcel(reportData, this.api.internalApi.getReportService().getReportFileName(report.Name));
|
|
210
259
|
}
|
|
211
|
-
copyToClipboard(report) {
|
|
260
|
+
copyToClipboard(report, reportData) {
|
|
212
261
|
const csvContent = this.createTabularContent(report);
|
|
213
262
|
if (StringExtensions_1.default.IsNullOrEmpty(csvContent)) {
|
|
214
263
|
this.showEmptyExportWarning();
|
|
@@ -65,7 +65,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
65
65
|
* logic where layout is applied, it is easier and
|
|
66
66
|
* less error prone to just remove it.
|
|
67
67
|
*/
|
|
68
|
-
if (this.api.
|
|
68
|
+
if (this.api.gridApi.getRowModelType() === 'viewport') {
|
|
69
69
|
this.api.layoutApi.getLayouts().forEach(this.clearUnsuportedFeaturesFromLayout);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Report, ReportData, SystemReportName } from '../../../PredefinedConfig/ExportState';
|
|
2
|
-
import { AdaptableColumn } from '../../../PredefinedConfig/Common/AdaptableColumn';
|
|
2
|
+
import { AdaptableColumn, AdaptableColumnBase } from '../../../PredefinedConfig/Common/AdaptableColumn';
|
|
3
3
|
import { IAdaptableService } from './IAdaptableService';
|
|
4
4
|
import { ExcelStyle, IRowNode } from '@ag-grid-community/core';
|
|
5
5
|
import { SystemExportDestination } from '../../../types';
|
|
@@ -17,10 +17,12 @@ export interface IReportService extends IAdaptableService {
|
|
|
17
17
|
GetReportColumnScopeShortDescription(report: Report): string[];
|
|
18
18
|
GetReportColumnScopeLongDescription(report: Report): string;
|
|
19
19
|
GetReportExpressionDescription(Report: Report, cols: AdaptableColumn[]): string;
|
|
20
|
-
GetReportColumnsForReport(report: Report): AdaptableColumn[];
|
|
21
20
|
PublishLiveLiveDataChangedEvent(reportDestination: 'OpenFin' | 'ipushpull' | 'Glue42', liveDataChangedTrigger: 'Connected' | 'Disconnected' | 'SnapshotSent' | 'LiveDataStarted' | 'LiveDataStopped' | 'LiveDataUpdated', liveReport?: any): void;
|
|
21
|
+
getReportDataColumns(report: Report, includePrimaryKey?: boolean): AdaptableColumnBase[];
|
|
22
|
+
getReportDataRows(report: Report, columns: AdaptableColumnBase[], includePrimaryKey?: boolean): Record<string, any>[];
|
|
22
23
|
getReportData(report: Report, includePrimaryKey?: boolean): ReportData;
|
|
23
24
|
getReportDataAsArray(report: Report, includePrimaryKey?: boolean): any[][];
|
|
25
|
+
getReportDataColumns(report: Report, includePrimaryKey?: boolean): AdaptableColumnBase[];
|
|
24
26
|
convertReportDataToArray(reportData: ReportData): any[][];
|
|
25
27
|
getCellExportValueFromRowNode(rowNode: IRowNode, columnId: string): any;
|
|
26
28
|
getCellExportValueFromRawValue(rowNode: IRowNode, rawValue: any, columnId: string): any;
|
|
@@ -2,7 +2,7 @@ import { AdaptableColumn } from '../../PredefinedConfig/Common/AdaptableColumn';
|
|
|
2
2
|
import { Report, ReportData, SystemReportName } from '../../PredefinedConfig/ExportState';
|
|
3
3
|
import { IReportService } from './Interface/IReportService';
|
|
4
4
|
import { ExcelStyle, IRowNode } from '@ag-grid-community/core';
|
|
5
|
-
import { SystemExportDestination } from '../../AdaptableOptions/ExportOptions';
|
|
5
|
+
import { AdaptableReportColumn, SystemExportDestination } from '../../AdaptableOptions/ExportOptions';
|
|
6
6
|
import { AdaptableApi } from '../../../types';
|
|
7
7
|
export declare class ReportService implements IReportService {
|
|
8
8
|
private adaptableApi;
|
|
@@ -23,7 +23,8 @@ export declare class ReportService implements IReportService {
|
|
|
23
23
|
GetReportColumnScopeShortDescription(report: Report): string[];
|
|
24
24
|
GetReportColumnScopeLongDescription(report: Report): string;
|
|
25
25
|
GetReportExpressionDescription(report: Report, cols: AdaptableColumn[]): string;
|
|
26
|
-
|
|
26
|
+
getReportDataColumns(report: Report, includePrimaryKey?: boolean): AdaptableReportColumn[];
|
|
27
|
+
getReportDataRows(report: Report, columns: AdaptableReportColumn[], includePrimaryKey?: boolean): Record<string, any>[];
|
|
27
28
|
getReportData(report: Report, includePrimaryKey?: boolean): ReportData;
|
|
28
29
|
getReportDataAsArray(report: Report, includePrimaryKey?: boolean): any[][];
|
|
29
30
|
convertReportDataToArray(reportData: ReportData): any[][];
|