@adaptabletools/adaptable 20.0.0-canary.5 → 20.0.0-canary.7
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/package.json +1 -1
- package/src/AdaptableOptions/ExportOptions.d.ts +2 -2
- package/src/Api/ExportApi.d.ts +1 -6
- package/src/Api/Fdc3Api.d.ts +5 -3
- package/src/Api/Implementation/ExportApiImpl.d.ts +1 -2
- package/src/Api/Implementation/ExportApiImpl.js +14 -8
- package/src/Api/Implementation/Fdc3ApiImpl.d.ts +3 -3
- package/src/Api/Implementation/Fdc3ApiImpl.js +4 -4
- package/src/Api/Implementation/LayoutHelpers.js +8 -27
- package/src/Api/Internal/ActionColumnInternalApi.js +16 -19
- package/src/Api/Internal/ExportInternalApi.d.ts +1 -5
- package/src/Api/Internal/ExportInternalApi.js +10 -131
- package/src/PredefinedConfig/ExportState.d.ts +0 -13
- package/src/Utilities/Helpers/AdaptableHelper.d.ts +2 -0
- package/src/Utilities/Helpers/AdaptableHelper.js +10 -0
- package/src/Utilities/Services/Fdc3Service.d.ts +2 -2
- package/src/Utilities/Services/Fdc3Service.js +7 -2
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +41 -0
- package/src/agGrid/AdaptableAgGrid.js +4 -0
- package/src/agGrid/AgGridAdapter.js +1 -1
- package/src/agGrid/AgGridColumnAdapter.js +0 -3
- package/src/agGrid/AgGridExportAdapter.d.ts +1 -0
- package/src/agGrid/AgGridExportAdapter.js +4 -2
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "20.0.0-canary.
|
|
3
|
+
"version": "20.0.0-canary.7",
|
|
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",
|
|
@@ -162,9 +162,9 @@ export interface ExternalReport {
|
|
|
162
162
|
*/
|
|
163
163
|
name: string;
|
|
164
164
|
/**
|
|
165
|
-
* Function invoked to return the data (in the form of a `
|
|
165
|
+
* Function invoked to return the data (in the form of a `ExportResultData` object)
|
|
166
166
|
*/
|
|
167
|
-
|
|
167
|
+
onExport: (context: BaseExportContext) => Promise<ExportResultData>;
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
170
|
* Defines a custom Export destination
|
package/src/Api/ExportApi.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AdaptableForm } from '../PredefinedConfig/Common/AdaptableForm';
|
|
2
|
-
import { ExportState, Report,
|
|
2
|
+
import { ExportState, Report, ReportFormatType, ReportNameType, SystemReportFormat, SystemReportName } from '../PredefinedConfig/ExportState';
|
|
3
3
|
import { CustomDestination, ExportDestinationType, ExportFormContext, ExportResultData, ExternalReport, SystemExportDestination } from '../AdaptableOptions/ExportOptions';
|
|
4
4
|
import { AdaptableColumn } from '../types';
|
|
5
5
|
/**
|
|
@@ -139,11 +139,6 @@ export interface ExportApi {
|
|
|
139
139
|
* @param report Report to Check
|
|
140
140
|
*/
|
|
141
141
|
isExternalReport(report: Report): boolean;
|
|
142
|
-
/**
|
|
143
|
-
* Runs the report function of the ExternalReport with the given reportName
|
|
144
|
-
* @param reportName external report name
|
|
145
|
-
*/
|
|
146
|
-
runExternalReport(reportName: string): ReportData | undefined;
|
|
147
142
|
/**
|
|
148
143
|
* Returns whether the given column is exportable
|
|
149
144
|
*/
|
package/src/Api/Fdc3Api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRowNode } from 'ag-grid-enterprise';
|
|
2
|
-
import { AppIdentifier, Context, ContextType, DesktopAgent, Intent, IntentResolution } from '@finos/fdc3';
|
|
2
|
+
import { AppIdentifier, Channel, Context, ContextType, DesktopAgent, Intent, IntentResolution } from '@finos/fdc3';
|
|
3
3
|
/**
|
|
4
4
|
* Provides run-time access to AdapTable's FDC3 functionality
|
|
5
5
|
*/
|
|
@@ -59,14 +59,16 @@ export interface Fdc3Api {
|
|
|
59
59
|
* Broadcasts the given Context from the given Row Node
|
|
60
60
|
* @param rowNode - The Row Node
|
|
61
61
|
* @param contextType - The FDC3 Context Type
|
|
62
|
+
* @param channel - (optional) Channel to broadcast to; if not provided, the Context will be broadcast to whatever User Channel the app is joined to
|
|
62
63
|
*/
|
|
63
|
-
broadcastFromRow(rowNode: IRowNode, contextType: ContextType): Promise<void>;
|
|
64
|
+
broadcastFromRow(rowNode: IRowNode, contextType: ContextType, channel?: Channel): Promise<void>;
|
|
64
65
|
/**
|
|
65
66
|
* Broadcasts the given Context from the given Row Node with the given Primary Key Value
|
|
66
67
|
* @param primaryKeyValue - The Primary Key Value
|
|
67
68
|
* @param contextType - The FDC3 Context Type
|
|
69
|
+
* @param channel - (optional) Channel to broadcast to; if not provided, the Context will be broadcast to whatever User Channel the app is joined to
|
|
68
70
|
*/
|
|
69
|
-
broadcastFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType): Promise<void> | undefined;
|
|
71
|
+
broadcastFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType, channel?: Channel): Promise<void> | undefined;
|
|
70
72
|
/**
|
|
71
73
|
* Checks if the given Context Type is a FDC3 standard Context Type
|
|
72
74
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportApi } from '../ExportApi';
|
|
2
|
-
import { ExportState, Report,
|
|
2
|
+
import { ExportState, Report, ReportFormatType, ReportNameType, SystemReportFormat, SystemReportName } from '../../PredefinedConfig/ExportState';
|
|
3
3
|
import { ApiBase } from './ApiBase';
|
|
4
4
|
import { AdaptableForm } from '../../PredefinedConfig/Common/AdaptableForm';
|
|
5
5
|
import { CustomDestination, ExportDestinationType, ExportFormContext, ExportResultData, ExternalReport, SystemExportDestination } from '../../AdaptableOptions/ExportOptions';
|
|
@@ -36,7 +36,6 @@ export declare class ExportApiImpl extends ApiBase implements ExportApi {
|
|
|
36
36
|
getCustomReports(): Report[];
|
|
37
37
|
getExternalReports(): ExternalReport[];
|
|
38
38
|
isExternalReport(report: Report): boolean;
|
|
39
|
-
runExternalReport(externalReportName: string): ReportData | undefined;
|
|
40
39
|
isColumnExportable(adaptableColumn: AdaptableColumn): boolean;
|
|
41
40
|
getSupportedExportDestinations(reportFormat: ReportFormatType): ExportDestinationType[];
|
|
42
41
|
exportReport(reportName: ReportNameType, format: ReportFormatType, destination?: ExportDestinationType): void;
|
|
@@ -132,14 +132,6 @@ export class ExportApiImpl extends ApiBase {
|
|
|
132
132
|
isExternalReport(report) {
|
|
133
133
|
return this.getExternalReports()?.find((cr) => cr.name == report.Name) != null;
|
|
134
134
|
}
|
|
135
|
-
runExternalReport(externalReportName) {
|
|
136
|
-
const externalReport = this.getExternalReports()?.find((cr) => cr.name == externalReportName);
|
|
137
|
-
if (!externalReport) {
|
|
138
|
-
this.logWarn(`External Report '${externalReportName}' not found!`);
|
|
139
|
-
return undefined;
|
|
140
|
-
}
|
|
141
|
-
return externalReport.onRunReport();
|
|
142
|
-
}
|
|
143
135
|
isColumnExportable(adaptableColumn) {
|
|
144
136
|
const isExportableFn = this.getExportOptions().isColumnExportable;
|
|
145
137
|
if (typeof isExportableFn === 'function') {
|
|
@@ -168,6 +160,20 @@ export class ExportApiImpl extends ApiBase {
|
|
|
168
160
|
exportReport(reportName, format, destination = 'Download') {
|
|
169
161
|
let report = this.getReportByName(reportName);
|
|
170
162
|
if (this.checkItemExists(report, reportName, 'Report')) {
|
|
163
|
+
if (this.isExternalReport(report)) {
|
|
164
|
+
// Handle external report
|
|
165
|
+
this.internalApi
|
|
166
|
+
.getExternalReportData(reportName, format, destination)
|
|
167
|
+
.then((reportData) => {
|
|
168
|
+
if (reportData) {
|
|
169
|
+
this.internalApi.sendReportToDestination(reportData, report, format, destination);
|
|
170
|
+
}
|
|
171
|
+
})
|
|
172
|
+
.catch((error) => {
|
|
173
|
+
this.logWarn(`Failed to get external report data for '${reportName}': ${error}`);
|
|
174
|
+
});
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
171
177
|
this._adaptable.agGridExportAdapter
|
|
172
178
|
.exportData({
|
|
173
179
|
report,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRowNode } from 'ag-grid-enterprise';
|
|
2
|
-
import { Context, ContextType, DesktopAgent, Intent, IntentResolution, StandardContextType, StandardIntent } from '@finos/fdc3';
|
|
2
|
+
import { Channel, Context, ContextType, DesktopAgent, Intent, IntentResolution, StandardContextType, StandardIntent } from '@finos/fdc3';
|
|
3
3
|
import { ApiBase } from './ApiBase';
|
|
4
4
|
import { Fdc3Api } from '../Fdc3Api';
|
|
5
5
|
import { Fdc3InternalApi } from '../Internal/Fdc3InternalApi';
|
|
@@ -15,8 +15,8 @@ export declare class Fdc3ApiImpl extends ApiBase implements Fdc3Api {
|
|
|
15
15
|
raiseIntentFromRow(rowNode: IRowNode, intent: Intent, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution>;
|
|
16
16
|
raiseIntentForContextFromRow(rowNode: IRowNode, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution>;
|
|
17
17
|
raiseIntentForContextFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution> | undefined;
|
|
18
|
-
broadcastFromRow(rowNode: IRowNode, contextType: ContextType): Promise<void>;
|
|
19
|
-
broadcastFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType): Promise<void> | undefined;
|
|
18
|
+
broadcastFromRow(rowNode: IRowNode, contextType: ContextType, channel?: Channel): Promise<void>;
|
|
19
|
+
broadcastFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType, channel?: Channel): Promise<void> | undefined;
|
|
20
20
|
getContextLabel(contextType: ContextType): string;
|
|
21
21
|
isStandardContextType(contextType: string): contextType is StandardContextType;
|
|
22
22
|
isStandardIntentType(intentType: string): intentType is StandardIntent;
|
|
@@ -44,17 +44,17 @@ export class Fdc3ApiImpl extends ApiBase {
|
|
|
44
44
|
}
|
|
45
45
|
return this.raiseIntentForContextFromRow(rowNode, contextType, appIdentifier);
|
|
46
46
|
}
|
|
47
|
-
broadcastFromRow(rowNode, contextType) {
|
|
47
|
+
broadcastFromRow(rowNode, contextType, channel) {
|
|
48
48
|
const contextData = this.buildContextDataFromRow(contextType, rowNode);
|
|
49
|
-
return this.getFdc3Service().broadcast(contextData);
|
|
49
|
+
return this.getFdc3Service().broadcast(contextData, channel);
|
|
50
50
|
}
|
|
51
|
-
broadcastFromPrimaryKey(primaryKeyValue, contextType) {
|
|
51
|
+
broadcastFromPrimaryKey(primaryKeyValue, contextType, channel) {
|
|
52
52
|
const rowNode = this.getGridApi().getRowNodeForPrimaryKey(primaryKeyValue);
|
|
53
53
|
if (!rowNode) {
|
|
54
54
|
this.logWarn(`No row found for primary key value '${primaryKeyValue}'`);
|
|
55
55
|
return undefined;
|
|
56
56
|
}
|
|
57
|
-
return this.broadcastFromRow(rowNode, contextType);
|
|
57
|
+
return this.broadcastFromRow(rowNode, contextType, channel);
|
|
58
58
|
}
|
|
59
59
|
getContextLabel(contextType) {
|
|
60
60
|
return this.isStandardContextType(contextType)
|
|
@@ -3,6 +3,7 @@ import { isPivotLayoutModel } from '../../layout-manager/src/isPivotLayoutModel'
|
|
|
3
3
|
import { normalizeTableLayoutModel, normalizePivotLayoutModel, } from '../../layout-manager/src/normalizeLayoutModel';
|
|
4
4
|
import { simplifyTableLayoutModel, simplifyPivotLayoutModel, } from '../../layout-manager/src/simplifyLayoutModel';
|
|
5
5
|
import { isWeightedAverageAggregation, WEIGHTED_AVERAGE_AGG_FN_NAME, isWeightedAverageAggFuncName, } from '../../PredefinedConfig/Common/AggregationColumns';
|
|
6
|
+
import { removeAdaptableObjectPrimitivesInline } from '../../Utilities/Helpers/AdaptableHelper';
|
|
6
7
|
export const layoutStateToLayoutModel = (layout) => {
|
|
7
8
|
if (isPivotLayout(layout)) {
|
|
8
9
|
return pivotLayoutToPivotLayoutModel(layout);
|
|
@@ -18,44 +19,23 @@ export const layoutModelToLayoutState = (layoutModel, defaults) => {
|
|
|
18
19
|
function cleanupAdaptableObjectPrimitives(layout) {
|
|
19
20
|
if (layout.TableAggregationColumns) {
|
|
20
21
|
layout.TableAggregationColumns.forEach((AggValue) => {
|
|
21
|
-
|
|
22
|
-
delete AggValue.Source;
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
delete AggValue.Uuid;
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
delete AggValue.AdaptableVersion;
|
|
22
|
+
removeAdaptableObjectPrimitivesInline(AggValue);
|
|
27
23
|
if (typeof AggValue.AggFunc === 'object' && AggValue.AggFunc) {
|
|
28
|
-
|
|
29
|
-
delete AggValue.AggFunc.Source;
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
delete AggValue.AggFunc.Uuid;
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
delete AggValue.AggFunc.AdaptableVersion;
|
|
24
|
+
removeAdaptableObjectPrimitivesInline(AggValue.AggFunc);
|
|
34
25
|
}
|
|
35
26
|
});
|
|
36
27
|
}
|
|
37
28
|
if (layout.ColumnHeaders) {
|
|
38
|
-
|
|
39
|
-
delete layout.ColumnHeaders.Uuid;
|
|
40
|
-
delete layout.ColumnHeaders.AdaptableVersion;
|
|
29
|
+
removeAdaptableObjectPrimitivesInline(layout.ColumnHeaders);
|
|
41
30
|
}
|
|
42
31
|
if (layout.ColumnVisibility) {
|
|
43
|
-
|
|
44
|
-
delete layout.ColumnVisibility.Uuid;
|
|
45
|
-
delete layout.ColumnVisibility.AdaptableVersion;
|
|
32
|
+
removeAdaptableObjectPrimitivesInline(layout.ColumnVisibility);
|
|
46
33
|
}
|
|
47
34
|
if (layout.ColumnWidths) {
|
|
48
|
-
|
|
49
|
-
delete layout.ColumnWidths.Uuid;
|
|
50
|
-
delete layout.ColumnWidths.AdaptableVersion;
|
|
35
|
+
removeAdaptableObjectPrimitivesInline(layout.ColumnWidths);
|
|
51
36
|
}
|
|
52
37
|
if (layout.RowGroupValues) {
|
|
53
|
-
|
|
54
|
-
delete layout.RowGroupValues.Source;
|
|
55
|
-
// @ts-ignore
|
|
56
|
-
delete layout.RowGroupValues.Uuid;
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
delete layout.RowGroupValues.AdaptableVersion;
|
|
38
|
+
removeAdaptableObjectPrimitivesInline(layout.RowGroupValues);
|
|
59
39
|
}
|
|
60
40
|
}
|
|
61
41
|
/**
|
|
@@ -258,6 +238,7 @@ export const tableLayoutModelToTableLayout = (layoutModel, defaults) => {
|
|
|
258
238
|
else {
|
|
259
239
|
delete tableLayout.TableAggregationColumns;
|
|
260
240
|
}
|
|
241
|
+
cleanupAdaptableObjectPrimitives(tableLayout);
|
|
261
242
|
return tableLayout;
|
|
262
243
|
};
|
|
263
244
|
function toAggregationColumnValue(columnAggregationModel) {
|
|
@@ -78,13 +78,14 @@ export class ActionColumnInternalApi extends ApiBase {
|
|
|
78
78
|
return { actionButtons, actionColumn };
|
|
79
79
|
}
|
|
80
80
|
updateAllActionColumnButtons(actionButtons) {
|
|
81
|
-
return actionButtons.map((actionButton) =>
|
|
82
|
-
...actionButton
|
|
83
|
-
Uuid
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
return actionButtons.map((actionButton) => {
|
|
82
|
+
actionButton = { ...actionButton };
|
|
83
|
+
actionButton.Uuid = createUuid();
|
|
84
|
+
if (actionButton.command) {
|
|
85
|
+
this.updateActionButtonCommand(actionButton);
|
|
86
|
+
}
|
|
87
|
+
return actionButton;
|
|
88
|
+
});
|
|
88
89
|
}
|
|
89
90
|
updateActionButtonCommand(button) {
|
|
90
91
|
switch (button.command) {
|
|
@@ -93,7 +94,7 @@ export class ActionColumnInternalApi extends ApiBase {
|
|
|
93
94
|
this.getRowFormApi().displayCreateRowForm();
|
|
94
95
|
};
|
|
95
96
|
button.tooltip = button.tooltip ? button.tooltip : 'Create Row';
|
|
96
|
-
button.icon = {
|
|
97
|
+
button.icon = button.icon ?? {
|
|
97
98
|
name: 'add',
|
|
98
99
|
};
|
|
99
100
|
break;
|
|
@@ -102,7 +103,7 @@ export class ActionColumnInternalApi extends ApiBase {
|
|
|
102
103
|
this.getRowFormApi().displayCloneRowForm(context.primaryKeyValue);
|
|
103
104
|
};
|
|
104
105
|
button.tooltip = button.tooltip ? button.tooltip : 'Clone Row';
|
|
105
|
-
button.icon = {
|
|
106
|
+
button.icon = button.icon ?? {
|
|
106
107
|
name: 'clone',
|
|
107
108
|
};
|
|
108
109
|
break;
|
|
@@ -117,22 +118,18 @@ export class ActionColumnInternalApi extends ApiBase {
|
|
|
117
118
|
this.getRowFormOptions().onRowFormSubmit?.(eventInfo);
|
|
118
119
|
};
|
|
119
120
|
button.tooltip = button.tooltip ? button.tooltip : 'Delete Row';
|
|
120
|
-
button.icon = button.icon
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
name: 'delete',
|
|
124
|
-
};
|
|
121
|
+
button.icon = button.icon ?? {
|
|
122
|
+
name: 'delete',
|
|
123
|
+
};
|
|
125
124
|
break;
|
|
126
125
|
case 'edit':
|
|
127
126
|
button.onClick = (button, context) => {
|
|
128
127
|
this.getRowFormApi().displayEditRowForm(context.primaryKeyValue);
|
|
129
128
|
};
|
|
130
129
|
button.tooltip = button.tooltip ? button.tooltip : 'Edit Row';
|
|
131
|
-
button.icon = button.icon
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
name: 'edit',
|
|
135
|
-
};
|
|
130
|
+
button.icon = button.icon ?? {
|
|
131
|
+
name: 'edit',
|
|
132
|
+
};
|
|
136
133
|
break;
|
|
137
134
|
}
|
|
138
135
|
}
|
|
@@ -21,12 +21,7 @@ export declare class ExportInternalApi extends ApiBase {
|
|
|
21
21
|
getReportColumnScopeShortDescription(report: Report): string[];
|
|
22
22
|
getReportColumnScopeLongDescription(report: Report): string;
|
|
23
23
|
getReportExpressionDescription(report: Report, cols: AdaptableColumn[]): string;
|
|
24
|
-
getReportDataColumns(report: Report, includePrimaryKey?: boolean): AdaptableColumn[];
|
|
25
|
-
getReportDataRows(report: Report, columns: AdaptableColumn[], includePrimaryKey?: boolean): Record<string, any>[];
|
|
26
|
-
getReportData(report: Report, includePrimaryKey?: boolean): ReportData;
|
|
27
|
-
getReportDataAsArray(report: Report, includePrimaryKey?: boolean): any[][];
|
|
28
24
|
convertReportDataToArray(reportData: ReportData): any[][];
|
|
29
|
-
getRowObjectForColumnIds(rowNode: IRowNode, columnIds: string[], reportName: string): Record<string, any>;
|
|
30
25
|
publishLiveLiveDataChangedEvent(reportDestination: 'ipushpull' | 'OpenFin', liveDataTrigger: 'Connected' | 'Disconnected' | 'SnapshotSent' | 'LiveDataStarted' | 'LiveDataStopped' | 'LiveDataUpdated', liveReport?: any): void;
|
|
31
26
|
getCellExportValueFromRowNode(rowNode: IRowNode, columnId: string, isVisualReport?: boolean): any;
|
|
32
27
|
getCellExportValueFromRawValue(rowNode: IRowNode, cellRawValue: any, columnId: string, isVisualReport?: boolean): any;
|
|
@@ -36,4 +31,5 @@ export declare class ExportInternalApi extends ApiBase {
|
|
|
36
31
|
sendReportToDestination(reportResult: ExportResultData, report: Report, format: ReportFormatType, destination: ExportDestinationType): void;
|
|
37
32
|
private sendReportToCustomDestination;
|
|
38
33
|
buildBaseExportContext(reportName: ReportNameType, reportFormat: ReportFormatType, exportDestination?: ExportDestinationType): BaseExportContext;
|
|
34
|
+
getExternalReportData(externalReportName: ReportNameType, reportFormat: ReportFormatType, exportDestination: ExportDestinationType): Promise<ExportResultData | undefined>;
|
|
39
35
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import groupBy from 'lodash/groupBy';
|
|
2
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
3
2
|
import { createUuid } from '../../PredefinedConfig/Uuid';
|
|
4
3
|
import { ALL_DATA_REPORT, CURRENT_LAYOUT_REPORT, SELECTED_DATA_REPORT, SYSTEM_EXPORT_DESTINATIONS, SYSTEM_REPORT_NAMES, } from '../../Utilities/Constants/GeneralConstants';
|
|
5
|
-
import { ExportModuleId } from '../../Utilities/Constants/ModuleConstants';
|
|
6
|
-
import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
|
|
7
4
|
import StringExtensions from '../../Utilities/Extensions/StringExtensions';
|
|
8
5
|
import FormatHelper, { DateFormatter } from '../../Utilities/Helpers/FormatHelper';
|
|
9
6
|
import Helper from '../../Utilities/Helpers/Helper';
|
|
10
7
|
import * as PopupRedux from '../../Redux/ActionsReducers/PopupRedux';
|
|
11
8
|
import { SystemExportBegin, SystemExportEnd } from '../../Redux/ActionsReducers/InternalRedux';
|
|
12
|
-
import { errorOnce } from '../../agGrid/AdaptableLogger';
|
|
13
9
|
export class ExportInternalApi extends ApiBase {
|
|
14
10
|
/**
|
|
15
11
|
* Value Items for Report Name Selection
|
|
@@ -211,7 +207,6 @@ export class ExportInternalApi extends ApiBase {
|
|
|
211
207
|
return `[${report.Name}]`;
|
|
212
208
|
}
|
|
213
209
|
else {
|
|
214
|
-
// FIXME AFL: maybe fihnd a better description?
|
|
215
210
|
switch (report.ReportRowScope) {
|
|
216
211
|
case 'AllRows':
|
|
217
212
|
return '[All Rows]';
|
|
@@ -224,138 +219,12 @@ export class ExportInternalApi extends ApiBase {
|
|
|
224
219
|
}
|
|
225
220
|
}
|
|
226
221
|
}
|
|
227
|
-
getReportDataColumns(report, includePrimaryKey = false) {
|
|
228
|
-
let reportColumns = [];
|
|
229
|
-
let gridColumns = this.getAdaptableApi().columnApi.getExportableColumns();
|
|
230
|
-
if (this.getAdaptableApi().exportApi.isExternalReport(report)) {
|
|
231
|
-
return reportColumns;
|
|
232
|
-
}
|
|
233
|
-
// first get the cols depending on the Column Scope
|
|
234
|
-
switch (report.ReportColumnScope) {
|
|
235
|
-
case 'AllColumns':
|
|
236
|
-
reportColumns = gridColumns;
|
|
237
|
-
break;
|
|
238
|
-
case 'VisibleColumns':
|
|
239
|
-
reportColumns = gridColumns.filter((c) => c.visible);
|
|
240
|
-
break;
|
|
241
|
-
case 'SelectedColumns':
|
|
242
|
-
// we extract the selected columns from the grid columns to preserve the grid column order
|
|
243
|
-
const selectedColumnIds = this.getAdaptableApi()
|
|
244
|
-
.gridApi.getSelectedCellInfo()
|
|
245
|
-
.columns.map((column) => column.columnId);
|
|
246
|
-
reportColumns = gridColumns.filter((gridColumn) => selectedColumnIds.includes(gridColumn.columnId));
|
|
247
|
-
break;
|
|
248
|
-
case 'ScopeColumns':
|
|
249
|
-
if ('ColumnIds' in report.Scope) {
|
|
250
|
-
reportColumns = report.Scope.ColumnIds.map((columnId) => this.getAdaptableApi().columnApi.getColumnWithColumnId(columnId)).filter((c) => c);
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
reportColumns = this.getAdaptableApi().columnScopeApi.getColumnsInScope(report.Scope);
|
|
254
|
-
}
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
if (includePrimaryKey) {
|
|
258
|
-
const pkColumn = reportColumns.find((column) => column.columnId === this.getAdaptableApi().optionsApi.getPrimaryKey());
|
|
259
|
-
// TODO simplify after we fix the IsPrimaryKey bug
|
|
260
|
-
// const pkColumn = reportColumns.find(column => column.IsPrimaryKey);
|
|
261
|
-
if (!pkColumn && !!this.getAdaptableApi().columnApi.getPrimaryKeyColumn()) {
|
|
262
|
-
reportColumns.push(this.getAdaptableApi().columnApi.getPrimaryKeyColumn());
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
return reportColumns;
|
|
266
|
-
}
|
|
267
|
-
getReportDataRows(report, columns, includePrimaryKey) {
|
|
268
|
-
if (ArrayExtensions.IsNullOrEmpty(columns)) {
|
|
269
|
-
return [];
|
|
270
|
-
}
|
|
271
|
-
const columnIds = columns.map((column) => column.columnId);
|
|
272
|
-
const resultRowData = [];
|
|
273
|
-
switch (report.ReportRowScope) {
|
|
274
|
-
case 'AllRows':
|
|
275
|
-
this.getAdaptableInternalApi().forAllRowNodesDo((rowNode) => {
|
|
276
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds, report.Name));
|
|
277
|
-
});
|
|
278
|
-
break;
|
|
279
|
-
case 'VisibleRows':
|
|
280
|
-
this.getAdaptableInternalApi().forAllVisibleRowNodesDo((rowNode) => {
|
|
281
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds, report.Name));
|
|
282
|
-
});
|
|
283
|
-
break;
|
|
284
|
-
case 'ExpressionRows':
|
|
285
|
-
this.getAdaptableInternalApi().forAllRowNodesDo((rowNode) => {
|
|
286
|
-
try {
|
|
287
|
-
if (this.getAdaptableApi()
|
|
288
|
-
.internalApi.getQueryLanguageService()
|
|
289
|
-
.evaluateBooleanExpression(report.Query?.BooleanExpression, ExportModuleId, rowNode)) {
|
|
290
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds, report.Name));
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
catch (error) {
|
|
294
|
-
errorOnce(error.message);
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
break;
|
|
298
|
-
case 'SelectedRows':
|
|
299
|
-
// CellSelection
|
|
300
|
-
const selectedCellInfo = this.getAdaptableApi().gridApi.getSelectedCellInfo();
|
|
301
|
-
const { gridCells: GridCells } = selectedCellInfo;
|
|
302
|
-
let selectedCellsByPrimaryKey = groupBy(GridCells, 'primaryKeyValue');
|
|
303
|
-
// we iterate over all visibleRowNodes to preserve the current order
|
|
304
|
-
this.getAdaptableInternalApi().forAllVisibleRowNodesDo((rowNode) => {
|
|
305
|
-
const rowPrimaryKeyValue = this.getAdaptableApi().gridApi.getPrimaryKeyValueForRowNode(rowNode);
|
|
306
|
-
const selectedRowCells = selectedCellsByPrimaryKey[rowPrimaryKeyValue];
|
|
307
|
-
if (selectedRowCells) {
|
|
308
|
-
const selectedRowColumnIds = selectedRowCells.map((rowCell) => rowCell.column.columnId);
|
|
309
|
-
const selectedColumnIds = columnIds.filter((columnId) => selectedRowColumnIds.includes(columnId));
|
|
310
|
-
const row = this.getRowObjectForColumnIds(rowNode, selectedColumnIds, report.Name);
|
|
311
|
-
if (includePrimaryKey) {
|
|
312
|
-
row[this.getAdaptableApi().optionsApi.getPrimaryKey()] = rowPrimaryKeyValue;
|
|
313
|
-
}
|
|
314
|
-
resultRowData.push(row);
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
// Row Selection
|
|
318
|
-
const selectedRowInfo = this.getAdaptableApi().gridApi.getSelectedRowInfo();
|
|
319
|
-
const selectedGridRowPrimaryKeys = selectedRowInfo?.gridRows
|
|
320
|
-
?.filter((gr) => gr.rowInfo.isGroup == false)
|
|
321
|
-
.map((gridRow) => gridRow.primaryKeyValue) ?? [];
|
|
322
|
-
if (selectedGridRowPrimaryKeys.length) {
|
|
323
|
-
this.getAdaptableInternalApi().forAllRowNodesDo((rowNode) => {
|
|
324
|
-
const rowPrimaryKeyValue = this.getAdaptableApi().gridApi.getPrimaryKeyValueForRowNode(rowNode);
|
|
325
|
-
if (selectedGridRowPrimaryKeys.includes(rowPrimaryKeyValue)) {
|
|
326
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds, report.Name));
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
break;
|
|
331
|
-
}
|
|
332
|
-
return resultRowData;
|
|
333
|
-
}
|
|
334
|
-
getReportData(report, includePrimaryKey = false) {
|
|
335
|
-
if (this.getAdaptableApi().exportApi.isExternalReport(report)) {
|
|
336
|
-
return this.getAdaptableApi().exportApi.runExternalReport(report.Name);
|
|
337
|
-
}
|
|
338
|
-
const columns = this.getReportDataColumns(report, includePrimaryKey);
|
|
339
|
-
const rows = this.getReportDataRows(report, columns, includePrimaryKey);
|
|
340
|
-
return { columns, rows };
|
|
341
|
-
}
|
|
342
|
-
getReportDataAsArray(report, includePrimaryKey = false) {
|
|
343
|
-
const reportData = this.getReportData(report, includePrimaryKey);
|
|
344
|
-
return this.convertReportDataToArray(reportData);
|
|
345
|
-
}
|
|
346
222
|
convertReportDataToArray(reportData) {
|
|
347
223
|
return [
|
|
348
224
|
reportData.columns.map((column) => column.friendlyName),
|
|
349
225
|
...reportData.rows.map((row) => reportData.columns.map((column) => row[column.columnId])),
|
|
350
226
|
];
|
|
351
227
|
}
|
|
352
|
-
getRowObjectForColumnIds(rowNode, columnIds, reportName) {
|
|
353
|
-
return columnIds.reduce((result, columnId) => {
|
|
354
|
-
// FIXME AFL if this method remains, 'false' should be replaced with dynamic value
|
|
355
|
-
result[columnId] = this.getCellExportValueFromRowNode(rowNode, columnId, false);
|
|
356
|
-
return result;
|
|
357
|
-
}, {});
|
|
358
|
-
}
|
|
359
228
|
publishLiveLiveDataChangedEvent(reportDestination, liveDataTrigger, liveReport) {
|
|
360
229
|
const liveDataChangedInfo = {
|
|
361
230
|
...this.getAdaptableInternalApi().buildBaseContext(),
|
|
@@ -490,4 +359,14 @@ export class ExportInternalApi extends ApiBase {
|
|
|
490
359
|
exportDestination,
|
|
491
360
|
};
|
|
492
361
|
}
|
|
362
|
+
getExternalReportData(externalReportName, reportFormat, exportDestination) {
|
|
363
|
+
const externalReport = this.getExportApi()
|
|
364
|
+
.getExternalReports()
|
|
365
|
+
?.find((cr) => cr.name == externalReportName);
|
|
366
|
+
if (!externalReport) {
|
|
367
|
+
this.logWarn(`External Report '${externalReportName}' not found!`);
|
|
368
|
+
return undefined;
|
|
369
|
+
}
|
|
370
|
+
return externalReport.onExport(this.buildBaseExportContext(externalReportName, reportFormat, exportDestination));
|
|
371
|
+
}
|
|
493
372
|
}
|
|
@@ -86,19 +86,6 @@ export interface ReportData {
|
|
|
86
86
|
*/
|
|
87
87
|
pivotColumnIds?: string[];
|
|
88
88
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Row Data in the Report
|
|
91
|
-
*/
|
|
92
|
-
export interface ReportRow {
|
|
93
|
-
/**
|
|
94
|
-
* Data for the row
|
|
95
|
-
*/
|
|
96
|
-
data: Record<string, any>;
|
|
97
|
-
/**
|
|
98
|
-
* Optional children rows for grouped data
|
|
99
|
-
*/
|
|
100
|
-
children?: ReportRow[];
|
|
101
|
-
}
|
|
102
89
|
/**
|
|
103
90
|
* System report names provided by AdapTable
|
|
104
91
|
*/
|
|
@@ -4,6 +4,7 @@ import { AccessLevel } from '../../PredefinedConfig/Common/Entitlement';
|
|
|
4
4
|
export declare function initPredefinedConfigWithUuids(predefinedConfig: PredefinedConfig): PredefinedConfig;
|
|
5
5
|
export declare function getAccessLevelForObject(adaptableObject: AdaptableObject, moduleAccessLevel: AccessLevel): AccessLevel;
|
|
6
6
|
export declare function addAdaptableObjectPrimitives<T extends AdaptableObject>(adaptableObject: T): T;
|
|
7
|
+
export declare function removeAdaptableObjectPrimitivesInline(target: any): any;
|
|
7
8
|
export declare function removeAdaptableObjectPrimitives<T extends AdaptableObject>(adaptableObject: T): T;
|
|
8
9
|
export declare function isAdaptableObject(object: unknown): object is AdaptableObject;
|
|
9
10
|
export declare const AdaptableHelper: {
|
|
@@ -11,6 +12,7 @@ export declare const AdaptableHelper: {
|
|
|
11
12
|
getAccessLevelForObject: typeof getAccessLevelForObject;
|
|
12
13
|
addAdaptableObjectPrimitives: typeof addAdaptableObjectPrimitives;
|
|
13
14
|
removeAdaptableObjectPrimitives: typeof removeAdaptableObjectPrimitives;
|
|
15
|
+
removeAdaptableObjectPrimitivesInline: typeof removeAdaptableObjectPrimitivesInline;
|
|
14
16
|
isAdaptableObject: typeof isAdaptableObject;
|
|
15
17
|
};
|
|
16
18
|
export default AdaptableHelper;
|
|
@@ -43,6 +43,15 @@ export function addAdaptableObjectPrimitives(adaptableObject) {
|
|
|
43
43
|
adaptableObject.AdaptableVersion = GET_CURRENT_VERSION();
|
|
44
44
|
return adaptableObject;
|
|
45
45
|
}
|
|
46
|
+
export function removeAdaptableObjectPrimitivesInline(target) {
|
|
47
|
+
if (!target || typeof target !== 'object') {
|
|
48
|
+
return target;
|
|
49
|
+
}
|
|
50
|
+
delete target.Source;
|
|
51
|
+
delete target.Uuid;
|
|
52
|
+
delete target.AdaptableVersion;
|
|
53
|
+
return target;
|
|
54
|
+
}
|
|
46
55
|
export function removeAdaptableObjectPrimitives(adaptableObject) {
|
|
47
56
|
const clonedObject = structuredClone(adaptableObject);
|
|
48
57
|
const sanitiseObject = (object) => {
|
|
@@ -70,6 +79,7 @@ export const AdaptableHelper = {
|
|
|
70
79
|
getAccessLevelForObject,
|
|
71
80
|
addAdaptableObjectPrimitives,
|
|
72
81
|
removeAdaptableObjectPrimitives,
|
|
82
|
+
removeAdaptableObjectPrimitivesInline,
|
|
73
83
|
isAdaptableObject,
|
|
74
84
|
};
|
|
75
85
|
export default AdaptableHelper;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IAdaptableService } from './Interface/IAdaptableService';
|
|
2
2
|
import { AdaptableApi } from '../../Api/AdaptableApi';
|
|
3
3
|
import { Fdc3Options } from '../../AdaptableOptions/Fdc3Options';
|
|
4
|
-
import { AppIdentifier, DesktopAgent, IntentResolution } from '@finos/fdc3';
|
|
4
|
+
import { AppIdentifier, Channel, DesktopAgent, IntentResolution } from '@finos/fdc3';
|
|
5
5
|
import { Context } from '@finos/fdc3/dist/context/ContextTypes';
|
|
6
6
|
export declare class Fdc3Service implements IAdaptableService {
|
|
7
7
|
private adaptableApi;
|
|
@@ -15,7 +15,7 @@ export declare class Fdc3Service implements IAdaptableService {
|
|
|
15
15
|
destroy(): void;
|
|
16
16
|
raiseIntent(intent: string, context: Context, app?: AppIdentifier): Promise<IntentResolution>;
|
|
17
17
|
raiseIntentForContext(context: Context, app?: AppIdentifier): Promise<IntentResolution>;
|
|
18
|
-
broadcast(context: Context): Promise<void>;
|
|
18
|
+
broadcast(context: Context, channel?: Channel): Promise<void>;
|
|
19
19
|
private logFdc3Event;
|
|
20
20
|
private logFdc3Error;
|
|
21
21
|
private getFdc3Api;
|
|
@@ -131,7 +131,7 @@ export class Fdc3Service {
|
|
|
131
131
|
this.logFdc3Error(error);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
broadcast(context) {
|
|
134
|
+
broadcast(context, channel) {
|
|
135
135
|
if (!this.getDesktopAgent()) {
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
@@ -144,7 +144,12 @@ export class Fdc3Service {
|
|
|
144
144
|
context,
|
|
145
145
|
};
|
|
146
146
|
this.adaptableApi.eventApi.emit('Fdc3Message', payload);
|
|
147
|
-
|
|
147
|
+
if (channel) {
|
|
148
|
+
return channel.broadcast(context);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
return this.getDesktopAgent().broadcast(context);
|
|
152
|
+
}
|
|
148
153
|
}
|
|
149
154
|
catch (error) {
|
|
150
155
|
this.logFdc3Error(error);
|
|
@@ -42,6 +42,47 @@ export const ConfigurationWizard = (props) => {
|
|
|
42
42
|
delete newColumn.caption;
|
|
43
43
|
return newColumn;
|
|
44
44
|
});
|
|
45
|
+
const columnDefs = adaptableConfig.gridOptions.columnDefs;
|
|
46
|
+
// handle the layout creation
|
|
47
|
+
let Layouts = newAdaptableOptions.predefinedConfig?.Layout?.Layouts || [];
|
|
48
|
+
const NewLayout = {
|
|
49
|
+
TableColumns: columnDefs.map((col) => col.colId ?? col.field),
|
|
50
|
+
Name: 'Default Layout',
|
|
51
|
+
};
|
|
52
|
+
let currentLayoutName = NewLayout.Name;
|
|
53
|
+
let found = false;
|
|
54
|
+
if (!Layouts.length) {
|
|
55
|
+
// no layouts, make this the only one
|
|
56
|
+
Layouts = [NewLayout];
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
Layouts = Layouts.map((layout) => {
|
|
60
|
+
if (found) {
|
|
61
|
+
return layout;
|
|
62
|
+
}
|
|
63
|
+
if (layout.TableColumns?.length === 0) {
|
|
64
|
+
// when finding the first empty layout
|
|
65
|
+
// set its column to be those of the new layout
|
|
66
|
+
found = true;
|
|
67
|
+
// and grab the name so we can put it in the Layout.CurrentLayout state
|
|
68
|
+
currentLayoutName = layout.Name;
|
|
69
|
+
layout = { ...layout };
|
|
70
|
+
layout.TableColumns = NewLayout.TableColumns;
|
|
71
|
+
}
|
|
72
|
+
return layout;
|
|
73
|
+
});
|
|
74
|
+
if (!found) {
|
|
75
|
+
Layouts.push(NewLayout);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
newAdaptableOptions.predefinedConfig = {
|
|
79
|
+
...newAdaptableOptions.predefinedConfig,
|
|
80
|
+
Layout: {
|
|
81
|
+
...newAdaptableOptions.predefinedConfig.Layout,
|
|
82
|
+
Layouts: Layouts,
|
|
83
|
+
CurrentLayout: currentLayoutName,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
45
86
|
newAdaptableOptions.primaryKey = columnsHandle.current.getPrimaryKey();
|
|
46
87
|
}
|
|
47
88
|
const newAdaptableConfig = {
|