@adaptabletools/adaptable 16.0.3-canary.0 → 16.0.3-canary.2
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 +177 -168
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/Fdc3Options.d.ts +68 -60
- package/src/Api/Fdc3Api.d.ts +14 -14
- package/src/Api/GridApi.d.ts +11 -1
- package/src/Api/Implementation/Fdc3ApiImpl.d.ts +13 -13
- package/src/Api/Implementation/Fdc3ApiImpl.js +2 -4
- package/src/Api/Implementation/GridApiImpl.d.ts +2 -0
- package/src/Api/Implementation/GridApiImpl.js +6 -0
- package/src/Api/Internal/Fdc3InternalApi.d.ts +16 -9
- package/src/Api/Internal/Fdc3InternalApi.js +85 -191
- package/src/PredefinedConfig/Common/Fdc3Context.d.ts +14 -6
- package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -2
- package/src/Strategy/Fdc3Module.d.ts +0 -1
- package/src/Strategy/Fdc3Module.js +10 -40
- package/src/Utilities/Services/Fdc3Service.d.ts +1 -0
- package/src/Utilities/Services/Fdc3Service.js +45 -24
- package/src/Utilities/Services/MetamodelService.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +17 -6
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +2 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -2,16 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Fdc3InternalApi = void 0;
|
|
4
4
|
const ApiBase_1 = require("../Implementation/ApiBase");
|
|
5
|
+
const Fdc3Context_1 = require("../../PredefinedConfig/Common/Fdc3Context");
|
|
5
6
|
const fdc3_1 = require("@finos/fdc3");
|
|
6
7
|
const Fdc3Options_1 = require("../../AdaptableOptions/Fdc3Options");
|
|
8
|
+
const Fdc3Intent_1 = require("../../PredefinedConfig/Common/Fdc3Intent");
|
|
7
9
|
const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
|
|
8
10
|
const ActionColumnRenderer_1 = require("../../agGrid/ActionColumnRenderer");
|
|
9
11
|
class Fdc3InternalApi extends ApiBase_1.ApiBase {
|
|
10
12
|
mapRowToContextData(contextType, rowNode) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
if (contextType === fdc3_1.ContextTypes.Nothing) {
|
|
15
|
+
return { type: fdc3_1.ContextTypes.Nothing };
|
|
16
|
+
}
|
|
17
|
+
const mappedContextData = this.mapRowValueToContextData(rowNode, this.isStandardContextType(contextType) && contextType !== fdc3_1.ContextTypes.Nothing
|
|
18
|
+
? (_a = this.getFdc3Options().gridDataContextMapping) === null || _a === void 0 ? void 0 : _a[contextType]
|
|
19
|
+
: (_c = (_b = this.getFdc3Options().gridDataContextMapping) === null || _b === void 0 ? void 0 : _b.custom) === null || _c === void 0 ? void 0 : _c[contextType]);
|
|
20
|
+
const contextMappedFromGridData = Object.assign({ type: contextType }, mappedContextData);
|
|
15
21
|
const resolveContextDataFn = this.getFdc3Options().resolveContextData;
|
|
16
22
|
if (typeof resolveContextDataFn === 'function') {
|
|
17
23
|
return resolveContextDataFn(Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { contextType,
|
|
@@ -22,27 +28,7 @@ class Fdc3InternalApi extends ApiBase_1.ApiBase {
|
|
|
22
28
|
return contextMappedFromGridData;
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Computes the context based on the given `Fdc3Options.gridDataContextMapping` and the given `IRowNode`.
|
|
27
|
-
*/
|
|
28
|
-
getMappedContextData(contextType, rowNode) {
|
|
29
|
-
var _a, _b, _c;
|
|
30
|
-
if (contextType === fdc3_1.ContextTypes.Nothing) {
|
|
31
|
-
return { type: fdc3_1.ContextTypes.Nothing };
|
|
32
|
-
}
|
|
33
|
-
let contextMapping = (_a = this.getFdc3Options().gridDataContextMapping) === null || _a === void 0 ? void 0 : _a[contextType];
|
|
34
|
-
if (!contextMapping) {
|
|
35
|
-
// check if it's a custom context type
|
|
36
|
-
contextMapping = (_c = (_b = this.getFdc3Options().gridDataContextMapping) === null || _b === void 0 ? void 0 : _b.custom) === null || _c === void 0 ? void 0 : _c[contextType];
|
|
37
|
-
}
|
|
38
|
-
if (!contextMapping) {
|
|
39
|
-
return { type: contextType };
|
|
40
|
-
}
|
|
41
|
-
const mappedData = this.mapRowValueToContextData(rowNode, contextMapping);
|
|
42
|
-
return Object.assign({ type: contextType }, mappedData);
|
|
43
|
-
}
|
|
44
31
|
getFdc3ActionColDefs() {
|
|
45
|
-
var _a, _b, _c, _d;
|
|
46
32
|
const actionColDefs = [];
|
|
47
33
|
if (this.isAtLeastOneActionButtonConfigured()) {
|
|
48
34
|
const actionColumnConfig = this.getFdc3Options().actionColumnDefaultConfiguration;
|
|
@@ -85,40 +71,14 @@ class Fdc3InternalApi extends ApiBase_1.ApiBase {
|
|
|
85
71
|
type: [GeneralConstants_1.AB_SPECIAL_COLUMN, GeneralConstants_1.AB_FDC3_COLUMN, 'abColDefObject'],
|
|
86
72
|
};
|
|
87
73
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const intentConfigs = raiseIntents[intent];
|
|
91
|
-
intentConfigs.forEach((intentConfig) => {
|
|
92
|
-
if (!intentConfig.actionColumn) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const intendActionColumnConfig = intentConfig.actionColumn;
|
|
96
|
-
actionColDefs.push(buildColDef(intendActionColumnConfig));
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
const raiseCustomIntents = ((_b = this.getFdc3Options().customIntents) === null || _b === void 0 ? void 0 : _b.raises) || {};
|
|
100
|
-
Object.keys(raiseCustomIntents).forEach((intent) => {
|
|
101
|
-
const intentConfigs = raiseCustomIntents[intent];
|
|
102
|
-
intentConfigs.forEach((intentConfig) => {
|
|
103
|
-
if (!intentConfig.actionColumn) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const intendActionColumnConfig = intentConfig.actionColumn;
|
|
107
|
-
actionColDefs.push(buildColDef(intendActionColumnConfig));
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
const broadcastContexts = ((_c = this.getFdc3Options().contexts) === null || _c === void 0 ? void 0 : _c.broadcasts) || {};
|
|
111
|
-
Object.keys(broadcastContexts).forEach((contextType) => {
|
|
112
|
-
const contextConfig = broadcastContexts[contextType];
|
|
113
|
-
if (!contextConfig.actionColumn) {
|
|
74
|
+
this.getAllRaiseIntentConfigs().forEach((intentConfig) => {
|
|
75
|
+
if (!intentConfig.actionColumn) {
|
|
114
76
|
return;
|
|
115
77
|
}
|
|
116
|
-
const
|
|
117
|
-
actionColDefs.push(buildColDef(
|
|
78
|
+
const intendActionColumnConfig = intentConfig.actionColumn;
|
|
79
|
+
actionColDefs.push(buildColDef(intendActionColumnConfig));
|
|
118
80
|
});
|
|
119
|
-
|
|
120
|
-
Object.keys(broadcastCustomContexts).forEach((contextType) => {
|
|
121
|
-
const contextConfig = broadcastCustomContexts[contextType];
|
|
81
|
+
this.getAllBroadcastContextConfigs().forEach((contextConfig) => {
|
|
122
82
|
if (!contextConfig.actionColumn) {
|
|
123
83
|
return;
|
|
124
84
|
}
|
|
@@ -130,115 +90,48 @@ class Fdc3InternalApi extends ApiBase_1.ApiBase {
|
|
|
130
90
|
getButtonsForFdc3MainActionColumn() {
|
|
131
91
|
const buttons = [];
|
|
132
92
|
const intentButtonConfigs = this.getIntentConfigsWithActionButtons();
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
intentConfigs.forEach((intentConfig) => {
|
|
136
|
-
if (!intentConfig.actionButton) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
const intendActionButtonConfig = intentConfig.actionButton;
|
|
140
|
-
buttons.push(this.mapFdc3ButtonConfigToAdaptableButton(intendActionButtonConfig, {
|
|
141
|
-
action: 'raiseIntent',
|
|
142
|
-
intent,
|
|
143
|
-
contextType: intentConfig.contextType,
|
|
144
|
-
}));
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
const intentCustomButtonConfigs = this.getCustomIntentConfigsWithActionButtons();
|
|
148
|
-
Object.keys(intentCustomButtonConfigs).forEach((intent) => {
|
|
149
|
-
const intentConfigs = intentCustomButtonConfigs[intent];
|
|
150
|
-
intentConfigs.forEach((intentConfig) => {
|
|
151
|
-
if (!intentConfig.actionButton) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const intendActionButtonConfig = intentConfig.actionButton;
|
|
155
|
-
buttons.push(this.mapFdc3ButtonConfigToAdaptableButton(intendActionButtonConfig, {
|
|
156
|
-
action: 'raiseIntent',
|
|
157
|
-
intent,
|
|
158
|
-
contextType: intentConfig.contextType,
|
|
159
|
-
}));
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
const broadcastButtonConfigs = this.getContextConfigsWithActionButtons();
|
|
163
|
-
Object.keys(broadcastButtonConfigs).forEach((contextType) => {
|
|
164
|
-
const contextConfig = broadcastButtonConfigs[contextType];
|
|
165
|
-
if (!contextConfig.actionButton) {
|
|
93
|
+
intentButtonConfigs.forEach((intentConfig) => {
|
|
94
|
+
if (!intentConfig.actionButton) {
|
|
166
95
|
return;
|
|
167
96
|
}
|
|
168
|
-
const
|
|
169
|
-
buttons.push(this.mapFdc3ButtonConfigToAdaptableButton(
|
|
170
|
-
action: '
|
|
171
|
-
|
|
97
|
+
const intendActionButtonConfig = intentConfig.actionButton;
|
|
98
|
+
buttons.push(this.mapFdc3ButtonConfigToAdaptableButton(intendActionButtonConfig, {
|
|
99
|
+
action: 'raiseIntent',
|
|
100
|
+
intent: intentConfig.intentType,
|
|
101
|
+
contextType: intentConfig.contextType,
|
|
172
102
|
}));
|
|
173
103
|
});
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
const contextConfig = broadcastCustomButtonConfigs[contextType];
|
|
104
|
+
const broadcastButtonConfigs = this.getContextConfigsWithActionButtons();
|
|
105
|
+
broadcastButtonConfigs.forEach((contextConfig) => {
|
|
177
106
|
if (!contextConfig.actionButton) {
|
|
178
107
|
return;
|
|
179
108
|
}
|
|
180
109
|
const contextActionButtonConfig = contextConfig.actionButton;
|
|
181
110
|
buttons.push(this.mapFdc3ButtonConfigToAdaptableButton(contextActionButtonConfig, {
|
|
182
111
|
action: 'broadcastContext',
|
|
183
|
-
contextType,
|
|
112
|
+
contextType: contextConfig.contextType,
|
|
184
113
|
}));
|
|
185
114
|
});
|
|
186
115
|
return buttons;
|
|
187
116
|
}
|
|
188
117
|
getButtonsForFdc3StandaloneActionColumn(columnId) {
|
|
189
|
-
var _a, _b, _c, _d;
|
|
190
118
|
const buttons = [];
|
|
191
|
-
|
|
192
|
-
const intentButtonConfigs = ((_a = this.getFdc3Options().intents) === null || _a === void 0 ? void 0 : _a.raises) || {};
|
|
193
|
-
Object.keys(intentButtonConfigs).forEach((intent) => {
|
|
194
|
-
const intentConfigs = intentButtonConfigs[intent];
|
|
195
|
-
intentConfigs.forEach((intentConfig) => {
|
|
196
|
-
var _a;
|
|
197
|
-
if (((_a = intentConfig.actionColumn) === null || _a === void 0 ? void 0 : _a.columnId) === columnId) {
|
|
198
|
-
buttons.push(this.mapFdc3ButtonConfigToAdaptableButton(intentConfig.actionColumn.button, {
|
|
199
|
-
action: 'raiseIntent',
|
|
200
|
-
intent,
|
|
201
|
-
contextType: intentConfig.contextType,
|
|
202
|
-
}));
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
// standard contexts
|
|
207
|
-
const broadcastButtonConfigs = ((_b = this.getFdc3Options().contexts) === null || _b === void 0 ? void 0 : _b.broadcasts) || {};
|
|
208
|
-
Object.keys(broadcastButtonConfigs).forEach((contextType) => {
|
|
119
|
+
this.getAllRaiseIntentConfigs().forEach((intentConfig) => {
|
|
209
120
|
var _a;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
contextType,
|
|
121
|
+
if (((_a = intentConfig.actionColumn) === null || _a === void 0 ? void 0 : _a.columnId) === columnId) {
|
|
122
|
+
buttons.push(this.mapFdc3ButtonConfigToAdaptableButton(intentConfig.actionColumn.button, {
|
|
123
|
+
action: 'raiseIntent',
|
|
124
|
+
intent: intentConfig.intentType,
|
|
125
|
+
contextType: intentConfig.contextType,
|
|
215
126
|
}));
|
|
216
127
|
}
|
|
217
128
|
});
|
|
218
|
-
|
|
219
|
-
const intentCustomButtonConfigs = ((_c = this.getFdc3Options().customIntents) === null || _c === void 0 ? void 0 : _c.raises) || {};
|
|
220
|
-
Object.keys(intentCustomButtonConfigs).forEach((intent) => {
|
|
221
|
-
const intentConfigs = intentCustomButtonConfigs[intent];
|
|
222
|
-
intentConfigs.forEach((intentConfig) => {
|
|
223
|
-
var _a;
|
|
224
|
-
if (((_a = intentConfig.actionColumn) === null || _a === void 0 ? void 0 : _a.columnId) === columnId) {
|
|
225
|
-
buttons.push(this.mapFdc3ButtonConfigToAdaptableButton(intentConfig.actionColumn.button, {
|
|
226
|
-
action: 'raiseIntent',
|
|
227
|
-
intent,
|
|
228
|
-
contextType: intentConfig.contextType,
|
|
229
|
-
}));
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
// custom contexts
|
|
234
|
-
const broadcastCustomButtonConfigs = ((_d = this.getFdc3Options().customContexts) === null || _d === void 0 ? void 0 : _d.broadcasts) || {};
|
|
235
|
-
Object.keys(broadcastCustomButtonConfigs).forEach((contextType) => {
|
|
129
|
+
this.getAllBroadcastContextConfigs().forEach((contextConfig) => {
|
|
236
130
|
var _a;
|
|
237
|
-
const contextConfig = broadcastCustomButtonConfigs[contextType];
|
|
238
131
|
if (((_a = contextConfig.actionColumn) === null || _a === void 0 ? void 0 : _a.columnId) === columnId) {
|
|
239
132
|
buttons.push(this.mapFdc3ButtonConfigToAdaptableButton(contextConfig.actionColumn.button, {
|
|
240
133
|
action: 'broadcastContext',
|
|
241
|
-
contextType,
|
|
134
|
+
contextType: contextConfig.contextType,
|
|
242
135
|
}));
|
|
243
136
|
}
|
|
244
137
|
});
|
|
@@ -252,68 +145,59 @@ class Fdc3InternalApi extends ApiBase_1.ApiBase {
|
|
|
252
145
|
return types.includes(GeneralConstants_1.AB_FDC3_COLUMN) && !this.isFdc3MainActionColumn(columnId);
|
|
253
146
|
}
|
|
254
147
|
handleIntentResolution(intentResolution, context, raisedIntent, app) {
|
|
255
|
-
var _a, _b
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
148
|
+
var _a, _b;
|
|
149
|
+
const relevantRaiseIntentConfig = this.getAllRaiseIntentConfigs().find((config) => config.intentType === raisedIntent && config.contextType === context.type);
|
|
150
|
+
if (typeof (relevantRaiseIntentConfig === null || relevantRaiseIntentConfig === void 0 ? void 0 : relevantRaiseIntentConfig.handleIntentResolution) === 'function') {
|
|
151
|
+
// call intent specific resolution handler
|
|
152
|
+
relevantRaiseIntentConfig.handleIntentResolution(Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { intentResolution }));
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
// call global resolution handler (if any)
|
|
156
|
+
(_b = (_a = this.getFdc3Options().intents) === null || _a === void 0 ? void 0 : _a.handleIntentResolution) === null || _b === void 0 ? void 0 : _b.call(_a, Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { intentResolution }));
|
|
263
157
|
}
|
|
264
158
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
!!Object.keys(this.getCustomIntentConfigsWithActionButtons()).length ||
|
|
269
|
-
!!Object.keys(this.getCustomContextConfigsWithActionButtons()).length);
|
|
159
|
+
isStandardContextType(contextType) {
|
|
160
|
+
// @ts-ignore
|
|
161
|
+
return Fdc3Context_1.StandardContextTypes.includes(contextType);
|
|
270
162
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const raiseIntents = ((_a = this.getFdc3Options().intents) === null || _a === void 0 ? void 0 : _a.raises) || {};
|
|
275
|
-
Object.keys(raiseIntents).forEach((intent) => {
|
|
276
|
-
const intentConfigs = raiseIntents[intent];
|
|
277
|
-
if (intentConfigs.some((intentConfig) => intentConfig.actionButton)) {
|
|
278
|
-
// @ts-ignore
|
|
279
|
-
result[intent] = raiseIntents[intent];
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
return result;
|
|
163
|
+
isStandardIntentType(intentType) {
|
|
164
|
+
// @ts-ignore
|
|
165
|
+
return Fdc3Intent_1.Fdc3StandardIntents.includes(intentType);
|
|
283
166
|
}
|
|
284
|
-
|
|
167
|
+
getAllRaiseIntentConfigs() {
|
|
285
168
|
var _a;
|
|
286
|
-
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
if (
|
|
291
|
-
|
|
292
|
-
|
|
169
|
+
const result = [];
|
|
170
|
+
const mapConfig = (intentType, intentConfigs) => intentConfigs.map((intentConfig) => (Object.assign(Object.assign({}, intentConfig), { intentType })));
|
|
171
|
+
const raiseIntentConfiguration = ((_a = this.getFdc3Options().intents) === null || _a === void 0 ? void 0 : _a.raises) || {};
|
|
172
|
+
Object.keys(raiseIntentConfiguration).forEach((intentType) => {
|
|
173
|
+
if (intentType === 'custom') {
|
|
174
|
+
const customIntentConfigs = raiseIntentConfiguration[intentType];
|
|
175
|
+
Object.keys(customIntentConfigs).forEach((customIntentType) => {
|
|
176
|
+
result.push(...mapConfig(customIntentType, customIntentConfigs[customIntentType]));
|
|
177
|
+
});
|
|
293
178
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
getContextConfigsWithActionButtons() {
|
|
298
|
-
var _a;
|
|
299
|
-
let result = {};
|
|
300
|
-
const broadcastContexts = ((_a = this.getFdc3Options().contexts) === null || _a === void 0 ? void 0 : _a.broadcasts) || {};
|
|
301
|
-
Object.keys(broadcastContexts).forEach((contextType) => {
|
|
302
|
-
const contextConfig = broadcastContexts[contextType];
|
|
303
|
-
if (contextConfig.actionButton) {
|
|
304
|
-
result[contextType] = contextConfig;
|
|
179
|
+
else {
|
|
180
|
+
const intentConfigs = raiseIntentConfiguration[intentType];
|
|
181
|
+
result.push(...mapConfig(intentType, intentConfigs));
|
|
305
182
|
}
|
|
306
183
|
});
|
|
307
184
|
return result;
|
|
308
185
|
}
|
|
309
|
-
|
|
186
|
+
getAllBroadcastContextConfigs() {
|
|
310
187
|
var _a;
|
|
311
|
-
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if (
|
|
316
|
-
|
|
188
|
+
const result = [];
|
|
189
|
+
const mapConfig = (contextType, contextConfig) => (Object.assign(Object.assign({}, contextConfig), { contextType }));
|
|
190
|
+
const broadcastContextConfiguration = ((_a = this.getFdc3Options().contexts) === null || _a === void 0 ? void 0 : _a.broadcasts) || {};
|
|
191
|
+
Object.keys(broadcastContextConfiguration).forEach((contextType) => {
|
|
192
|
+
if (contextType === 'custom') {
|
|
193
|
+
const customContextConfigs = broadcastContextConfiguration[contextType];
|
|
194
|
+
Object.keys(customContextConfigs).forEach((customContextType) => {
|
|
195
|
+
result.push(mapConfig(customContextType, customContextConfigs[customContextType]));
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
const contextConfigs = broadcastContextConfiguration[contextType];
|
|
200
|
+
result.push(mapConfig(contextType, contextConfigs));
|
|
317
201
|
}
|
|
318
202
|
});
|
|
319
203
|
return result;
|
|
@@ -354,6 +238,16 @@ class Fdc3InternalApi extends ApiBase_1.ApiBase {
|
|
|
354
238
|
};
|
|
355
239
|
return mapContext(contextMapping);
|
|
356
240
|
}
|
|
241
|
+
isAtLeastOneActionButtonConfigured() {
|
|
242
|
+
return (this.getIntentConfigsWithActionButtons().length ||
|
|
243
|
+
this.getContextConfigsWithActionButtons().length);
|
|
244
|
+
}
|
|
245
|
+
getIntentConfigsWithActionButtons() {
|
|
246
|
+
return this.getAllRaiseIntentConfigs().filter((intentConfig) => !!intentConfig.actionButton);
|
|
247
|
+
}
|
|
248
|
+
getContextConfigsWithActionButtons() {
|
|
249
|
+
return this.getAllBroadcastContextConfigs().filter((contextConfig) => !!contextConfig.actionButton);
|
|
250
|
+
}
|
|
357
251
|
mapFdc3ButtonConfigToAdaptableButton(fdc3AdaptableButton, fdcInfo) {
|
|
358
252
|
const buildFdc3Context = (context) => {
|
|
359
253
|
return {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Chart, ChatInitSettings, Contact, ContactList, Context, Country, Currency, Email, Instrument, InstrumentList, Nothing, Organization, Portfolio, Position, TimeRange, Valuation, ContextTypes } from '@finos/fdc3';
|
|
2
2
|
/**
|
|
3
|
-
* FDC3 (2.0) Context Types supported by AdapTable
|
|
3
|
+
* FDC3 (2.0) Standard Context Types supported by AdapTable
|
|
4
4
|
*/
|
|
5
|
-
export declare type
|
|
5
|
+
export declare type Fdc3StandardContextType = ChartContextType | ChatInitSettingsContextType | ContactContextType | ContactListContextType | CountryContextType | CurrencyContextType | EmailContextType | InstrumentContextType | InstrumentListContextType | OrganizationContextType | PortfolioContextType | PositionContextType | TimeRangeContextType | ValuationContextType | NothingContextType;
|
|
6
6
|
export declare type Fdc3CustomContextType = string;
|
|
7
|
+
export declare type Fdc3ContextType = Fdc3StandardContextType | Fdc3CustomContextType;
|
|
7
8
|
export declare const ChartContextKey = "fdc3.chart";
|
|
8
9
|
export declare type ChartContextType = typeof ChartContextKey;
|
|
9
10
|
export declare const ChatInitSettingsContextKey = "fdc3.chat.initSettings";
|
|
@@ -37,9 +38,16 @@ export declare type NothingContextType = typeof NothingContextKey;
|
|
|
37
38
|
/**
|
|
38
39
|
* FDC3 (2.0) Contexts
|
|
39
40
|
*/
|
|
40
|
-
export declare type
|
|
41
|
+
export declare type Fdc3StandardContext = ChartContext | ChatInitSettingsContext | ContactContext | ContactListContext | CountryContext | CurrencyContext | EmailContext | InstrumentContext | InstrumentListContext | OrganizationContext | PortfolioContext | PositionContext | TimeRangeContext | ValuationContext | NothingContext;
|
|
42
|
+
/**
|
|
43
|
+
* FDC3 (2.0) Custom Context
|
|
44
|
+
*/
|
|
41
45
|
export declare type Fdc3CustomContext = Context;
|
|
42
|
-
|
|
46
|
+
/**
|
|
47
|
+
* FDC3 (2.0) Generic Context (Standard or Custom)
|
|
48
|
+
*/
|
|
49
|
+
export declare type Fdc3Context = Fdc3StandardContext | Fdc3CustomContext;
|
|
50
|
+
export declare type TypedFdc3Context<CONTEXT, TYPE extends Fdc3StandardContextType> = CONTEXT & {
|
|
43
51
|
type: TYPE;
|
|
44
52
|
};
|
|
45
53
|
export declare type ChartContext = TypedFdc3Context<Chart, ContextTypes.Chart>;
|
|
@@ -57,5 +65,5 @@ export declare type PositionContext = TypedFdc3Context<Position, ContextTypes.Po
|
|
|
57
65
|
export declare type TimeRangeContext = TypedFdc3Context<TimeRange, ContextTypes.TimeRange>;
|
|
58
66
|
export declare type ValuationContext = TypedFdc3Context<Valuation, ContextTypes.Valuation>;
|
|
59
67
|
export declare type NothingContext = TypedFdc3Context<Nothing, ContextTypes.Nothing>;
|
|
60
|
-
export declare const ContextLabels: Record<
|
|
61
|
-
export declare const StandardContextTypes:
|
|
68
|
+
export declare const ContextLabels: Record<Fdc3StandardContextType, string>;
|
|
69
|
+
export declare const StandardContextTypes: Fdc3StandardContextType[];
|
|
@@ -60,12 +60,16 @@ export declare const Fdc3StandardIntents: ("StartCall" | "StartChat" | "StartEma
|
|
|
60
60
|
/**
|
|
61
61
|
* All FDC3 standard intents
|
|
62
62
|
*/
|
|
63
|
-
export declare type
|
|
63
|
+
export declare type Fdc3StandardIntentType = typeof Fdc3StandardIntents[number];
|
|
64
64
|
/**
|
|
65
65
|
* Custom FDC3 intent
|
|
66
66
|
*/
|
|
67
67
|
export declare type Fdc3CustomIntentType = string;
|
|
68
|
+
/**
|
|
69
|
+
* Generic FDC3 intent (standard or custom)
|
|
70
|
+
*/
|
|
71
|
+
export declare type Fdc3IntentType = Fdc3StandardIntentType | Fdc3CustomIntentType;
|
|
68
72
|
/**
|
|
69
73
|
* Valid context for a given FDC3 intent
|
|
70
74
|
*/
|
|
71
|
-
export declare type CompatibleContext<F extends
|
|
75
|
+
export declare type CompatibleContext<F extends Fdc3StandardIntentType> = typeof Fdc3IntentConfiguration[F]['contexts'][number];
|
|
@@ -7,6 +7,5 @@ export declare class Fdc3Module extends AdaptableModuleBase implements IModule {
|
|
|
7
7
|
addContextMenuItems(menuContext: ContextMenuContext): AdaptableMenuItem[] | undefined;
|
|
8
8
|
private buildRaiseIntentMenuItem;
|
|
9
9
|
private buildBroadcastMenuItem;
|
|
10
|
-
private getFdc3Options;
|
|
11
10
|
private getFdc3Api;
|
|
12
11
|
}
|
|
@@ -9,50 +9,23 @@ class Fdc3Module extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
9
9
|
super(ModuleConstants.Fdc3ModuleId, ModuleConstants.Fdc3FriendlyName, 'fdc3', null, 'The FDC3 Module - handles the FDC3 integration', api);
|
|
10
10
|
}
|
|
11
11
|
addContextMenuItems(menuContext) {
|
|
12
|
-
var _a, _b, _c, _d;
|
|
13
12
|
if (!this.isModuleAvailable()) {
|
|
14
13
|
return;
|
|
15
14
|
}
|
|
16
15
|
const currentColumnId = menuContext.adaptableColumn.columnId;
|
|
17
16
|
const currentRowNode = menuContext.rowNode;
|
|
18
17
|
const contextMenuItems = [];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const configsWithMenuItemsForCurrentColumn = contextConfigs.filter((configElem) => { var _a; return (_a = configElem.contextMenu) === null || _a === void 0 ? void 0 : _a.columnIds.includes(currentColumnId); });
|
|
25
|
-
configsWithMenuItemsForCurrentColumn.forEach((raiseContextConfig) => {
|
|
26
|
-
contextMenuItems.push(this.buildRaiseIntentMenuItem(intent, raiseContextConfig.contextType, currentRowNode));
|
|
27
|
-
});
|
|
18
|
+
this.getFdc3Api()
|
|
19
|
+
.internalApi.getAllRaiseIntentConfigs()
|
|
20
|
+
.filter((raiseIntentConfig) => { var _a; return (_a = raiseIntentConfig.contextMenu) === null || _a === void 0 ? void 0 : _a.columnIds.includes(currentColumnId); })
|
|
21
|
+
.forEach((raiseIntentConfig) => {
|
|
22
|
+
contextMenuItems.push(this.buildRaiseIntentMenuItem(raiseIntentConfig.intentType, raiseIntentConfig.contextType, currentRowNode));
|
|
28
23
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
configsWithMenuItemsForCurrentColumn.forEach((raiseContextConfig) => {
|
|
35
|
-
contextMenuItems.push(this.buildRaiseIntentMenuItem(intent, raiseContextConfig.contextType, currentRowNode));
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
// Broadcast menu items
|
|
39
|
-
// standard contexts
|
|
40
|
-
const broadcastContext = ((_c = this.getFdc3Options().contexts) === null || _c === void 0 ? void 0 : _c.broadcasts) || {};
|
|
41
|
-
Object.keys(broadcastContext).forEach((contextType) => {
|
|
42
|
-
var _a;
|
|
43
|
-
const config = broadcastContext[contextType];
|
|
44
|
-
if ((_a = config === null || config === void 0 ? void 0 : config.contextMenu) === null || _a === void 0 ? void 0 : _a.columnIds.includes(currentColumnId)) {
|
|
45
|
-
contextMenuItems.push(this.buildBroadcastMenuItem(contextType, currentRowNode));
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
// custom contexts
|
|
49
|
-
const broadcastCustomContext = ((_d = this.getFdc3Options().customContexts) === null || _d === void 0 ? void 0 : _d.broadcasts) || {};
|
|
50
|
-
Object.keys(broadcastCustomContext).forEach((contextType) => {
|
|
51
|
-
var _a;
|
|
52
|
-
const config = broadcastCustomContext[contextType];
|
|
53
|
-
if ((_a = config === null || config === void 0 ? void 0 : config.contextMenu) === null || _a === void 0 ? void 0 : _a.columnIds.includes(currentColumnId)) {
|
|
54
|
-
contextMenuItems.push(this.buildBroadcastMenuItem(contextType, currentRowNode));
|
|
55
|
-
}
|
|
24
|
+
this.getFdc3Api()
|
|
25
|
+
.internalApi.getAllBroadcastContextConfigs()
|
|
26
|
+
.filter((broadcastConfig) => { var _a; return (_a = broadcastConfig.contextMenu) === null || _a === void 0 ? void 0 : _a.columnIds.includes(currentColumnId); })
|
|
27
|
+
.forEach((broadcastConfig) => {
|
|
28
|
+
contextMenuItems.push(this.buildBroadcastMenuItem(broadcastConfig.contextType, currentRowNode));
|
|
56
29
|
});
|
|
57
30
|
if (contextMenuItems.length > 1) {
|
|
58
31
|
const groupMenuItem = {
|
|
@@ -92,9 +65,6 @@ class Fdc3Module extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
92
65
|
};
|
|
93
66
|
return menuItem;
|
|
94
67
|
}
|
|
95
|
-
getFdc3Options() {
|
|
96
|
-
return this.api.optionsApi.getFdc3Options();
|
|
97
|
-
}
|
|
98
68
|
getFdc3Api() {
|
|
99
69
|
return this.api.fdc3Api;
|
|
100
70
|
}
|
|
@@ -15,6 +15,7 @@ export declare class Fdc3Service implements IAdaptableService {
|
|
|
15
15
|
raiseIntentForContext(context: Context, app?: AppIdentifier): Promise<IntentResolution>;
|
|
16
16
|
broadcast(context: Context): Promise<void>;
|
|
17
17
|
private logFdc3Event;
|
|
18
|
+
private logFdc3Error;
|
|
18
19
|
private getFdc3Api;
|
|
19
20
|
private getFdc3Options;
|
|
20
21
|
}
|
|
@@ -8,11 +8,9 @@ class Fdc3Service {
|
|
|
8
8
|
this.intentHandlerSubscriptions = [];
|
|
9
9
|
this.loggedAgentError = false;
|
|
10
10
|
this.adaptableApi.eventApi.on('AdaptableReady', () => {
|
|
11
|
-
var _a, _b, _c, _d, _e, _f
|
|
12
|
-
const adaptableHandleIntentFn = this.getFdc3Options().handleIntent;
|
|
13
|
-
const
|
|
14
|
-
const listenForCustomIntents = (_d = (_c = this.getFdc3Options().customIntents) === null || _c === void 0 ? void 0 : _c.listensFor) !== null && _d !== void 0 ? _d : [];
|
|
15
|
-
const listenForIntents = [...listenForStandardIntents, ...listenForCustomIntents];
|
|
11
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12
|
+
const adaptableHandleIntentFn = (_a = this.getFdc3Options().intents) === null || _a === void 0 ? void 0 : _a.handleIntent;
|
|
13
|
+
const listenForIntents = (_c = (_b = this.getFdc3Options().intents) === null || _b === void 0 ? void 0 : _b.listensFor) !== null && _c !== void 0 ? _c : [];
|
|
16
14
|
if (listenForIntents.length) {
|
|
17
15
|
if (!adaptableHandleIntentFn) {
|
|
18
16
|
this.adaptableApi.logError(`Following FDC3 Intent Listener(s) have been provided but no 'handleIntent' function has been supplied in the FDC3 Options`, listenForIntents);
|
|
@@ -28,10 +26,8 @@ class Fdc3Service {
|
|
|
28
26
|
}).then((listener) => this.intentHandlerSubscriptions.push(listener));
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
|
-
const adaptableHandleContextFn = this.getFdc3Options().handleContext;
|
|
32
|
-
const
|
|
33
|
-
const listenForCustomContexts = (_h = (_g = this.getFdc3Options().customContexts) === null || _g === void 0 ? void 0 : _g.listensFor) !== null && _h !== void 0 ? _h : [];
|
|
34
|
-
const listenForContexts = [...listenForStandardContexts, ...listenForCustomContexts];
|
|
29
|
+
const adaptableHandleContextFn = (_d = this.getFdc3Options().contexts) === null || _d === void 0 ? void 0 : _d.handleContext;
|
|
30
|
+
const listenForContexts = (_f = (_e = this.getFdc3Options().contexts) === null || _e === void 0 ? void 0 : _e.listensFor) !== null && _f !== void 0 ? _f : [];
|
|
35
31
|
if (listenForContexts === null || listenForContexts === void 0 ? void 0 : listenForContexts.length) {
|
|
36
32
|
if (!adaptableHandleContextFn) {
|
|
37
33
|
this.adaptableApi.logError(`Following FDC3 Context Listener(s) have been provided but no 'handleContext' function has been supplied in the FDC3 Options`, listenForContexts);
|
|
@@ -60,25 +56,46 @@ class Fdc3Service {
|
|
|
60
56
|
this.intentHandlerSubscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
61
57
|
}
|
|
62
58
|
async raiseIntent(intent, context, app) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
if (!this.getDesktopAgent()) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
this.logFdc3Event('OUT', `raise ${intent}`, JSON.stringify(context));
|
|
64
|
+
const intentResolution = await this.getDesktopAgent().raiseIntent(intent, context, app);
|
|
65
|
+
this.logFdc3Event('IN', `IntentResolution`, intentResolution.intent);
|
|
66
|
+
this.getFdc3Api().internalApi.handleIntentResolution(intentResolution, context, intent, app);
|
|
67
|
+
return intentResolution;
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
this.logFdc3Error(error);
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
73
|
async raiseIntentForContext(context, app) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
if (!this.getDesktopAgent()) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
this.logFdc3Event('OUT', `raise for context`, JSON.stringify(context));
|
|
79
|
+
const intentResolution = await this.getDesktopAgent().raiseIntentForContext(context, app);
|
|
80
|
+
this.logFdc3Event('IN', `IntentResolution`, intentResolution.intent);
|
|
81
|
+
this.getFdc3Api().internalApi.handleIntentResolution(intentResolution, context, null, app);
|
|
82
|
+
return intentResolution;
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
this.logFdc3Error(error);
|
|
86
|
+
}
|
|
77
87
|
}
|
|
78
88
|
broadcast(context) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
if (!this.getDesktopAgent()) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
this.logFdc3Event('OUT', `broadcast`, JSON.stringify(context));
|
|
94
|
+
return this.getDesktopAgent().broadcast(context);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
this.logFdc3Error(error);
|
|
98
|
+
}
|
|
82
99
|
}
|
|
83
100
|
logFdc3Event(type, ...params) {
|
|
84
101
|
if (!this.getFdc3Options().enableLogging) {
|
|
@@ -88,6 +105,10 @@ class Fdc3Service {
|
|
|
88
105
|
.getAdaptableInstance()
|
|
89
106
|
.logger.consoleLog(`FDC3::${type} - `, params.join(' : '));
|
|
90
107
|
}
|
|
108
|
+
logFdc3Error(error) {
|
|
109
|
+
this.adaptableApi.consoleError(`FDC3 error`, error);
|
|
110
|
+
this.adaptableApi.alertApi.showAlertError('FDC3 Error', 'See console for details');
|
|
111
|
+
}
|
|
91
112
|
getFdc3Api() {
|
|
92
113
|
return this.adaptableApi.fdc3Api;
|
|
93
114
|
}
|
|
@@ -53,8 +53,8 @@ class MetamodelService {
|
|
|
53
53
|
validationErrors.push('gridOptions was removed from AdapTable Options in Version 16 and is no longer used');
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
if (optionKey === '_gridOptions') {
|
|
57
|
-
//
|
|
56
|
+
if (optionKey === '_gridOptions' || optionKey === 'fdc3Options') {
|
|
57
|
+
// skip special cases
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
const optionMetamodel = (_a = optionsObjectMetamodel === null || optionsObjectMetamodel === void 0 ? void 0 : optionsObjectMetamodel.props) === null || _a === void 0 ? void 0 : _a.find((metamodelProperty) => metamodelProperty.name === optionKey);
|