@refinitiv-ui/efx-grid 6.0.91 → 6.0.92
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-dragging/es6/ColumnDragging.d.ts +1 -1
- package/lib/column-dragging/es6/ColumnDragging.js +144 -34
- package/lib/core/dist/core.js +2410 -2621
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.js +14 -14
- package/lib/core/es6/data/DataCache.js +118 -118
- package/lib/core/es6/data/DataTable.d.ts +3 -1
- package/lib/core/es6/data/DataTable.js +208 -190
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +291 -291
- package/lib/core/es6/data/Segment.js +79 -79
- package/lib/core/es6/data/SegmentCollection.js +81 -81
- package/lib/core/es6/data/WrappedView.js +41 -41
- package/lib/core/es6/grid/Core.js +635 -635
- package/lib/core/es6/grid/ILayoutGrid.js +1 -1
- package/lib/core/es6/grid/LayoutGrid.js +183 -183
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +91 -91
- package/lib/core/es6/grid/components/Cell.js +29 -29
- package/lib/core/es6/grid/components/CellFloatingPanel.js +11 -11
- package/lib/core/es6/grid/components/CellSpan.js +7 -7
- package/lib/core/es6/grid/components/CellSpans.js +36 -34
- package/lib/core/es6/grid/components/Column.js +40 -40
- package/lib/core/es6/grid/components/ElementWrapper.js +17 -17
- package/lib/core/es6/grid/components/HScrollbar.js +31 -31
- package/lib/core/es6/grid/components/Scrollbar.js +77 -77
- package/lib/core/es6/grid/components/StretchedCells.js +49 -49
- package/lib/core/es6/grid/components/VScrollbar.js +11 -11
- package/lib/core/es6/grid/components/VirtualItems.js +3 -3
- package/lib/core/es6/grid/event/EventDispatcher.js +9 -9
- package/lib/core/es6/grid/event/EventListeners.js +4 -4
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +186 -186
- package/lib/core/es6/grid/util/Conflator.js +4 -4
- package/lib/core/es6/grid/util/Reverter.js +1 -1
- package/lib/core/es6/grid/util/SectionSettings.js +20 -20
- package/lib/core/es6/grid/util/SelectionList.js +23 -23
- package/lib/core/es6/grid/util/TrackLayout.js +74 -74
- package/lib/core/es6/grid/util/Virtualizer.js +15 -15
- package/lib/core/es6/grid/util/util.js +20 -20
- package/lib/core/es6/index.d.ts +0 -2
- package/lib/core/es6/index.js +0 -3
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +193 -70
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +46 -30
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -1
- package/lib/rt-grid/es6/RowDefinition.js +74 -16
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +56 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +29 -1
- package/lib/tr-grid-util/es6/CellPainter.js +94 -93
- package/lib/tr-grid-util/es6/Conflator.js +4 -4
- package/lib/tr-grid-util/es6/CoralItems.js +6 -6
- package/lib/tr-grid-util/es6/DateTime.js +39 -39
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.js +1 -1
- package/lib/tr-grid-util/es6/Dom.js +26 -26
- package/lib/tr-grid-util/es6/DragUI.js +17 -17
- package/lib/tr-grid-util/es6/ElementObserver.js +12 -12
- package/lib/tr-grid-util/es6/ElementWrapper.js +2 -2
- package/lib/tr-grid-util/es6/ElfDate.js +4 -4
- package/lib/tr-grid-util/es6/ElfUtil.js +37 -37
- package/lib/tr-grid-util/es6/EventDispatcher.js +12 -12
- package/lib/tr-grid-util/es6/ExpanderIcon.js +6 -6
- package/lib/tr-grid-util/es6/ExpressionParser.js +43 -43
- package/lib/tr-grid-util/es6/Ext.js +6 -6
- package/lib/tr-grid-util/es6/FieldFormatter.js +17 -17
- package/lib/tr-grid-util/es6/FilterBuilder.js +57 -57
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +12 -1
- package/lib/tr-grid-util/es6/FilterOperators.js +13 -2
- package/lib/tr-grid-util/es6/GridPlugin.js +86 -86
- package/lib/tr-grid-util/es6/GroupDefinitions.js +90 -90
- package/lib/tr-grid-util/es6/Icon.js +4 -4
- package/lib/tr-grid-util/es6/MouseDownTrait.js +6 -6
- package/lib/tr-grid-util/es6/MultiTableManager.js +68 -68
- package/lib/tr-grid-util/es6/NumberFormatter.js +22 -22
- package/lib/tr-grid-util/es6/PercentBar.js +17 -17
- package/lib/tr-grid-util/es6/Perf.js +5 -5
- package/lib/tr-grid-util/es6/Popup.js +42 -42
- package/lib/tr-grid-util/es6/RangeBar.js +5 -5
- package/lib/tr-grid-util/es6/RequestQueue.js +5 -5
- package/lib/tr-grid-util/es6/RowPainter.js +23 -23
- package/lib/tr-grid-util/es6/SubTable.js +94 -94
- package/lib/tr-grid-util/es6/Table.js +51 -51
- package/lib/tr-grid-util/es6/TextHighlighter.js +49 -49
- package/lib/tr-grid-util/es6/TickCodes.js +2 -2
- package/lib/tr-grid-util/es6/Timer.js +2 -2
- package/lib/tr-grid-util/es6/TouchProxy.js +7 -7
- package/lib/tr-grid-util/es6/Util.js +50 -50
- package/lib/tr-grid-util/es6/formula/ADCService.js +2 -2
- package/lib/tr-grid-util/es6/formula/ADCSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/AdFinService.js +2 -2
- package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/Engine.js +56 -56
- package/lib/tr-grid-util/es6/formula/Formula.js +62 -62
- package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +3 -3
- package/lib/tr-grid-util/es6/formula/Realtime.js +15 -15
- package/lib/tr-grid-util/es6/formula/RealtimeService.js +15 -15
- package/lib/tr-grid-util/es6/formula/TSIService.js +2 -2
- package/lib/tr-grid-util/es6/formula/TSISubscription.js +104 -104
- package/lib/tr-grid-util/es6/formula/VariableToken.js +20 -20
- package/lib/tr-grid-util/es6/formula/functions/AdFin.js +10 -10
- package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
- package/lib/tr-grid-util/es6/formula/functions/Info.js +2 -2
- package/lib/tr-grid-util/es6/formula/functions/Internal.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Logic.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Math.js +46 -46
- package/lib/tr-grid-util/es6/formula/functions/Statistics.js +27 -27
- package/lib/tr-grid-util/es6/formula/functions/Text.js +19 -19
- package/lib/tr-grid-util/es6/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/Adc.js +36 -36
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +11 -11
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +95 -95
- package/lib/tr-grid-util/es6/jet/DataSet.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockArchive.js +5 -5
- package/lib/tr-grid-util/es6/jet/MockJET.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockQuotes.js +13 -13
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +100 -100
- package/lib/tr-grid-util/es6/jet/MockRTK.js +4 -4
- package/lib/tr-grid-util/es6/jet/MockUtil.js +2 -2
- package/lib/tr-grid-util/es6/jet/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.js +15 -15
- package/lib/tr-grid-util/es6/locale/translation-de.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-en.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-ja.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation.js +1 -1
- package/lib/types/es6/ColumnDragging.d.ts +1 -1
- package/lib/types/es6/ColumnGrouping.d.ts +3 -1
- package/lib/types/es6/Core/data/DataTable.d.ts +4 -0
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
- package/lib/types/es6/Core/index.d.ts +0 -2
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -1
- package/lib/versions.json +4 -4
- package/package.json +1 -1
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/core/es6/grid/util/ElementFrameWork.js +0 -227
- package/lib/core/es6/grid/util/HttpRequest.d.ts +0 -53
- package/lib/core/es6/grid/util/HttpRequest.js +0 -371
- package/lib/core/es6/grid/util/PercentBar.d.ts +0 -43
- package/lib/core/es6/grid/util/PercentBar.js +0 -390
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/core/es6/grid/util/PercentBarRenderer.js +0 -316
- package/lib/core/es6/grid/util/RangeBar.d.ts +0 -25
- package/lib/core/es6/grid/util/RangeBar.js +0 -255
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +0 -53
- package/lib/types/es6/Core/grid/util/PercentBar.d.ts +0 -43
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +0 -25
@@ -19,8 +19,8 @@ import EventDispatcher from "../grid/event/EventDispatcher.js";
|
|
19
19
|
* @constructor
|
20
20
|
* @extends {EventDispatcher}
|
21
21
|
*/
|
22
|
-
|
23
|
-
|
22
|
+
let DataCache = function () {
|
23
|
+
let _t = this;
|
24
24
|
|
25
25
|
_t._rows = {};
|
26
26
|
_t._subs = {};
|
@@ -94,7 +94,7 @@ DataCache.prototype.addSubscription = function (sub, opt_primaryRic, opt_values)
|
|
94
94
|
return;
|
95
95
|
}
|
96
96
|
|
97
|
-
|
97
|
+
let internalSub = {"s": sub, "rics": {}};
|
98
98
|
|
99
99
|
this._subs[sub["id"]] = internalSub;
|
100
100
|
|
@@ -121,7 +121,7 @@ DataCache.prototype.addSubscription = function (sub, opt_primaryRic, opt_values)
|
|
121
121
|
* @param {Object} sub Subscription object from JET.Quote
|
122
122
|
*/
|
123
123
|
DataCache.prototype.removeSubscription = function (sub) { // All RICs associated to the subscription are removed
|
124
|
-
|
124
|
+
let subId = sub["id"];
|
125
125
|
|
126
126
|
if (!sub || !this._subs[subId]) {
|
127
127
|
return;
|
@@ -131,9 +131,9 @@ DataCache.prototype.removeSubscription = function (sub) { // All RICs associated
|
|
131
131
|
sub["stop"]();
|
132
132
|
}
|
133
133
|
|
134
|
-
|
134
|
+
let rics = this._subs[subId]["rics"];
|
135
135
|
|
136
|
-
for (
|
136
|
+
for (let ric in rics) {
|
137
137
|
this.setRowData(subId + ric, null); // No subscription attached
|
138
138
|
}
|
139
139
|
|
@@ -148,7 +148,7 @@ DataCache.prototype.startAllSubscriptions = function () {
|
|
148
148
|
if (this._quotes2) {
|
149
149
|
this._quotes2["start"]();
|
150
150
|
} else {
|
151
|
-
for (
|
151
|
+
for (let key in this._subs) {
|
152
152
|
this._subs[key]["s"]["start"]();
|
153
153
|
}
|
154
154
|
}
|
@@ -162,7 +162,7 @@ DataCache.prototype.stopAllSubscriptions = function () {
|
|
162
162
|
if (this._quotes2) {
|
163
163
|
this._quotes2["stop"]();
|
164
164
|
} else {
|
165
|
-
for (
|
165
|
+
for (let key in this._subs) {
|
166
166
|
this._subs[key]["s"]["stop"]();
|
167
167
|
}
|
168
168
|
}
|
@@ -183,7 +183,7 @@ DataCache.prototype.getSubscription = function (sub_id) {
|
|
183
183
|
* @return {string} ric that has been input when calling addSubscription
|
184
184
|
*/
|
185
185
|
DataCache.prototype.getPrimaryRic = function (sub_id) {
|
186
|
-
|
186
|
+
let subDef = this._subs[sub_id];
|
187
187
|
if (subDef) {
|
188
188
|
return subDef["primary"];
|
189
189
|
}
|
@@ -224,13 +224,13 @@ DataCache.prototype.clearAllData = function (opt_suppressEvent) { // All subscri
|
|
224
224
|
* @fires DataCache#dataChanged
|
225
225
|
*/
|
226
226
|
DataCache.prototype.clearColumnData = function (colId, opt_suppressEvent) {
|
227
|
-
|
227
|
+
let cids = (typeof colId === "string") ? [/** @type {string} */(colId)] : /** @type {Array.<string>} */(colId);
|
228
228
|
|
229
|
-
for (
|
230
|
-
|
229
|
+
for (let i = cids.length; --i >= 0;) {
|
230
|
+
let cid = cids[i];
|
231
231
|
|
232
232
|
if (cid) {
|
233
|
-
for (
|
233
|
+
for (let rid in this._rows) {
|
234
234
|
delete this._rows[rid][cid];
|
235
235
|
}
|
236
236
|
}
|
@@ -248,7 +248,7 @@ DataCache.prototype.clearColumnData = function (colId, opt_suppressEvent) {
|
|
248
248
|
* @return {*}
|
249
249
|
*/
|
250
250
|
DataCache.prototype.getData = function (rid, cid) {
|
251
|
-
|
251
|
+
let row = this.getRowData(rid);
|
252
252
|
|
253
253
|
return (row) ? row[cid] : null;
|
254
254
|
};
|
@@ -259,12 +259,12 @@ DataCache.prototype.getData = function (rid, cid) {
|
|
259
259
|
* @return {Object.<string, Array.<string>>} Map of Array of subscription object
|
260
260
|
*/
|
261
261
|
DataCache.prototype.getAllRics = function () { // Slow
|
262
|
-
|
262
|
+
let ricMap = {};
|
263
263
|
|
264
|
-
for (
|
265
|
-
|
264
|
+
for (let subId in this._subs) {
|
265
|
+
let rics = this._subs[subId]["rics"];
|
266
266
|
|
267
|
-
for (
|
267
|
+
for (let ric in rics) {
|
268
268
|
if (!ricMap[ric]) {
|
269
269
|
ricMap[ric] = [];
|
270
270
|
}
|
@@ -281,9 +281,9 @@ DataCache.prototype.getAllRics = function () { // Slow
|
|
281
281
|
* @return {Array.<string>}
|
282
282
|
*/
|
283
283
|
DataCache.prototype.getAllRowIds = function () {
|
284
|
-
|
284
|
+
let rids = [];
|
285
285
|
|
286
|
-
for (
|
286
|
+
for (let rid in this._rows) {
|
287
287
|
rids.push(rid);
|
288
288
|
}
|
289
289
|
|
@@ -305,9 +305,9 @@ DataCache.prototype.hasRowId = function (rid) {
|
|
305
305
|
* @return {!Array.<*>}
|
306
306
|
*/
|
307
307
|
DataCache.prototype.getColumnData = function (cid) {
|
308
|
-
|
308
|
+
let fieldRows = [];
|
309
309
|
|
310
|
-
for (
|
310
|
+
for (let rid in this._rows) {
|
311
311
|
fieldRows.push(this._rows[rid][cid]);
|
312
312
|
}
|
313
313
|
|
@@ -331,7 +331,7 @@ DataCache.prototype.getRowData = function (rid) {
|
|
331
331
|
* @return {!Array.<Object>}
|
332
332
|
*/
|
333
333
|
DataCache.prototype.getMultipleRowData = function (rids, opt_from, opt_to) {
|
334
|
-
|
334
|
+
let len = rids.length;
|
335
335
|
|
336
336
|
if (opt_to == null) {
|
337
337
|
opt_to = len;
|
@@ -345,10 +345,10 @@ DataCache.prototype.getMultipleRowData = function (rids, opt_from, opt_to) {
|
|
345
345
|
opt_from = 0;
|
346
346
|
}
|
347
347
|
|
348
|
-
|
349
|
-
|
348
|
+
let out_ary = new Array(len);
|
349
|
+
let rowMap = this._rows;
|
350
350
|
|
351
|
-
for (
|
351
|
+
for (let i = opt_from; i < opt_to; ++i) {
|
352
352
|
out_ary[i] = rowMap[rids[i]] || null;
|
353
353
|
}
|
354
354
|
|
@@ -360,10 +360,10 @@ DataCache.prototype.getMultipleRowData = function (rids, opt_from, opt_to) {
|
|
360
360
|
* @return {!Array.<Object.<string, *>>}
|
361
361
|
*/
|
362
362
|
DataCache.prototype.getAllRowData = function () {
|
363
|
-
|
364
|
-
|
363
|
+
let rows = [];
|
364
|
+
let rowMap = this._rows;
|
365
365
|
|
366
|
-
for (
|
366
|
+
for (let rid in rowMap) {
|
367
367
|
rows.push(rowMap[rid]);
|
368
368
|
}
|
369
369
|
|
@@ -379,7 +379,7 @@ DataCache.prototype.getAllRowData = function () {
|
|
379
379
|
* @fires DataCache#dataChanged
|
380
380
|
*/
|
381
381
|
DataCache.prototype.setData = function (rid, cid, value) { // Data changed event is always dispatched
|
382
|
-
|
382
|
+
let values = {};
|
383
383
|
|
384
384
|
values[cid] = value;
|
385
385
|
|
@@ -396,14 +396,14 @@ DataCache.prototype.hasDataCloudData = function (rid) {
|
|
396
396
|
return false;
|
397
397
|
}
|
398
398
|
|
399
|
-
|
399
|
+
let row = this.getRowData(rid);
|
400
400
|
|
401
401
|
if (!row) {
|
402
402
|
return false;
|
403
403
|
}
|
404
404
|
|
405
|
-
for (
|
406
|
-
|
405
|
+
for (let i = this._adcFields.length; --i >= 0;) {
|
406
|
+
let data = row[this._adcFields[i]];
|
407
407
|
|
408
408
|
if (data != null) {
|
409
409
|
return true;
|
@@ -422,9 +422,9 @@ DataCache.prototype.hasDataCloudData = function (rid) {
|
|
422
422
|
* @fires DataCache#dataChanged
|
423
423
|
*/
|
424
424
|
DataCache.prototype.setRowData = function (rid, values, opt_eventArg) { // Data changed event is always dispatched
|
425
|
-
|
426
|
-
|
427
|
-
|
425
|
+
let row = this.getRowData(rid);
|
426
|
+
let dirty = false;
|
427
|
+
let changes = null;
|
428
428
|
|
429
429
|
if (values) {
|
430
430
|
if (!row) {
|
@@ -434,7 +434,7 @@ DataCache.prototype.setRowData = function (rid, values, opt_eventArg) { // Data
|
|
434
434
|
dirty = true;
|
435
435
|
|
436
436
|
} else {
|
437
|
-
for (
|
437
|
+
for (let cid in values) {
|
438
438
|
row[cid] = values[cid];
|
439
439
|
dirty = true;
|
440
440
|
}
|
@@ -449,7 +449,7 @@ DataCache.prototype.setRowData = function (rid, values, opt_eventArg) { // Data
|
|
449
449
|
}
|
450
450
|
|
451
451
|
if (dirty && !this._composing) {
|
452
|
-
|
452
|
+
let e = opt_eventArg || {};
|
453
453
|
|
454
454
|
e["rid"] = rid;
|
455
455
|
|
@@ -471,15 +471,15 @@ DataCache.prototype.setRowData = function (rid, values, opt_eventArg) { // Data
|
|
471
471
|
* @return {Object}
|
472
472
|
*/
|
473
473
|
DataCache.prototype.cloneRowData = function (rid) {
|
474
|
-
|
474
|
+
let fields = this._rows[rid];
|
475
475
|
|
476
476
|
if (!fields) {
|
477
477
|
return null;
|
478
478
|
}
|
479
479
|
|
480
|
-
|
480
|
+
let values = {};
|
481
481
|
|
482
|
-
for (
|
482
|
+
for (let key in fields) {
|
483
483
|
if (key.indexOf("FREE_TEXT") === 0) { // TODO: This is not generic and will cause unintentional error. Also, it posts some performance penalty
|
484
484
|
continue; // Skip free text column
|
485
485
|
}
|
@@ -501,7 +501,7 @@ DataCache.prototype.addStaticFields = function (fields) {
|
|
501
501
|
return;
|
502
502
|
}
|
503
503
|
|
504
|
-
for (
|
504
|
+
for (let i in fields) {
|
505
505
|
if (!this._staticFields[fields[i]]) {
|
506
506
|
this._staticFields[fields[i]] = 1;
|
507
507
|
} else {
|
@@ -521,7 +521,7 @@ DataCache.prototype.removeStaticFields = function (fields) {
|
|
521
521
|
return;
|
522
522
|
}
|
523
523
|
|
524
|
-
for (
|
524
|
+
for (let i in fields) {
|
525
525
|
if (this._staticFields[fields[i]]) {
|
526
526
|
this._staticFields[fields[i]]--;
|
527
527
|
|
@@ -555,7 +555,7 @@ DataCache.prototype.getStaticFields = function () {
|
|
555
555
|
* @param {Object=} options
|
556
556
|
* @return {!Array.<Object>} Return a JSON object that is compatible with console.table()
|
557
557
|
* @example
|
558
|
-
*
|
558
|
+
* let options = {
|
559
559
|
* "colNames": Array.<string>,
|
560
560
|
* "rowCount": number,
|
561
561
|
* "startIndex": number,
|
@@ -572,7 +572,7 @@ DataCache.prototype.dump = function (options) {
|
|
572
572
|
* @public
|
573
573
|
* @param {Object=} opt_options
|
574
574
|
* @example
|
575
|
-
*
|
575
|
+
* let options = {
|
576
576
|
* "colNames": Array.<string>,
|
577
577
|
* "rowCount": number,
|
578
578
|
* "startIndex": number,
|
@@ -631,10 +631,10 @@ DataCache.prototype.addDataCloudFields = function (fields) {
|
|
631
631
|
this._adcRefMap = {};
|
632
632
|
}
|
633
633
|
|
634
|
-
|
634
|
+
let newFields = [];
|
635
635
|
|
636
636
|
if (fields instanceof Array) {
|
637
|
-
for (
|
637
|
+
for (let i = fields.length; --i >= 0;) {
|
638
638
|
this._addDataCloudField(fields[i], newFields);
|
639
639
|
}
|
640
640
|
} else {
|
@@ -645,7 +645,7 @@ DataCache.prototype.addDataCloudFields = function (fields) {
|
|
645
645
|
return false;
|
646
646
|
}
|
647
647
|
|
648
|
-
|
648
|
+
let ricMap = this.getAllRics();
|
649
649
|
|
650
650
|
this._batchRequestDataCloud(ricMap, newFields);
|
651
651
|
|
@@ -670,7 +670,7 @@ DataCache.prototype.removeDataCloudField = function (field) {
|
|
670
670
|
--this._adcRefMap[field];
|
671
671
|
|
672
672
|
if (!this._adcRefMap[field]) {
|
673
|
-
|
673
|
+
let foundAt = this._adcFields.indexOf(field);
|
674
674
|
|
675
675
|
this._adcFields.splice(foundAt, 1);
|
676
676
|
this.clearColumnData(field);
|
@@ -707,7 +707,7 @@ DataCache.prototype._dispatchDataChange = function (e) {
|
|
707
707
|
* @return {*}
|
708
708
|
*/
|
709
709
|
DataCache._defaultPropertyGetter = function (propertyName, rowData, colName) {
|
710
|
-
|
710
|
+
let d = rowData[colName];
|
711
711
|
|
712
712
|
return d ? d[propertyName] : null;
|
713
713
|
};
|
@@ -732,13 +732,13 @@ DataCache._defaultGetter = function (rowData, colName) {
|
|
732
732
|
* @return {!Array.<Object>} Return a JSON object that is compatible with console.table()
|
733
733
|
*/
|
734
734
|
DataCache.constructTable = function (dataset, opt_options, opt_rowIds) {
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
735
|
+
let startIndex = 0;
|
736
|
+
let rLen = dataset.length;
|
737
|
+
let rowLim = rLen;
|
738
|
+
let colMap = null;
|
739
|
+
let rids = opt_rowIds || null;
|
740
|
+
let getter = DataCache._defaultGetter;
|
741
|
+
let transformation = false;
|
742
742
|
|
743
743
|
if (opt_options) {
|
744
744
|
if (opt_options["rowCount"]) {
|
@@ -749,9 +749,9 @@ DataCache.constructTable = function (dataset, opt_options, opt_rowIds) {
|
|
749
749
|
if (opt_options["colNames"]) {
|
750
750
|
colMap = {};
|
751
751
|
|
752
|
-
|
752
|
+
let len = opt_options["colNames"].length;
|
753
753
|
|
754
|
-
for (
|
754
|
+
for (let i = 0; i < len; ++i) {
|
755
755
|
colMap[opt_options["colNames"][i]] = true;
|
756
756
|
}
|
757
757
|
|
@@ -782,18 +782,18 @@ DataCache.constructTable = function (dataset, opt_options, opt_rowIds) {
|
|
782
782
|
return dataset; // The dataset is already compatible with console.table
|
783
783
|
}
|
784
784
|
|
785
|
-
|
785
|
+
let rows = [];
|
786
786
|
|
787
|
-
for (
|
787
|
+
for (let r = startIndex; r < rLen; ++r) {
|
788
788
|
if (rows.length >= rowLim) {
|
789
789
|
break;
|
790
790
|
}
|
791
791
|
|
792
|
-
|
793
|
-
|
792
|
+
let rowData = dataset[r];
|
793
|
+
let columns = (rids) ? {"rid": rids[r]} : {};
|
794
794
|
|
795
795
|
if (rowData) { // Header and footer don't have any row data
|
796
|
-
|
796
|
+
let colName;
|
797
797
|
|
798
798
|
if (colMap) {
|
799
799
|
for (colName in colMap) {
|
@@ -827,25 +827,25 @@ DataCache.prototype._insertRic = function (subId, ric, values) {
|
|
827
827
|
// HACK: Some chain may have 0# symbol in there chain index (e.g. 0#CL:)
|
828
828
|
ric = ric.replace("0#", "");
|
829
829
|
|
830
|
-
|
830
|
+
let rid = subId + ric;
|
831
831
|
|
832
832
|
// We cannot cache event arguments because user may want to collect all the updates
|
833
833
|
this._onADCForNewRic(subId, ric);
|
834
834
|
|
835
|
-
|
835
|
+
let rowData = this.getRowData(rid);
|
836
836
|
if (!rowData) { // Ensure that we have subscription id and ric from Quotes2
|
837
|
-
|
837
|
+
let tmp = values;
|
838
838
|
|
839
839
|
values = {}; // Clone a new object for duplicated ric
|
840
840
|
|
841
|
-
for (
|
841
|
+
for (let key in tmp) { // Slow
|
842
842
|
values[key] = tmp[key];
|
843
843
|
}
|
844
844
|
|
845
845
|
values["SUB_ID"] = subId;
|
846
846
|
values["RIC"] = ric;
|
847
847
|
} else {
|
848
|
-
|
848
|
+
let rowDef = rowData["ROW_DEF"];
|
849
849
|
if(rowDef && rowDef.isChain()){
|
850
850
|
values["SUB_ID"] = subId;
|
851
851
|
}
|
@@ -859,9 +859,9 @@ DataCache.prototype._insertRic = function (subId, ric, values) {
|
|
859
859
|
* @param {Object} e
|
860
860
|
*/
|
861
861
|
DataCache.prototype._onQ2DataChanged = function (e) {
|
862
|
-
|
863
|
-
|
864
|
-
|
862
|
+
let subId = e["subId"];
|
863
|
+
let ric = e["ric"];
|
864
|
+
let values = /** @type{Object.<string, *>} */(e["values"]);
|
865
865
|
|
866
866
|
if (values) {
|
867
867
|
this._insertRic(subId, ric, values);
|
@@ -877,13 +877,13 @@ DataCache.prototype._onQ2DataChanged = function (e) {
|
|
877
877
|
* @param {Object} e
|
878
878
|
*/
|
879
879
|
DataCache.prototype._onQ2SubAdded = function (e) {
|
880
|
-
|
881
|
-
|
882
|
-
|
880
|
+
let subs = e["subs"];
|
881
|
+
let duplicateSubIds = e["duplicateSubIds"];
|
882
|
+
let len = subs.length;
|
883
883
|
|
884
|
-
for (
|
885
|
-
|
886
|
-
|
884
|
+
for (let i = 0; i < len; ++i) {
|
885
|
+
let sub = subs[i];
|
886
|
+
let ric = sub["ric"];
|
887
887
|
|
888
888
|
// chain subId fires twice, one with "_ci_" and one without "_ci_"
|
889
889
|
// the subId with "_ci_" should be ignore
|
@@ -894,7 +894,7 @@ DataCache.prototype._onQ2SubAdded = function (e) {
|
|
894
894
|
this.addSubscription(sub, ric);
|
895
895
|
|
896
896
|
if (duplicateSubIds) { // There will be no network request for duplicate subs, and hence we need to update the data from our cache
|
897
|
-
|
897
|
+
let dupSubId = duplicateSubIds[i];
|
898
898
|
|
899
899
|
if (dupSubId) {
|
900
900
|
window.setTimeout(
|
@@ -910,11 +910,11 @@ DataCache.prototype._onQ2SubAdded = function (e) {
|
|
910
910
|
* @param {Object} e
|
911
911
|
*/
|
912
912
|
DataCache.prototype._onQ2SubRemoved = function (e) {
|
913
|
-
|
914
|
-
|
913
|
+
let subs = e["subs"];
|
914
|
+
let len = subs.length;
|
915
915
|
|
916
|
-
for (
|
917
|
-
|
916
|
+
for (let i = 0; i < len; ++i) {
|
917
|
+
let sub = subs[i];
|
918
918
|
|
919
919
|
// chain subId fires twice, one with "_ci_" and one without "_ci_"
|
920
920
|
// the subId with "_ci_" should be ignore
|
@@ -932,7 +932,7 @@ DataCache.prototype._onQ2SubRemoved = function (e) {
|
|
932
932
|
* @param {string} ric
|
933
933
|
*/
|
934
934
|
DataCache.prototype._onADCForNewRic = function (subId, ric) {
|
935
|
-
|
935
|
+
let sub = this._subs[subId];
|
936
936
|
|
937
937
|
if (!sub) {
|
938
938
|
return;
|
@@ -962,7 +962,7 @@ DataCache.prototype._onADCForNewRic = function (subId, ric) {
|
|
962
962
|
* @param {Object.<string, *>} dupData
|
963
963
|
*/
|
964
964
|
DataCache.prototype._onDuplicateRic = function (subId, dupData) {
|
965
|
-
|
965
|
+
let sub = this._subs[subId];
|
966
966
|
|
967
967
|
if (!sub) {
|
968
968
|
return;
|
@@ -970,9 +970,9 @@ DataCache.prototype._onDuplicateRic = function (subId, dupData) {
|
|
970
970
|
|
971
971
|
sub = sub["s"]; // Quotes2' subscription
|
972
972
|
|
973
|
-
|
974
|
-
|
975
|
-
|
973
|
+
let ric = sub["ric"];
|
974
|
+
let dupSubId = /** @type{string} */(dupData["SUB_ID"]);
|
975
|
+
let values = this._cloneRowData(dupData, ric, subId);
|
976
976
|
|
977
977
|
if (!values) {
|
978
978
|
return;
|
@@ -980,12 +980,12 @@ DataCache.prototype._onDuplicateRic = function (subId, dupData) {
|
|
980
980
|
|
981
981
|
this._onInsert(sub, ric, values);
|
982
982
|
|
983
|
-
|
983
|
+
let children = sub["children"];
|
984
984
|
|
985
985
|
if (children) {
|
986
|
-
|
986
|
+
let childCount = children.length;
|
987
987
|
|
988
|
-
for (
|
988
|
+
for (let i = 0; i < childCount; ++i) {
|
989
989
|
ric = children[i];
|
990
990
|
values = this._cloneRowData(dupSubId, ric, subId);
|
991
991
|
|
@@ -1001,7 +1001,7 @@ DataCache.prototype._onDuplicateRic = function (subId, dupData) {
|
|
1001
1001
|
* @param {Object.<string, *>} values
|
1002
1002
|
*/
|
1003
1003
|
DataCache.prototype._onInsert = function (sub, ric, values/*, rowN*/) {
|
1004
|
-
|
1004
|
+
let subId = sub["id"];
|
1005
1005
|
|
1006
1006
|
if (this._quotes2) {
|
1007
1007
|
this._insertRic(subId, ric, values);
|
@@ -1054,8 +1054,8 @@ DataCache.prototype._addDataCloudField = function (field, ary_out) {
|
|
1054
1054
|
* @suppress {missingProperties}
|
1055
1055
|
*/
|
1056
1056
|
DataCache.prototype._onADCUpdate = function (e) {
|
1057
|
-
|
1058
|
-
|
1057
|
+
let xhr = e["currentTarget"]; // XMLHttpRequest
|
1058
|
+
let resp = null;
|
1059
1059
|
|
1060
1060
|
try {
|
1061
1061
|
resp = JSON.parse(xhr.responseText);
|
@@ -1068,14 +1068,14 @@ DataCache.prototype._onADCUpdate = function (e) {
|
|
1068
1068
|
return;
|
1069
1069
|
}
|
1070
1070
|
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1071
|
+
let colCount = resp["cols"];
|
1072
|
+
let rows = resp["rows"];
|
1073
|
+
let colDefs = rows[0]; // The first row is always the column definition
|
1074
|
+
let ricIndex = -1;
|
1075
|
+
let fieldIndices = {};
|
1076
1076
|
|
1077
|
-
for (
|
1078
|
-
|
1077
|
+
for (let i = 0; i < colCount; ++i) {
|
1078
|
+
let colDef = colDefs[i];
|
1079
1079
|
|
1080
1080
|
if (colDef["i"] === "instrument") {
|
1081
1081
|
ricIndex = i;
|
@@ -1084,15 +1084,15 @@ DataCache.prototype._onADCUpdate = function (e) {
|
|
1084
1084
|
}
|
1085
1085
|
}
|
1086
1086
|
|
1087
|
-
|
1087
|
+
let rowCount = rows.length;
|
1088
1088
|
|
1089
|
-
for (
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1089
|
+
for (let j = 1; j < rowCount; ++j) { // Start from 1
|
1090
|
+
let row = rows[j];
|
1091
|
+
let ric = row[ricIndex];
|
1092
|
+
let values = {};
|
1093
1093
|
|
1094
|
-
for (
|
1095
|
-
|
1094
|
+
for (let field in fieldIndices) {
|
1095
|
+
let value = row[fieldIndices[field]];
|
1096
1096
|
|
1097
1097
|
if (value != null) {
|
1098
1098
|
// Data should be merged from the backend.
|
@@ -1109,11 +1109,11 @@ DataCache.prototype._onADCUpdate = function (e) {
|
|
1109
1109
|
}
|
1110
1110
|
}
|
1111
1111
|
|
1112
|
-
|
1112
|
+
let subIds = xhr.ricMap[ric];
|
1113
1113
|
|
1114
1114
|
if (subIds) { // Only ric within the subscription can be updated
|
1115
1115
|
for (i = subIds.length; --i >= 0;) {
|
1116
|
-
|
1116
|
+
let subId = subIds[i];
|
1117
1117
|
|
1118
1118
|
if (this._subs[subId]) { // Only update the existing subscription
|
1119
1119
|
// window.console.log("ADC update " + subId + ric + " with " + JSON.stringify(values));
|
@@ -1157,9 +1157,9 @@ DataCache.prototype._batchRequestDataCloud = function (ricMap, fields) {
|
|
1157
1157
|
return null;
|
1158
1158
|
}
|
1159
1159
|
|
1160
|
-
|
1160
|
+
let rics = [];
|
1161
1161
|
|
1162
|
-
for (
|
1162
|
+
for (let ric in ricMap) {
|
1163
1163
|
rics.push(ric);
|
1164
1164
|
}
|
1165
1165
|
|
@@ -1187,7 +1187,7 @@ DataCache.prototype._requestDataCloud = function (ricMap, fields, rics) { // Sma
|
|
1187
1187
|
return null;
|
1188
1188
|
}
|
1189
1189
|
|
1190
|
-
|
1190
|
+
let xhr = new XMLHttpRequest();
|
1191
1191
|
|
1192
1192
|
xhr.onload = this._onADCUpdate;
|
1193
1193
|
xhr.onerror = this._onADCError;
|
@@ -1196,7 +1196,7 @@ DataCache.prototype._requestDataCloud = function (ricMap, fields, rics) { // Sma
|
|
1196
1196
|
xhr.open("POST", this._adcUrl, true);
|
1197
1197
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
1198
1198
|
|
1199
|
-
|
1199
|
+
let body = 'formula=' + fields + '&identifiers=' + rics;
|
1200
1200
|
|
1201
1201
|
// window.console.log("ADC is requested with " + body);
|
1202
1202
|
if (this._productId) {
|
@@ -1224,8 +1224,8 @@ DataCache.prototype._requestDataCloud = function (ricMap, fields, rics) { // Sma
|
|
1224
1224
|
* @return {Object}
|
1225
1225
|
*/
|
1226
1226
|
DataCache.prototype._cloneRowData = function (obj, ric, newSubId) {
|
1227
|
-
|
1228
|
-
|
1227
|
+
let subId = (typeof obj === "string") ? obj : obj["SUB_ID"];
|
1228
|
+
let fields = this._rows[subId + ric];
|
1229
1229
|
|
1230
1230
|
if (!fields) { // The specified row has been removed
|
1231
1231
|
if (typeof obj === "object") {
|
@@ -1235,9 +1235,9 @@ DataCache.prototype._cloneRowData = function (obj, ric, newSubId) {
|
|
1235
1235
|
}
|
1236
1236
|
}
|
1237
1237
|
|
1238
|
-
|
1238
|
+
let values = {};
|
1239
1239
|
|
1240
|
-
for (
|
1240
|
+
for (let key in fields) {
|
1241
1241
|
if (this._staticFields[key] == null) { // Static field must not be cloned
|
1242
1242
|
values[key] = fields[key];
|
1243
1243
|
}
|
@@ -26,6 +26,8 @@ declare class DataTable extends DataCache {
|
|
26
26
|
|
27
27
|
public getPreviousData(rid: string, cid: string): { [key: string]: any };
|
28
28
|
|
29
|
+
public setRowData(rid: string, values?: { [key: string]: any }|null, eventArg?: any): boolean;
|
30
|
+
|
29
31
|
public setColumnData(cid: string, valueList: (any)[], opt_ridList?: (string)[]|null): void;
|
30
32
|
|
31
33
|
public setDataFromObjectMap(obj: { [key: string]: any }): void;
|
@@ -88,7 +90,7 @@ declare class DataTable extends DataCache {
|
|
88
90
|
|
89
91
|
public getSegment(rid: string): Segment|null;
|
90
92
|
|
91
|
-
public getSegmentParent(rid: string):
|
93
|
+
public getSegmentParent(rid: string): Segment|null;
|
92
94
|
|
93
95
|
public getSegmentLevel(rid: string): number;
|
94
96
|
|