@adaptabletools/adaptable 16.0.3-canary.0 → 16.0.3-canary.1
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 +66 -54
- package/src/Api/GridApi.d.ts +11 -1
- 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 +14 -7
- package/src/Api/Internal/Fdc3InternalApi.js +85 -191
- package/src/Strategy/Fdc3Module.d.ts +0 -1
- package/src/Strategy/Fdc3Module.js +10 -40
- package/src/Utilities/Services/Fdc3Service.js +17 -15
- package/src/metamodel/adaptable.metamodel.js +1 -1
- 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
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
148
|
+
var _a;
|
|
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
|
|
156
|
+
(_a = this.getFdc3Options().intents) === null || _a === void 0 ? void 0 : _a.handleIntentResolution(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 {
|
|
@@ -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
|
}
|
|
@@ -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,31 @@ class Fdc3Service {
|
|
|
60
56
|
this.intentHandlerSubscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
61
57
|
}
|
|
62
58
|
async raiseIntent(intent, context, app) {
|
|
63
|
-
|
|
59
|
+
if (!this.getDesktopAgent()) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
64
62
|
this.logFdc3Event('OUT', `raise ${intent}`, JSON.stringify(context));
|
|
65
|
-
const intentResolution = await
|
|
63
|
+
const intentResolution = await this.getDesktopAgent().raiseIntent(intent, context, app);
|
|
66
64
|
this.logFdc3Event('IN', `IntentResolution`, intentResolution.intent);
|
|
67
65
|
this.getFdc3Api().internalApi.handleIntentResolution(intentResolution, context, intent, app);
|
|
68
66
|
return intentResolution;
|
|
69
67
|
}
|
|
70
68
|
async raiseIntentForContext(context, app) {
|
|
71
|
-
|
|
69
|
+
if (!this.getDesktopAgent()) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
72
|
this.logFdc3Event('OUT', `raise for context`, JSON.stringify(context));
|
|
73
|
-
const intentResolution = await
|
|
73
|
+
const intentResolution = await this.getDesktopAgent().raiseIntentForContext(context, app);
|
|
74
74
|
this.logFdc3Event('IN', `IntentResolution`, intentResolution.intent);
|
|
75
75
|
this.getFdc3Api().internalApi.handleIntentResolution(intentResolution, context, null, app);
|
|
76
76
|
return intentResolution;
|
|
77
77
|
}
|
|
78
78
|
broadcast(context) {
|
|
79
|
-
|
|
79
|
+
if (!this.getDesktopAgent()) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
80
82
|
this.logFdc3Event('OUT', `broadcast`, JSON.stringify(context));
|
|
81
|
-
return
|
|
83
|
+
return this.getDesktopAgent().broadcast(context);
|
|
82
84
|
}
|
|
83
85
|
logFdc3Event(type, ...params) {
|
|
84
86
|
if (!this.getFdc3Options().enableLogging) {
|