@refinitiv-ui/efx-grid 6.0.15 → 6.0.16
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +661 -84
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +10 -0
- package/lib/rt-grid/es6/ColumnDefinition.js +110 -1
- package/lib/rt-grid/es6/FieldDefinition.d.ts +6 -0
- package/lib/rt-grid/es6/FieldDefinition.js +43 -0
- package/lib/rt-grid/es6/Grid.js +184 -8
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +1 -0
- package/lib/rt-grid/es6/SnapshotFiller.js +125 -17
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +2 -2
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +30 -29
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +176 -98
- package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +17 -15
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +89 -159
- package/lib/versions.json +4 -4
- package/package.json +1 -1
@@ -2,6 +2,7 @@
|
|
2
2
|
import Grid from "./Grid.js";
|
3
3
|
import {Ext} from "../../tr-grid-util/es6/Ext.js";
|
4
4
|
import {EventDispatcher} from "../../tr-grid-util/es6/EventDispatcher.js";
|
5
|
+
import {FieldDefinition} from "./FieldDefinition.js";
|
5
6
|
|
6
7
|
/** @private
|
7
8
|
* @param {Object} obj
|
@@ -189,10 +190,19 @@ SnapshotFiller.prototype._onRequest = function () {
|
|
189
190
|
var instruments = Object.keys(this._rics);
|
190
191
|
|
191
192
|
var i;
|
192
|
-
var fields =
|
193
|
+
var fields = [];
|
194
|
+
var timeSeriesFields = [];
|
195
|
+
for (var field in this._fields) {
|
196
|
+
if(!FieldDefinition.isTimeSeriesField(field)) {
|
197
|
+
fields.push(field);
|
198
|
+
} else {
|
199
|
+
timeSeriesFields.push(field);
|
200
|
+
}
|
201
|
+
}
|
193
202
|
var fieldLen = fields.length;
|
203
|
+
var timeSeriesFieldLen = timeSeriesFields.length;
|
194
204
|
|
195
|
-
if (!fieldLen || !instruments.length) { // No ADC field or real-time RIC
|
205
|
+
if ( (!fieldLen && !timeSeriesFieldLen ) || !instruments.length) { // No ADC field or real-time RIC
|
196
206
|
return;
|
197
207
|
}
|
198
208
|
|
@@ -202,21 +212,47 @@ SnapshotFiller.prototype._onRequest = function () {
|
|
202
212
|
|
203
213
|
var onSuccess, payload;
|
204
214
|
if (this._rtk) {
|
205
|
-
var strFields
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
.
|
218
|
-
|
219
|
-
|
215
|
+
var strFields;
|
216
|
+
// Request time serie fields
|
217
|
+
if(timeSeriesFields.length > 0) {
|
218
|
+
// request time series field
|
219
|
+
var strtTimeSeriesFields = timeSeriesFields.join(',');
|
220
|
+
payload = {
|
221
|
+
"method": "select",
|
222
|
+
"formula": strtTimeSeriesFields,
|
223
|
+
"identifiers": instruments,
|
224
|
+
"productId": this._adcOptions.productId,
|
225
|
+
"output": "Col,date|,Row,In|,va,T,NoEmptyTickers" // For customize output server, for more information please visit "https://confluence.refinitiv.com/display/ADC/Data+Cloud+Output+Format"
|
226
|
+
};
|
227
|
+
onSuccess = this._onRTKTimeSeriesSuccess.bind(this, timeSeriesFields);
|
228
|
+
this._rtk.Data.Adc
|
229
|
+
.request(payload)
|
230
|
+
.then(onSuccess)
|
231
|
+
.catch(function (err) {
|
232
|
+
console.log(err);
|
233
|
+
});
|
234
|
+
}
|
235
|
+
|
236
|
+
// Request normal adc field
|
237
|
+
if(fields.length > 0) {
|
238
|
+
strFields = fields.join(',');
|
239
|
+
payload = {
|
240
|
+
"method": "select",
|
241
|
+
"formula": strFields,
|
242
|
+
"identifiers": instruments,
|
243
|
+
"productId": this._adcOptions.productId,
|
244
|
+
"output": "Col,In,va,T,NoEmptyTickers" // For customize output server, for more information please visit "https://confluence.refinitiv.com/display/ADC/Data+Cloud+Output+Format"
|
245
|
+
};
|
246
|
+
onSuccess = this._onRTKSuccess.bind(this, fields);
|
247
|
+
this._rtk.Data.Adc
|
248
|
+
.request(payload)
|
249
|
+
.then(onSuccess)
|
250
|
+
.catch(function (err) {
|
251
|
+
console.log(err);
|
252
|
+
});
|
253
|
+
}
|
254
|
+
|
255
|
+
|
220
256
|
} else {
|
221
257
|
var reqFields = [];
|
222
258
|
for(i = 0; i < fieldLen; i++) {
|
@@ -377,5 +413,77 @@ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
|
|
377
413
|
});
|
378
414
|
};
|
379
415
|
|
416
|
+
|
417
|
+
/** @private
|
418
|
+
* @function
|
419
|
+
* @param {Array.<string>} fields
|
420
|
+
* @param {string} serverResult
|
421
|
+
*/
|
422
|
+
SnapshotFiller.prototype._onRTKTimeSeriesSuccess = function (fields, serverResult) {
|
423
|
+
|
424
|
+
// TODO: noti the user for change structure
|
425
|
+
this._dispatch("adcDataReceived", serverResult);
|
426
|
+
var data2D = serverResult["rows"];
|
427
|
+
var svHeaders = serverResult["rows"] && serverResult["rows"][0];
|
428
|
+
if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
|
429
|
+
return; // TODO: Return Promise.reject(errMsg);
|
430
|
+
}
|
431
|
+
|
432
|
+
var headerLen = svHeaders.length;
|
433
|
+
|
434
|
+
var headerDates = [];
|
435
|
+
var i, j;
|
436
|
+
|
437
|
+
for (i = 2; i < headerLen; i++) { // Start with 2 (Skip instrunment and date header)
|
438
|
+
headerDates.push(svHeaders[i].v);
|
439
|
+
}
|
440
|
+
|
441
|
+
var ric, j, field;
|
442
|
+
var len = data2D.length;
|
443
|
+
var ricMap = {};
|
444
|
+
var childrenFieldToParent = {};
|
445
|
+
|
446
|
+
var fileNameToTSField = {};
|
447
|
+
var count = 0;
|
448
|
+
for (let i = 1; i < len; i++) {
|
449
|
+
var dataRow = data2D[i];
|
450
|
+
var fieldName = dataRow[1];
|
451
|
+
if(!fileNameToTSField[fieldName]) {
|
452
|
+
fileNameToTSField[fieldName] = fields[count++];
|
453
|
+
}
|
454
|
+
}
|
455
|
+
|
456
|
+
// TODO: Freeze the data view before setting multiple data
|
457
|
+
for (i = 1; i < len; i++) { // to skip column header index, use i = 1
|
458
|
+
var dataRow = data2D[i];
|
459
|
+
ric = dataRow[0];
|
460
|
+
var fieldName = dataRow[1]; // ex. PRICECLOSE
|
461
|
+
if(!ricMap[ric]) {
|
462
|
+
ricMap[ric] = {};
|
463
|
+
}
|
464
|
+
var snapData = ricMap[ric];
|
465
|
+
for (var k = 0; k < headerDates.length; k++) {
|
466
|
+
field = fileNameToTSField[fieldName].replace("TR.", "") + "_" + headerDates[k]; // TODO: make support time series field definition cache
|
467
|
+
childrenFieldToParent[field] = fileNameToTSField[fieldName];
|
468
|
+
snapData[field] = dataRow[2 + k]; // Start with field value
|
469
|
+
}
|
470
|
+
}
|
471
|
+
|
472
|
+
// return result only ric that has update data
|
473
|
+
var dataMapping = {};
|
474
|
+
for (ric in ricMap) {
|
475
|
+
var obj = ricMap[ric];
|
476
|
+
if (!isEmptyObject(obj)) {
|
477
|
+
dataMapping[ric] = obj;
|
478
|
+
}
|
479
|
+
}
|
480
|
+
|
481
|
+
this._dispatch("dataChanged", {
|
482
|
+
data: dataMapping,
|
483
|
+
timeSeries: true,
|
484
|
+
childrenFieldToParent: childrenFieldToParent
|
485
|
+
});
|
486
|
+
};
|
487
|
+
|
380
488
|
export { SnapshotFiller };
|
381
489
|
export default SnapshotFiller;
|
@@ -500,7 +500,7 @@ ColumnGroupingPlugin.prototype._applyTimeSeries = function (e) {
|
|
500
500
|
var firstChildColumn;
|
501
501
|
for (i = 0; i < addingEvents.length; i++) {
|
502
502
|
addingEvent = addingEvents[i];
|
503
|
-
if (addingEvent.context.
|
503
|
+
if (addingEvent.context.parent) {
|
504
504
|
if (!firstChildColumn) {
|
505
505
|
firstChildColumn = addingEvent.context;
|
506
506
|
}
|
@@ -509,7 +509,7 @@ ColumnGroupingPlugin.prototype._applyTimeSeries = function (e) {
|
|
509
509
|
children.push(childId);
|
510
510
|
}
|
511
511
|
}
|
512
|
-
if (firstChildColumn && firstChildColumn.
|
512
|
+
if (firstChildColumn && firstChildColumn.parent) {
|
513
513
|
var tsParentDef = firstChildColumn.parent;
|
514
514
|
if (tsParentDef) {
|
515
515
|
var parentName = tsParentDef.getName();
|
@@ -12,33 +12,34 @@ declare namespace RowFilteringPlugin {
|
|
12
12
|
|
13
13
|
type FilterExpression = {
|
14
14
|
field: string,
|
15
|
-
expression: RowFilteringPlugin.Expression,
|
15
|
+
expression: RowFilteringPlugin.Expression|null,
|
16
16
|
context: any
|
17
17
|
};
|
18
18
|
|
19
19
|
type ColumnOptions = {
|
20
|
-
filter?: RowFilteringPlugin.Expression,
|
20
|
+
filter?: RowFilteringPlugin.Expression|null,
|
21
21
|
filterState?: any,
|
22
|
-
filterIcon?: boolean
|
22
|
+
filterIcon?: boolean|null
|
23
23
|
};
|
24
24
|
|
25
25
|
type FilterDialogOptions = {
|
26
|
-
sortUI?: boolean,
|
27
|
-
filterUI?: boolean,
|
28
|
-
fieldDataType?: string,
|
29
|
-
lang?: string,
|
30
|
-
rawDataAccessor?: ((...params: any[]) => any),
|
31
|
-
formattedDataAccessor?: ((...params: any[]) => any),
|
32
|
-
sortLogic?: ((...params: any[]) => any)
|
26
|
+
sortUI?: boolean|null,
|
27
|
+
filterUI?: boolean|null,
|
28
|
+
fieldDataType?: string|null,
|
29
|
+
lang?: string|null,
|
30
|
+
rawDataAccessor?: ((...params: any[]) => any)|null,
|
31
|
+
formattedDataAccessor?: ((...params: any[]) => any)|null,
|
32
|
+
sortLogic?: ((...params: any[]) => any)|null
|
33
33
|
};
|
34
34
|
|
35
35
|
type Options = {
|
36
|
-
disabledUI?: boolean,
|
37
|
-
iconActivation?: string,
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
disabledUI?: boolean|null,
|
37
|
+
iconActivation?: string|null,
|
38
|
+
dialogOptions?: RowFilteringPlugin.FilterDialogOptions|null,
|
39
|
+
click?: ((...params: any[]) => any)|null,
|
40
|
+
clicked?: ((...params: any[]) => any)|null,
|
41
|
+
iconCreated?: ((...params: any[]) => any)|null,
|
42
|
+
filterChanged?: ((...params: any[]) => any)|null
|
42
43
|
};
|
43
44
|
|
44
45
|
}
|
@@ -57,17 +58,17 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
57
58
|
|
58
59
|
public getConfigObject(gridOptions?: any): any;
|
59
60
|
|
60
|
-
public disable(opt_disabled?: boolean, opt_id?: string): void;
|
61
|
+
public disable(opt_disabled?: boolean|null, opt_id?: string|null): void;
|
61
62
|
|
62
|
-
public addFilter(exp: RowFilteringPlugin.Expression, funcName?: string, ctx?: any): string;
|
63
|
+
public addFilter(exp: RowFilteringPlugin.Expression|null, funcName?: string|null, ctx?: any): string;
|
63
64
|
|
64
|
-
public addGridFilter(exp: RowFilteringPlugin.Expression, ctx?: any): string;
|
65
|
+
public addGridFilter(exp: RowFilteringPlugin.Expression|null, ctx?: any): string;
|
65
66
|
|
66
|
-
public addColumnFilter(colIndex: number, exp: RowFilteringPlugin.Expression, ctx?: (any|string)): boolean;
|
67
|
+
public addColumnFilter(colIndex: number, exp: RowFilteringPlugin.Expression|null, ctx?: (any|string)|null): boolean;
|
67
68
|
|
68
|
-
public setColumnFilter(colIndex: number, exp: RowFilteringPlugin.Expression, ctx?: (any|string)): boolean;
|
69
|
+
public setColumnFilter(colIndex: number, exp: RowFilteringPlugin.Expression|null, ctx?: (any|string)|null): boolean;
|
69
70
|
|
70
|
-
public removeFilter(funcRef: ((...params: any[]) => any)|string): boolean;
|
71
|
+
public removeFilter(funcRef: ((...params: any[]) => any)|string|null): boolean;
|
71
72
|
|
72
73
|
public removeColumnFilters(colIndex: number): boolean;
|
73
74
|
|
@@ -77,11 +78,11 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
77
78
|
|
78
79
|
public removeAllFilters(): void;
|
79
80
|
|
80
|
-
public setOverridingFilter(func: ((...params: any[]) => any)): void;
|
81
|
+
public setOverridingFilter(func: ((...params: any[]) => any)|null): void;
|
81
82
|
|
82
|
-
public setPreTransform(func: ((...params: any[]) => any)): void;
|
83
|
+
public setPreTransform(func: ((...params: any[]) => any)|null): void;
|
83
84
|
|
84
|
-
public setRowTransform(func: ((...params: any[]) => any)): void;
|
85
|
+
public setRowTransform(func: ((...params: any[]) => any)|null): void;
|
85
86
|
|
86
87
|
public getFilters(): (((...params: any[]) => any))[];
|
87
88
|
|
@@ -89,7 +90,7 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
89
90
|
|
90
91
|
public getFilterExpressions(): (RowFilteringPlugin.FilterExpression)[]|null;
|
91
92
|
|
92
|
-
public setFilterExpressions(filterExps: (RowFilteringPlugin.FilterExpression)[]): void;
|
93
|
+
public setFilterExpressions(filterExps: (RowFilteringPlugin.FilterExpression)[]|null): void;
|
93
94
|
|
94
95
|
public hasColumnFilter(): boolean;
|
95
96
|
|
@@ -109,13 +110,13 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
109
110
|
|
110
111
|
public getColumnFilterStates(): any[];
|
111
112
|
|
112
|
-
public getUniqueValues(field: string, formatter?: ((...params: any[]) => any), fmtField?: string, rawDataAccessor?: ((...params: any[]) => any), formattedDataAccessor?: ((...params: any[]) => any)): any;
|
113
|
+
public getUniqueValues(field: string, formatter?: ((...params: any[]) => any)|null, fmtField?: string|null, rawDataAccessor?: ((...params: any[]) => any)|null, formattedDataAccessor?: ((...params: any[]) => any)|null): any;
|
113
114
|
|
114
|
-
public openDialog(colIndex: number,
|
115
|
+
public openDialog(colIndex: number, runtimeDialogOptions?: RowFilteringPlugin.FilterDialogOptions|null): void;
|
115
116
|
|
116
117
|
}
|
117
118
|
|
118
|
-
declare function field(colIndex: number, exp: RowFilteringPlugin.Expression, ctx?: (any|string)): boolean;
|
119
|
+
declare function field(colIndex: number, exp: RowFilteringPlugin.Expression|null, ctx?: (any|string)|null): boolean;
|
119
120
|
|
120
121
|
export default RowFilteringPlugin;
|
121
122
|
export { RowFilteringPlugin, RowFilteringPlugin as RowFiltering, RowFilteringPlugin as RowFilteringExtension };
|