@adaptabletools/adaptable-cjs 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 +12 -1
- 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.cjs.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-cjs",
|
|
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;
|
|
@@ -136,14 +136,6 @@ class ExportApiImpl extends ApiBase_1.ApiBase {
|
|
|
136
136
|
isExternalReport(report) {
|
|
137
137
|
return this.getExternalReports()?.find((cr) => cr.name == report.Name) != null;
|
|
138
138
|
}
|
|
139
|
-
runExternalReport(externalReportName) {
|
|
140
|
-
const externalReport = this.getExternalReports()?.find((cr) => cr.name == externalReportName);
|
|
141
|
-
if (!externalReport) {
|
|
142
|
-
this.logWarn(`External Report '${externalReportName}' not found!`);
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
return externalReport.onRunReport();
|
|
146
|
-
}
|
|
147
139
|
isColumnExportable(adaptableColumn) {
|
|
148
140
|
const isExportableFn = this.getExportOptions().isColumnExportable;
|
|
149
141
|
if (typeof isExportableFn === 'function') {
|
|
@@ -172,6 +164,20 @@ class ExportApiImpl extends ApiBase_1.ApiBase {
|
|
|
172
164
|
exportReport(reportName, format, destination = 'Download') {
|
|
173
165
|
let report = this.getReportByName(reportName);
|
|
174
166
|
if (this.checkItemExists(report, reportName, 'Report')) {
|
|
167
|
+
if (this.isExternalReport(report)) {
|
|
168
|
+
// Handle external report
|
|
169
|
+
this.internalApi
|
|
170
|
+
.getExternalReportData(reportName, format, destination)
|
|
171
|
+
.then((reportData) => {
|
|
172
|
+
if (reportData) {
|
|
173
|
+
this.internalApi.sendReportToDestination(reportData, report, format, destination);
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
.catch((error) => {
|
|
177
|
+
this.logWarn(`Failed to get external report data for '${reportName}': ${error}`);
|
|
178
|
+
});
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
175
181
|
this._adaptable.agGridExportAdapter
|
|
176
182
|
.exportData({
|
|
177
183
|
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;
|
|
@@ -47,17 +47,17 @@ class Fdc3ApiImpl extends ApiBase_1.ApiBase {
|
|
|
47
47
|
}
|
|
48
48
|
return this.raiseIntentForContextFromRow(rowNode, contextType, appIdentifier);
|
|
49
49
|
}
|
|
50
|
-
broadcastFromRow(rowNode, contextType) {
|
|
50
|
+
broadcastFromRow(rowNode, contextType, channel) {
|
|
51
51
|
const contextData = this.buildContextDataFromRow(contextType, rowNode);
|
|
52
|
-
return this.getFdc3Service().broadcast(contextData);
|
|
52
|
+
return this.getFdc3Service().broadcast(contextData, channel);
|
|
53
53
|
}
|
|
54
|
-
broadcastFromPrimaryKey(primaryKeyValue, contextType) {
|
|
54
|
+
broadcastFromPrimaryKey(primaryKeyValue, contextType, channel) {
|
|
55
55
|
const rowNode = this.getGridApi().getRowNodeForPrimaryKey(primaryKeyValue);
|
|
56
56
|
if (!rowNode) {
|
|
57
57
|
this.logWarn(`No row found for primary key value '${primaryKeyValue}'`);
|
|
58
58
|
return undefined;
|
|
59
59
|
}
|
|
60
|
-
return this.broadcastFromRow(rowNode, contextType);
|
|
60
|
+
return this.broadcastFromRow(rowNode, contextType, channel);
|
|
61
61
|
}
|
|
62
62
|
getContextLabel(contextType) {
|
|
63
63
|
return this.isStandardContextType(contextType)
|
|
@@ -7,6 +7,7 @@ const isPivotLayoutModel_1 = require("../../layout-manager/src/isPivotLayoutMode
|
|
|
7
7
|
const normalizeLayoutModel_1 = require("../../layout-manager/src/normalizeLayoutModel");
|
|
8
8
|
const simplifyLayoutModel_1 = require("../../layout-manager/src/simplifyLayoutModel");
|
|
9
9
|
const AggregationColumns_1 = require("../../PredefinedConfig/Common/AggregationColumns");
|
|
10
|
+
const AdaptableHelper_1 = require("../../Utilities/Helpers/AdaptableHelper");
|
|
10
11
|
const layoutStateToLayoutModel = (layout) => {
|
|
11
12
|
if ((0, exports.isPivotLayout)(layout)) {
|
|
12
13
|
return (0, exports.pivotLayoutToPivotLayoutModel)(layout);
|
|
@@ -24,44 +25,23 @@ exports.layoutModelToLayoutState = layoutModelToLayoutState;
|
|
|
24
25
|
function cleanupAdaptableObjectPrimitives(layout) {
|
|
25
26
|
if (layout.TableAggregationColumns) {
|
|
26
27
|
layout.TableAggregationColumns.forEach((AggValue) => {
|
|
27
|
-
|
|
28
|
-
delete AggValue.Source;
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
delete AggValue.Uuid;
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
delete AggValue.AdaptableVersion;
|
|
28
|
+
(0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(AggValue);
|
|
33
29
|
if (typeof AggValue.AggFunc === 'object' && AggValue.AggFunc) {
|
|
34
|
-
|
|
35
|
-
delete AggValue.AggFunc.Source;
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
delete AggValue.AggFunc.Uuid;
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
delete AggValue.AggFunc.AdaptableVersion;
|
|
30
|
+
(0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(AggValue.AggFunc);
|
|
40
31
|
}
|
|
41
32
|
});
|
|
42
33
|
}
|
|
43
34
|
if (layout.ColumnHeaders) {
|
|
44
|
-
|
|
45
|
-
delete layout.ColumnHeaders.Uuid;
|
|
46
|
-
delete layout.ColumnHeaders.AdaptableVersion;
|
|
35
|
+
(0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(layout.ColumnHeaders);
|
|
47
36
|
}
|
|
48
37
|
if (layout.ColumnVisibility) {
|
|
49
|
-
|
|
50
|
-
delete layout.ColumnVisibility.Uuid;
|
|
51
|
-
delete layout.ColumnVisibility.AdaptableVersion;
|
|
38
|
+
(0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(layout.ColumnVisibility);
|
|
52
39
|
}
|
|
53
40
|
if (layout.ColumnWidths) {
|
|
54
|
-
|
|
55
|
-
delete layout.ColumnWidths.Uuid;
|
|
56
|
-
delete layout.ColumnWidths.AdaptableVersion;
|
|
41
|
+
(0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(layout.ColumnWidths);
|
|
57
42
|
}
|
|
58
43
|
if (layout.RowGroupValues) {
|
|
59
|
-
|
|
60
|
-
delete layout.RowGroupValues.Source;
|
|
61
|
-
// @ts-ignore
|
|
62
|
-
delete layout.RowGroupValues.Uuid;
|
|
63
|
-
// @ts-ignore
|
|
64
|
-
delete layout.RowGroupValues.AdaptableVersion;
|
|
44
|
+
(0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(layout.RowGroupValues);
|
|
65
45
|
}
|
|
66
46
|
}
|
|
67
47
|
/**
|
|
@@ -271,6 +251,7 @@ const tableLayoutModelToTableLayout = (layoutModel, defaults) => {
|
|
|
271
251
|
else {
|
|
272
252
|
delete tableLayout.TableAggregationColumns;
|
|
273
253
|
}
|
|
254
|
+
cleanupAdaptableObjectPrimitives(tableLayout);
|
|
274
255
|
return tableLayout;
|
|
275
256
|
};
|
|
276
257
|
exports.tableLayoutModelToTableLayout = tableLayoutModelToTableLayout;
|
|
@@ -81,13 +81,14 @@ class ActionColumnInternalApi extends ApiBase_1.ApiBase {
|
|
|
81
81
|
return { actionButtons, actionColumn };
|
|
82
82
|
}
|
|
83
83
|
updateAllActionColumnButtons(actionButtons) {
|
|
84
|
-
return actionButtons.map((actionButton) =>
|
|
85
|
-
...actionButton
|
|
86
|
-
Uuid
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
return actionButtons.map((actionButton) => {
|
|
85
|
+
actionButton = { ...actionButton };
|
|
86
|
+
actionButton.Uuid = (0, Uuid_1.createUuid)();
|
|
87
|
+
if (actionButton.command) {
|
|
88
|
+
this.updateActionButtonCommand(actionButton);
|
|
89
|
+
}
|
|
90
|
+
return actionButton;
|
|
91
|
+
});
|
|
91
92
|
}
|
|
92
93
|
updateActionButtonCommand(button) {
|
|
93
94
|
switch (button.command) {
|
|
@@ -96,7 +97,7 @@ class ActionColumnInternalApi extends ApiBase_1.ApiBase {
|
|
|
96
97
|
this.getRowFormApi().displayCreateRowForm();
|
|
97
98
|
};
|
|
98
99
|
button.tooltip = button.tooltip ? button.tooltip : 'Create Row';
|
|
99
|
-
button.icon = {
|
|
100
|
+
button.icon = button.icon ?? {
|
|
100
101
|
name: 'add',
|
|
101
102
|
};
|
|
102
103
|
break;
|
|
@@ -105,7 +106,7 @@ class ActionColumnInternalApi extends ApiBase_1.ApiBase {
|
|
|
105
106
|
this.getRowFormApi().displayCloneRowForm(context.primaryKeyValue);
|
|
106
107
|
};
|
|
107
108
|
button.tooltip = button.tooltip ? button.tooltip : 'Clone Row';
|
|
108
|
-
button.icon = {
|
|
109
|
+
button.icon = button.icon ?? {
|
|
109
110
|
name: 'clone',
|
|
110
111
|
};
|
|
111
112
|
break;
|
|
@@ -120,22 +121,18 @@ class ActionColumnInternalApi extends ApiBase_1.ApiBase {
|
|
|
120
121
|
this.getRowFormOptions().onRowFormSubmit?.(eventInfo);
|
|
121
122
|
};
|
|
122
123
|
button.tooltip = button.tooltip ? button.tooltip : 'Delete Row';
|
|
123
|
-
button.icon = button.icon
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
name: 'delete',
|
|
127
|
-
};
|
|
124
|
+
button.icon = button.icon ?? {
|
|
125
|
+
name: 'delete',
|
|
126
|
+
};
|
|
128
127
|
break;
|
|
129
128
|
case 'edit':
|
|
130
129
|
button.onClick = (button, context) => {
|
|
131
130
|
this.getRowFormApi().displayEditRowForm(context.primaryKeyValue);
|
|
132
131
|
};
|
|
133
132
|
button.tooltip = button.tooltip ? button.tooltip : 'Edit Row';
|
|
134
|
-
button.icon = button.icon
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
name: 'edit',
|
|
138
|
-
};
|
|
133
|
+
button.icon = button.icon ?? {
|
|
134
|
+
name: 'edit',
|
|
135
|
+
};
|
|
139
136
|
break;
|
|
140
137
|
}
|
|
141
138
|
}
|
|
@@ -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
|
}
|
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExportInternalApi = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const groupBy_1 = tslib_1.__importDefault(require("lodash/groupBy"));
|
|
6
5
|
const ApiBase_1 = require("../Implementation/ApiBase");
|
|
7
6
|
const Uuid_1 = require("../../PredefinedConfig/Uuid");
|
|
8
7
|
const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
|
|
9
|
-
const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
|
|
10
|
-
const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
|
|
11
8
|
const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
|
|
12
9
|
const FormatHelper_1 = tslib_1.__importStar(require("../../Utilities/Helpers/FormatHelper"));
|
|
13
10
|
const Helper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/Helper"));
|
|
14
11
|
const PopupRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/PopupRedux"));
|
|
15
12
|
const InternalRedux_1 = require("../../Redux/ActionsReducers/InternalRedux");
|
|
16
|
-
const AdaptableLogger_1 = require("../../agGrid/AdaptableLogger");
|
|
17
13
|
class ExportInternalApi extends ApiBase_1.ApiBase {
|
|
18
14
|
/**
|
|
19
15
|
* Value Items for Report Name Selection
|
|
@@ -215,7 +211,6 @@ class ExportInternalApi extends ApiBase_1.ApiBase {
|
|
|
215
211
|
return `[${report.Name}]`;
|
|
216
212
|
}
|
|
217
213
|
else {
|
|
218
|
-
// FIXME AFL: maybe fihnd a better description?
|
|
219
214
|
switch (report.ReportRowScope) {
|
|
220
215
|
case 'AllRows':
|
|
221
216
|
return '[All Rows]';
|
|
@@ -228,138 +223,12 @@ class ExportInternalApi extends ApiBase_1.ApiBase {
|
|
|
228
223
|
}
|
|
229
224
|
}
|
|
230
225
|
}
|
|
231
|
-
getReportDataColumns(report, includePrimaryKey = false) {
|
|
232
|
-
let reportColumns = [];
|
|
233
|
-
let gridColumns = this.getAdaptableApi().columnApi.getExportableColumns();
|
|
234
|
-
if (this.getAdaptableApi().exportApi.isExternalReport(report)) {
|
|
235
|
-
return reportColumns;
|
|
236
|
-
}
|
|
237
|
-
// first get the cols depending on the Column Scope
|
|
238
|
-
switch (report.ReportColumnScope) {
|
|
239
|
-
case 'AllColumns':
|
|
240
|
-
reportColumns = gridColumns;
|
|
241
|
-
break;
|
|
242
|
-
case 'VisibleColumns':
|
|
243
|
-
reportColumns = gridColumns.filter((c) => c.visible);
|
|
244
|
-
break;
|
|
245
|
-
case 'SelectedColumns':
|
|
246
|
-
// we extract the selected columns from the grid columns to preserve the grid column order
|
|
247
|
-
const selectedColumnIds = this.getAdaptableApi()
|
|
248
|
-
.gridApi.getSelectedCellInfo()
|
|
249
|
-
.columns.map((column) => column.columnId);
|
|
250
|
-
reportColumns = gridColumns.filter((gridColumn) => selectedColumnIds.includes(gridColumn.columnId));
|
|
251
|
-
break;
|
|
252
|
-
case 'ScopeColumns':
|
|
253
|
-
if ('ColumnIds' in report.Scope) {
|
|
254
|
-
reportColumns = report.Scope.ColumnIds.map((columnId) => this.getAdaptableApi().columnApi.getColumnWithColumnId(columnId)).filter((c) => c);
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
reportColumns = this.getAdaptableApi().columnScopeApi.getColumnsInScope(report.Scope);
|
|
258
|
-
}
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
if (includePrimaryKey) {
|
|
262
|
-
const pkColumn = reportColumns.find((column) => column.columnId === this.getAdaptableApi().optionsApi.getPrimaryKey());
|
|
263
|
-
// TODO simplify after we fix the IsPrimaryKey bug
|
|
264
|
-
// const pkColumn = reportColumns.find(column => column.IsPrimaryKey);
|
|
265
|
-
if (!pkColumn && !!this.getAdaptableApi().columnApi.getPrimaryKeyColumn()) {
|
|
266
|
-
reportColumns.push(this.getAdaptableApi().columnApi.getPrimaryKeyColumn());
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return reportColumns;
|
|
270
|
-
}
|
|
271
|
-
getReportDataRows(report, columns, includePrimaryKey) {
|
|
272
|
-
if (ArrayExtensions_1.default.IsNullOrEmpty(columns)) {
|
|
273
|
-
return [];
|
|
274
|
-
}
|
|
275
|
-
const columnIds = columns.map((column) => column.columnId);
|
|
276
|
-
const resultRowData = [];
|
|
277
|
-
switch (report.ReportRowScope) {
|
|
278
|
-
case 'AllRows':
|
|
279
|
-
this.getAdaptableInternalApi().forAllRowNodesDo((rowNode) => {
|
|
280
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds, report.Name));
|
|
281
|
-
});
|
|
282
|
-
break;
|
|
283
|
-
case 'VisibleRows':
|
|
284
|
-
this.getAdaptableInternalApi().forAllVisibleRowNodesDo((rowNode) => {
|
|
285
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds, report.Name));
|
|
286
|
-
});
|
|
287
|
-
break;
|
|
288
|
-
case 'ExpressionRows':
|
|
289
|
-
this.getAdaptableInternalApi().forAllRowNodesDo((rowNode) => {
|
|
290
|
-
try {
|
|
291
|
-
if (this.getAdaptableApi()
|
|
292
|
-
.internalApi.getQueryLanguageService()
|
|
293
|
-
.evaluateBooleanExpression(report.Query?.BooleanExpression, ModuleConstants_1.ExportModuleId, rowNode)) {
|
|
294
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds, report.Name));
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
catch (error) {
|
|
298
|
-
(0, AdaptableLogger_1.errorOnce)(error.message);
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
break;
|
|
302
|
-
case 'SelectedRows':
|
|
303
|
-
// CellSelection
|
|
304
|
-
const selectedCellInfo = this.getAdaptableApi().gridApi.getSelectedCellInfo();
|
|
305
|
-
const { gridCells: GridCells } = selectedCellInfo;
|
|
306
|
-
let selectedCellsByPrimaryKey = (0, groupBy_1.default)(GridCells, 'primaryKeyValue');
|
|
307
|
-
// we iterate over all visibleRowNodes to preserve the current order
|
|
308
|
-
this.getAdaptableInternalApi().forAllVisibleRowNodesDo((rowNode) => {
|
|
309
|
-
const rowPrimaryKeyValue = this.getAdaptableApi().gridApi.getPrimaryKeyValueForRowNode(rowNode);
|
|
310
|
-
const selectedRowCells = selectedCellsByPrimaryKey[rowPrimaryKeyValue];
|
|
311
|
-
if (selectedRowCells) {
|
|
312
|
-
const selectedRowColumnIds = selectedRowCells.map((rowCell) => rowCell.column.columnId);
|
|
313
|
-
const selectedColumnIds = columnIds.filter((columnId) => selectedRowColumnIds.includes(columnId));
|
|
314
|
-
const row = this.getRowObjectForColumnIds(rowNode, selectedColumnIds, report.Name);
|
|
315
|
-
if (includePrimaryKey) {
|
|
316
|
-
row[this.getAdaptableApi().optionsApi.getPrimaryKey()] = rowPrimaryKeyValue;
|
|
317
|
-
}
|
|
318
|
-
resultRowData.push(row);
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
// Row Selection
|
|
322
|
-
const selectedRowInfo = this.getAdaptableApi().gridApi.getSelectedRowInfo();
|
|
323
|
-
const selectedGridRowPrimaryKeys = selectedRowInfo?.gridRows
|
|
324
|
-
?.filter((gr) => gr.rowInfo.isGroup == false)
|
|
325
|
-
.map((gridRow) => gridRow.primaryKeyValue) ?? [];
|
|
326
|
-
if (selectedGridRowPrimaryKeys.length) {
|
|
327
|
-
this.getAdaptableInternalApi().forAllRowNodesDo((rowNode) => {
|
|
328
|
-
const rowPrimaryKeyValue = this.getAdaptableApi().gridApi.getPrimaryKeyValueForRowNode(rowNode);
|
|
329
|
-
if (selectedGridRowPrimaryKeys.includes(rowPrimaryKeyValue)) {
|
|
330
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds, report.Name));
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
break;
|
|
335
|
-
}
|
|
336
|
-
return resultRowData;
|
|
337
|
-
}
|
|
338
|
-
getReportData(report, includePrimaryKey = false) {
|
|
339
|
-
if (this.getAdaptableApi().exportApi.isExternalReport(report)) {
|
|
340
|
-
return this.getAdaptableApi().exportApi.runExternalReport(report.Name);
|
|
341
|
-
}
|
|
342
|
-
const columns = this.getReportDataColumns(report, includePrimaryKey);
|
|
343
|
-
const rows = this.getReportDataRows(report, columns, includePrimaryKey);
|
|
344
|
-
return { columns, rows };
|
|
345
|
-
}
|
|
346
|
-
getReportDataAsArray(report, includePrimaryKey = false) {
|
|
347
|
-
const reportData = this.getReportData(report, includePrimaryKey);
|
|
348
|
-
return this.convertReportDataToArray(reportData);
|
|
349
|
-
}
|
|
350
226
|
convertReportDataToArray(reportData) {
|
|
351
227
|
return [
|
|
352
228
|
reportData.columns.map((column) => column.friendlyName),
|
|
353
229
|
...reportData.rows.map((row) => reportData.columns.map((column) => row[column.columnId])),
|
|
354
230
|
];
|
|
355
231
|
}
|
|
356
|
-
getRowObjectForColumnIds(rowNode, columnIds, reportName) {
|
|
357
|
-
return columnIds.reduce((result, columnId) => {
|
|
358
|
-
// FIXME AFL if this method remains, 'false' should be replaced with dynamic value
|
|
359
|
-
result[columnId] = this.getCellExportValueFromRowNode(rowNode, columnId, false);
|
|
360
|
-
return result;
|
|
361
|
-
}, {});
|
|
362
|
-
}
|
|
363
232
|
publishLiveLiveDataChangedEvent(reportDestination, liveDataTrigger, liveReport) {
|
|
364
233
|
const liveDataChangedInfo = {
|
|
365
234
|
...this.getAdaptableInternalApi().buildBaseContext(),
|
|
@@ -494,5 +363,15 @@ class ExportInternalApi extends ApiBase_1.ApiBase {
|
|
|
494
363
|
exportDestination,
|
|
495
364
|
};
|
|
496
365
|
}
|
|
366
|
+
getExternalReportData(externalReportName, reportFormat, exportDestination) {
|
|
367
|
+
const externalReport = this.getExportApi()
|
|
368
|
+
.getExternalReports()
|
|
369
|
+
?.find((cr) => cr.name == externalReportName);
|
|
370
|
+
if (!externalReport) {
|
|
371
|
+
this.logWarn(`External Report '${externalReportName}' not found!`);
|
|
372
|
+
return undefined;
|
|
373
|
+
}
|
|
374
|
+
return externalReport.onExport(this.buildBaseExportContext(externalReportName, reportFormat, exportDestination));
|
|
375
|
+
}
|
|
497
376
|
}
|
|
498
377
|
exports.ExportInternalApi = ExportInternalApi;
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdaptableHelper = exports.isAdaptableObject = exports.removeAdaptableObjectPrimitives = exports.addAdaptableObjectPrimitives = exports.getAccessLevelForObject = exports.initPredefinedConfigWithUuids = void 0;
|
|
3
|
+
exports.AdaptableHelper = exports.isAdaptableObject = exports.removeAdaptableObjectPrimitives = exports.removeAdaptableObjectPrimitivesInline = exports.addAdaptableObjectPrimitives = exports.getAccessLevelForObject = exports.initPredefinedConfigWithUuids = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const cloneDeepWith_1 = tslib_1.__importDefault(require("lodash/cloneDeepWith"));
|
|
6
6
|
const isPlainObject_1 = tslib_1.__importDefault(require("lodash/isPlainObject"));
|
|
@@ -50,6 +50,16 @@ function addAdaptableObjectPrimitives(adaptableObject) {
|
|
|
50
50
|
return adaptableObject;
|
|
51
51
|
}
|
|
52
52
|
exports.addAdaptableObjectPrimitives = addAdaptableObjectPrimitives;
|
|
53
|
+
function removeAdaptableObjectPrimitivesInline(target) {
|
|
54
|
+
if (!target || typeof target !== 'object') {
|
|
55
|
+
return target;
|
|
56
|
+
}
|
|
57
|
+
delete target.Source;
|
|
58
|
+
delete target.Uuid;
|
|
59
|
+
delete target.AdaptableVersion;
|
|
60
|
+
return target;
|
|
61
|
+
}
|
|
62
|
+
exports.removeAdaptableObjectPrimitivesInline = removeAdaptableObjectPrimitivesInline;
|
|
53
63
|
function removeAdaptableObjectPrimitives(adaptableObject) {
|
|
54
64
|
const clonedObject = structuredClone(adaptableObject);
|
|
55
65
|
const sanitiseObject = (object) => {
|
|
@@ -79,6 +89,7 @@ exports.AdaptableHelper = {
|
|
|
79
89
|
getAccessLevelForObject,
|
|
80
90
|
addAdaptableObjectPrimitives,
|
|
81
91
|
removeAdaptableObjectPrimitives,
|
|
92
|
+
removeAdaptableObjectPrimitivesInline,
|
|
82
93
|
isAdaptableObject,
|
|
83
94
|
};
|
|
84
95
|
exports.default = exports.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;
|
|
@@ -134,7 +134,7 @@ class Fdc3Service {
|
|
|
134
134
|
this.logFdc3Error(error);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
broadcast(context) {
|
|
137
|
+
broadcast(context, channel) {
|
|
138
138
|
if (!this.getDesktopAgent()) {
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
@@ -147,7 +147,12 @@ class Fdc3Service {
|
|
|
147
147
|
context,
|
|
148
148
|
};
|
|
149
149
|
this.adaptableApi.eventApi.emit('Fdc3Message', payload);
|
|
150
|
-
|
|
150
|
+
if (channel) {
|
|
151
|
+
return channel.broadcast(context);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
return this.getDesktopAgent().broadcast(context);
|
|
155
|
+
}
|
|
151
156
|
}
|
|
152
157
|
catch (error) {
|
|
153
158
|
this.logFdc3Error(error);
|