@adaptabletools/adaptable-plugin-openfin 16.2.4 → 17.0.0-canary.10
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-plugin-openfin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0-canary.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "http://www.adaptabletools.com/",
|
|
6
6
|
"author": {
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"typings": "src/index.d.ts",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"lodash": "^4.17.15",
|
|
14
|
-
"openfin-fdc3": "^0.2.3",
|
|
15
14
|
"openfin-notifications": "^0.12.6",
|
|
16
15
|
"prop-types": "^15.6.2",
|
|
17
16
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
@@ -20,6 +19,6 @@
|
|
|
20
19
|
"redux": "4.0.5",
|
|
21
20
|
"styled-components": "^4.4.1",
|
|
22
21
|
"tslib": "^2.3.0",
|
|
23
|
-
"@adaptabletools/adaptable": "
|
|
22
|
+
"@adaptabletools/adaptable": "17.0.0-canary.10"
|
|
24
23
|
}
|
|
25
24
|
}
|
|
@@ -145,7 +145,7 @@ class OpenFinModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
145
145
|
if (iOpenFinReport.ReportName !== GeneralConstants_1.ALL_DATA_REPORT) {
|
|
146
146
|
this.removeGridSortChangedListener = this.adaptable._on('SortChanged', resendLiveData);
|
|
147
147
|
// if the grid filters have changed then update any live reports except cell or row selected
|
|
148
|
-
this.removeGridFilteredListener = this.adaptable._on('
|
|
148
|
+
this.removeGridFilteredListener = this.adaptable._on('AdapTableFiltersApplied', resendLiveDataNoSelectionReport);
|
|
149
149
|
}
|
|
150
150
|
// if grid selection has changed and the iOpenFin Live report is 'Selected Cells' or 'Selected Rows' then send updated data
|
|
151
151
|
this.removeSelectionChangedListener = this.api.eventApi.on('SelectionChanged', () => {
|
package/src/OpenFinApiImpl.js
CHANGED
|
@@ -83,16 +83,10 @@ class OpenFinApiImpl extends ApiBase_1.ApiBase {
|
|
|
83
83
|
AlertId: alert.Uuid,
|
|
84
84
|
},
|
|
85
85
|
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// };
|
|
91
|
-
const alertForm = typeof alert.alertDefinition.AlertForm === 'string' ? null : alert.alertDefinition.AlertForm;
|
|
92
|
-
// this.getAdaptableApi().internalApi.getAdaptableFormFromAlertForm(
|
|
93
|
-
// alert.alertDefinition.AlertForm,
|
|
94
|
-
// context
|
|
95
|
-
// );
|
|
86
|
+
const alertForm = typeof alert.alertDefinition.AlertForm === 'string'
|
|
87
|
+
? null
|
|
88
|
+
: alert.alertDefinition.AlertForm ||
|
|
89
|
+
this.getAlertApi().internalApi.getDefaultAlertNotificationForm();
|
|
96
90
|
if (alertForm && (alertForm === null || alertForm === void 0 ? void 0 : alertForm.Buttons)) {
|
|
97
91
|
notification.buttons = alertForm.Buttons.map((button) => {
|
|
98
92
|
const { ButtonStyle: buttonStyle } = button;
|
|
@@ -13,104 +13,6 @@ function isExcelOpenfinLoaded() {
|
|
|
13
13
|
}
|
|
14
14
|
exports.isExcelOpenfinLoaded = isExcelOpenfinLoaded;
|
|
15
15
|
class OpenFinService {
|
|
16
|
-
constructor(adaptable, options) {
|
|
17
|
-
this.adaptable = adaptable;
|
|
18
|
-
this.excelConnected = false;
|
|
19
|
-
this.connectedCallbacks = [];
|
|
20
|
-
this.onWorkbookRemoved = (event) => {
|
|
21
|
-
event.workbook.removeEventListener('workbookActivated', this.onWorkbookActivated);
|
|
22
|
-
const { workbook } = event;
|
|
23
|
-
this.adaptable.logger.info('Workbook closed:' + workbook.name + ', Stopping Openfin Live Excel');
|
|
24
|
-
this.getOpenFinApi().stopLiveData();
|
|
25
|
-
};
|
|
26
|
-
this.onWorkbookSaved = (event) => {
|
|
27
|
-
const NewName = event.workbook.name;
|
|
28
|
-
this.adaptable.logger.info('workbook saved', NewName);
|
|
29
|
-
//saving adds an extension, but the name does not have that
|
|
30
|
-
// however, not adding the extension will not find the workbook when we do getWorkBookByName
|
|
31
|
-
// and will crash the app
|
|
32
|
-
this.workbookName = NewName;
|
|
33
|
-
};
|
|
34
|
-
this.onWorkbookActivated = (event) => {
|
|
35
|
-
this.adaptable.logger.info('Workbook Activated: ' + event.target.name);
|
|
36
|
-
event.target.getWorksheets((ack) => {
|
|
37
|
-
this.adaptable.logger.info('getWorksheets:', ack);
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
this.onWorkbookAdded = (event) => {
|
|
41
|
-
this.adaptable.logger.success('Workbook Added: ' + event.workbook.name);
|
|
42
|
-
let workbook = event.workbook;
|
|
43
|
-
workbook.addEventListener('workbookActivated', this.onWorkbookActivated);
|
|
44
|
-
};
|
|
45
|
-
this.onSheetChanged = (event) => {
|
|
46
|
-
this.emit('sheetchanged', event);
|
|
47
|
-
};
|
|
48
|
-
this.getRowContents = (rowIndex, columnCount) => {
|
|
49
|
-
return new Promise((resolve, reject) => {
|
|
50
|
-
try {
|
|
51
|
-
this.activeWorksheet.getRow('A' + rowIndex, columnCount, (row) => {
|
|
52
|
-
return resolve(row.map((x) => x.value));
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
reject(err);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
this.onExcelConnected = () => {
|
|
61
|
-
this.excelConnected = true;
|
|
62
|
-
this.connectedCallbacks.forEach((fn) => fn());
|
|
63
|
-
this.connectedCallbacks.length = 0;
|
|
64
|
-
this.adaptable.logger.success('Excel Connected');
|
|
65
|
-
fin.desktop.Excel.addEventListener('workbookClosed', this.onWorkbookRemoved);
|
|
66
|
-
fin.desktop.Excel.addEventListener('workbookSaved', this.onWorkbookSaved);
|
|
67
|
-
fin.desktop.Excel.addEventListener('workbookAdded', this.onWorkbookAdded);
|
|
68
|
-
};
|
|
69
|
-
this.onExcelDisconnected = () => {
|
|
70
|
-
this.adaptable.logger.info('Excel Disconnected');
|
|
71
|
-
this.excelConnected = false;
|
|
72
|
-
this.initialisingExcel = null;
|
|
73
|
-
this.workbookName = undefined;
|
|
74
|
-
this.activeWorksheet = null;
|
|
75
|
-
fin.desktop.Excel.removeEventListener('workbookClosed', this.onWorkbookRemoved);
|
|
76
|
-
fin.desktop.Excel.removeEventListener('workbookSaved', this.onWorkbookSaved);
|
|
77
|
-
fin.desktop.Excel.removeEventListener('workbookAdded', this.onWorkbookAdded);
|
|
78
|
-
fin.desktop.ExcelService.removeEventListener('excelConnected', this.onExcelConnected);
|
|
79
|
-
fin.desktop.ExcelService.removeEventListener('excelDisconnected', this.onExcelDisconnected);
|
|
80
|
-
this.adaptable.logger.info('Excel closed stopping all Live Excel');
|
|
81
|
-
this.getOpenFinApi().stopLiveData();
|
|
82
|
-
};
|
|
83
|
-
this.initialisingExcel = null;
|
|
84
|
-
this.waitForExcel = () => {
|
|
85
|
-
let startTime = Date.now();
|
|
86
|
-
const poolForExcel = (callback) => {
|
|
87
|
-
if (Date.now() - startTime > 20000) {
|
|
88
|
-
console.error(`Could not find any Excel instance.`);
|
|
89
|
-
return callback();
|
|
90
|
-
}
|
|
91
|
-
if (!fin.desktop.Excel || !fin.desktop.Excel.getWorkbooks) {
|
|
92
|
-
requestAnimationFrame(() => {
|
|
93
|
-
poolForExcel(callback);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
callback();
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
return new Promise((resolve) => {
|
|
101
|
-
poolForExcel(() => resolve(''));
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
this.on = (eventName, callback) => {
|
|
105
|
-
return this.emitter.on(eventName, callback);
|
|
106
|
-
};
|
|
107
|
-
this.emit = (eventName, data) => {
|
|
108
|
-
return this.emitter.emit(eventName, data);
|
|
109
|
-
};
|
|
110
|
-
this.adaptable = adaptable;
|
|
111
|
-
this.options = options;
|
|
112
|
-
this.emitter = new Emitter_1.default();
|
|
113
|
-
}
|
|
114
16
|
getOpenFinApi() {
|
|
115
17
|
return this.adaptable.api.pluginsApi.getOpenFinPluginApi();
|
|
116
18
|
}
|
|
@@ -247,5 +149,103 @@ class OpenFinService {
|
|
|
247
149
|
});
|
|
248
150
|
return this.initialisingExcel;
|
|
249
151
|
}
|
|
152
|
+
constructor(adaptable, options) {
|
|
153
|
+
this.adaptable = adaptable;
|
|
154
|
+
this.excelConnected = false;
|
|
155
|
+
this.connectedCallbacks = [];
|
|
156
|
+
this.onWorkbookRemoved = (event) => {
|
|
157
|
+
event.workbook.removeEventListener('workbookActivated', this.onWorkbookActivated);
|
|
158
|
+
const { workbook } = event;
|
|
159
|
+
this.adaptable.logger.info('Workbook closed:' + workbook.name + ', Stopping Openfin Live Excel');
|
|
160
|
+
this.getOpenFinApi().stopLiveData();
|
|
161
|
+
};
|
|
162
|
+
this.onWorkbookSaved = (event) => {
|
|
163
|
+
const NewName = event.workbook.name;
|
|
164
|
+
this.adaptable.logger.info('workbook saved', NewName);
|
|
165
|
+
//saving adds an extension, but the name does not have that
|
|
166
|
+
// however, not adding the extension will not find the workbook when we do getWorkBookByName
|
|
167
|
+
// and will crash the app
|
|
168
|
+
this.workbookName = NewName;
|
|
169
|
+
};
|
|
170
|
+
this.onWorkbookActivated = (event) => {
|
|
171
|
+
this.adaptable.logger.info('Workbook Activated: ' + event.target.name);
|
|
172
|
+
event.target.getWorksheets((ack) => {
|
|
173
|
+
this.adaptable.logger.info('getWorksheets:', ack);
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
this.onWorkbookAdded = (event) => {
|
|
177
|
+
this.adaptable.logger.success('Workbook Added: ' + event.workbook.name);
|
|
178
|
+
let workbook = event.workbook;
|
|
179
|
+
workbook.addEventListener('workbookActivated', this.onWorkbookActivated);
|
|
180
|
+
};
|
|
181
|
+
this.onSheetChanged = (event) => {
|
|
182
|
+
this.emit('sheetchanged', event);
|
|
183
|
+
};
|
|
184
|
+
this.getRowContents = (rowIndex, columnCount) => {
|
|
185
|
+
return new Promise((resolve, reject) => {
|
|
186
|
+
try {
|
|
187
|
+
this.activeWorksheet.getRow('A' + rowIndex, columnCount, (row) => {
|
|
188
|
+
return resolve(row.map((x) => x.value));
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
reject(err);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
this.onExcelConnected = () => {
|
|
197
|
+
this.excelConnected = true;
|
|
198
|
+
this.connectedCallbacks.forEach((fn) => fn());
|
|
199
|
+
this.connectedCallbacks.length = 0;
|
|
200
|
+
this.adaptable.logger.success('Excel Connected');
|
|
201
|
+
fin.desktop.Excel.addEventListener('workbookClosed', this.onWorkbookRemoved);
|
|
202
|
+
fin.desktop.Excel.addEventListener('workbookSaved', this.onWorkbookSaved);
|
|
203
|
+
fin.desktop.Excel.addEventListener('workbookAdded', this.onWorkbookAdded);
|
|
204
|
+
};
|
|
205
|
+
this.onExcelDisconnected = () => {
|
|
206
|
+
this.adaptable.logger.info('Excel Disconnected');
|
|
207
|
+
this.excelConnected = false;
|
|
208
|
+
this.initialisingExcel = null;
|
|
209
|
+
this.workbookName = undefined;
|
|
210
|
+
this.activeWorksheet = null;
|
|
211
|
+
fin.desktop.Excel.removeEventListener('workbookClosed', this.onWorkbookRemoved);
|
|
212
|
+
fin.desktop.Excel.removeEventListener('workbookSaved', this.onWorkbookSaved);
|
|
213
|
+
fin.desktop.Excel.removeEventListener('workbookAdded', this.onWorkbookAdded);
|
|
214
|
+
fin.desktop.ExcelService.removeEventListener('excelConnected', this.onExcelConnected);
|
|
215
|
+
fin.desktop.ExcelService.removeEventListener('excelDisconnected', this.onExcelDisconnected);
|
|
216
|
+
this.adaptable.logger.info('Excel closed stopping all Live Excel');
|
|
217
|
+
this.getOpenFinApi().stopLiveData();
|
|
218
|
+
};
|
|
219
|
+
this.initialisingExcel = null;
|
|
220
|
+
this.waitForExcel = () => {
|
|
221
|
+
let startTime = Date.now();
|
|
222
|
+
const poolForExcel = (callback) => {
|
|
223
|
+
if (Date.now() - startTime > 20000) {
|
|
224
|
+
console.error(`Could not find any Excel instance.`);
|
|
225
|
+
return callback();
|
|
226
|
+
}
|
|
227
|
+
if (!fin.desktop.Excel || !fin.desktop.Excel.getWorkbooks) {
|
|
228
|
+
requestAnimationFrame(() => {
|
|
229
|
+
poolForExcel(callback);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
callback();
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
return new Promise((resolve) => {
|
|
237
|
+
poolForExcel(() => resolve(''));
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
this.on = (eventName, callback) => {
|
|
241
|
+
return this.emitter.on(eventName, callback);
|
|
242
|
+
};
|
|
243
|
+
this.emit = (eventName, data) => {
|
|
244
|
+
return this.emitter.emit(eventName, data);
|
|
245
|
+
};
|
|
246
|
+
this.adaptable = adaptable;
|
|
247
|
+
this.options = options;
|
|
248
|
+
this.emitter = new Emitter_1.default();
|
|
249
|
+
}
|
|
250
250
|
}
|
|
251
251
|
exports.OpenFinService = OpenFinService;
|
package/src/index.js
CHANGED
|
@@ -76,16 +76,13 @@ class OpenFinPlugin extends types_1.AdaptablePlugin {
|
|
|
76
76
|
this.openFinApi = new OpenFinApiImpl_1.OpenFinApiImpl(adaptable, this.options);
|
|
77
77
|
this.OpenFinService = new OpenFinService_1.OpenFinService(adaptable, this.options);
|
|
78
78
|
adaptable.api.eventApi.on('AlertFired', (alertFiredInfo) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
((_b = (_a = alertFiredInfo.alert) === null || _a === void 0 ? void 0 : _a.alertDefinition.AlertProperties) === null || _b === void 0 ? void 0 : _b.DisplayNotification)) {
|
|
82
|
-
if (!alertFiredInfo.alert.alertDefinition.AlertForm ||
|
|
79
|
+
if (this.options.showAdaptableAlertsAsNotifications) {
|
|
80
|
+
if (!alertFiredInfo.alert.alertDefinition.AlertProperties.DisplayNotification &&
|
|
83
81
|
typeof alertFiredInfo.alert.alertDefinition.AlertForm === 'string') {
|
|
84
|
-
// bail out early for
|
|
85
|
-
return
|
|
82
|
+
// bail out early for dynamic forms
|
|
83
|
+
return;
|
|
86
84
|
}
|
|
87
85
|
this.openFinApi.showNotificationForAlert(alertFiredInfo.alert);
|
|
88
|
-
return false;
|
|
89
86
|
}
|
|
90
87
|
});
|
|
91
88
|
this.registerProperty('api', () => this.openFinApi);
|