@refinitiv-ui/efx-grid 6.0.32 → 6.0.33

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.
Files changed (30) hide show
  1. package/lib/core/dist/core.js +86 -11
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/grid/Core.d.ts +4 -0
  4. package/lib/core/es6/grid/Core.js +27 -6
  5. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +1 -0
  6. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +29 -5
  7. package/lib/grid/index.js +1 -1
  8. package/lib/rt-grid/dist/rt-grid.js +521 -179
  9. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  10. package/lib/rt-grid/es6/Grid.js +14 -13
  11. package/lib/rt-grid/es6/RowDefinition.js +1 -1
  12. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -0
  13. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +58 -30
  14. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +2 -0
  15. package/lib/tr-grid-column-stack/es6/ColumnStack.js +35 -12
  16. package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +2 -0
  17. package/lib/tr-grid-util/es6/GroupDefinitions.js +15 -0
  18. package/lib/tr-grid-util/es6/Util.d.ts +3 -0
  19. package/lib/tr-grid-util/es6/Util.js +15 -0
  20. package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +1 -1
  21. package/lib/tr-grid-util/es6/jet/CollectionDict.js +12 -2
  22. package/lib/tr-grid-util/es6/jet/MockQuotes2.js +170 -47
  23. package/lib/types/es6/ColumnGrouping.d.ts +4 -0
  24. package/lib/types/es6/ColumnSelection.d.ts +2 -0
  25. package/lib/types/es6/ColumnStack.d.ts +2 -0
  26. package/lib/types/es6/Core/grid/util/SelectionList.d.ts +6 -2
  27. package/lib/types/es6/RowDragging.d.ts +23 -1
  28. package/lib/types/es6/StatisticsRow.d.ts +25 -25
  29. package/lib/versions.json +3 -3
  30. package/package.json +1 -1
@@ -13104,7 +13104,7 @@ var ROW_TYPES = {
13104
13104
  */
13105
13105
  var RowDefinition = function(rowOptions) {
13106
13106
  this._changes = {};
13107
- if(rowOptions && rowOptions["segmentId"]) {
13107
+ if(rowOptions && rowOptions["segmentId"]) { // This row will be classification header row
13108
13108
  this._dataId = this._rowId = rowOptions["segmentId"];
13109
13109
  this._autoGenerated = true;
13110
13110
  this._subSegment = true;
@@ -17028,7 +17028,22 @@ GroupDefinitions.prototype.setGroupChildren = function (groupId, newChildList) {
17028
17028
  }
17029
17029
  return false;
17030
17030
  };
17031
+ /** @public
17032
+ * @param {string} groupId
17033
+ * @param {string} groupName
17034
+ * @return {boolean}
17035
+ */
17036
+ GroupDefinitions.prototype.setGroupName = function (groupId, groupName) {
17037
+ var groupDef = this._groupMap[groupId];
17038
+ if(groupDef) {
17039
+ if(groupDef.name !== groupName) {
17040
+ groupDef.name = groupName;
17041
+ return true;
17042
+ }
17043
+ }
17031
17044
 
17045
+ return false;
17046
+ };
17032
17047
  /* harmony default export */ var es6_GroupDefinitions = (GroupDefinitions);
17033
17048
 
17034
17049
 
@@ -20185,11 +20200,11 @@ ILayoutGrid.prototype.getHorizontalLayout = function () {};
20185
20200
  ILayoutGrid.prototype.calculateColumnBounds = function (lftIdx, rgtIdx, outPositions, outNoBorders) {};
20186
20201
  /** @public
20187
20202
  * @ignore
20188
- * @param {!Array.<number>} positions Left and right bound positions in pixel
20189
- * @param {!Array.<boolean>} noBorders Boolean values indicating existence of left and right CSS borders
20203
+ * @param {!Array.<Array>} posAry Left and right bound positions in pixel
20204
+ * @param {!Array.<Array>} noBorderAry Boolean values indicating existence of left and right CSS borders
20190
20205
  * @param {number=} topPx Top position of bound
20191
20206
  */
20192
- ILayoutGrid.prototype.updateColumnBounds = function (positions, noBorders, topPx) {};
20207
+ ILayoutGrid.prototype.updateColumnBounds = function (posAry, noBorderAry, topPx) {};
20193
20208
 
20194
20209
  /* harmony default export */ var grid_ILayoutGrid = (ILayoutGrid);
20195
20210
 
@@ -21755,6 +21770,34 @@ SelectionList.prototype.deselect = function (at) {
21755
21770
  }
21756
21771
  return false;
21757
21772
  };
21773
+ /** Deselect all selections starting from the specified index
21774
+ * @public
21775
+ * @param {number} at
21776
+ * @return {boolean}
21777
+ */
21778
+ SelectionList.prototype.deselectFrom = function (at) {
21779
+ if(this._lastIndex < at) {
21780
+ return false;
21781
+ }
21782
+ if(this._firstIndex >= at) {
21783
+ this.clearAllSelections();
21784
+ return true;
21785
+ }
21786
+
21787
+ var lastIndex = this._lastIndex;
21788
+ var sels = this._selections;
21789
+ for(var i = at; i <= lastIndex; ++i) {
21790
+ if (sels[i]) {
21791
+ sels[at] = false;
21792
+ --this._count;
21793
+ }
21794
+ }
21795
+ if (this._anchor >= at) {
21796
+ this._anchor = -1; // No anchor
21797
+ }
21798
+ this._lastIndex = this._findPrevSelection(at);
21799
+ return true;
21800
+ };
21758
21801
  /** @public
21759
21802
  * @param {number} at
21760
21803
  */
@@ -21951,14 +21994,16 @@ SelectionList.prototype.getLastSelectedIndex = function() {
21951
21994
 
21952
21995
  /** WARNING: It will creates a new(EXPENSIVE) defragmented array of selected Index. The selected indices will always be sorted in ascending order
21953
21996
  * @public
21954
- * @return {Array.<number>}
21997
+ * @return {!Array.<number>}
21955
21998
  */
21956
21999
  SelectionList.prototype.getAllSelections = function() {
21957
22000
  if(this._count > 0) {
21958
22001
  var ary = new Array(this._count); // Fastest way to create an array
21959
22002
  var count = 0;
21960
- for(var i = this._firstIndex; i <= this._lastIndex; ++i) {
21961
- if(this._selections[i]) {
22003
+ var sels = this._selections;
22004
+ var lastIdx = this._lastIndex;
22005
+ for(var i = this._firstIndex; i <= lastIdx; ++i) {
22006
+ if(sels[i]) {
21962
22007
  ary[count++] = i;
21963
22008
  }
21964
22009
  }
@@ -21966,6 +22011,45 @@ SelectionList.prototype.getAllSelections = function() {
21966
22011
  }
21967
22012
  return [];
21968
22013
  };
22014
+ /** Get array of connected selection ranges. For intances, if indices 1, 2, 5, and 5 are selected, array of [1, 2] and [5, 5] are returned.
22015
+ * @public
22016
+ * @param {number=} from
22017
+ * @param {number=} to EXCLUSIVE
22018
+ * @return {!Array.<Array.<number>>}
22019
+ */
22020
+ SelectionList.prototype.getConnectedRanges = function(from, to) {
22021
+ if(this._count > 0) {
22022
+ var ary = [];
22023
+ if(from == null || from < this._firstIndex) {
22024
+ from = this._firstIndex;
22025
+ }
22026
+ if(to == null || to > this._lastIndex) {
22027
+ to = this._lastIndex + 1;
22028
+ }
22029
+
22030
+ var pair = null;
22031
+ for(var i = from; i < to; ++i) {
22032
+ if(this._selections[i]) {
22033
+ if(!pair) {
22034
+ pair = [i, -1];
22035
+ }
22036
+ } else if(pair) {
22037
+ pair[1] = i - 1;
22038
+ ary.push(pair);
22039
+ pair = null;
22040
+ }
22041
+ }
22042
+
22043
+ if(pair) {
22044
+ pair[1] = this._lastIndex;
22045
+ ary.push(pair);
22046
+ pair = null;
22047
+ }
22048
+ return ary;
22049
+ }
22050
+ return [];
22051
+ };
22052
+
21969
22053
  /**
21970
22054
  * @public
21971
22055
  * @return {Array.<boolean>}
@@ -21993,13 +22077,13 @@ SelectionList.prototype.clearAllSelections = function() {
21993
22077
  * @public
21994
22078
  * @param {SelectionList} srcSelections
21995
22079
  * @param {number} fromSrcIndex
21996
- * @param {number} offsetIndex
22080
+ * @param {number} offset Offset from the source index to map to destination index of this SelectionList. Use 0 if there is no shifting.
21997
22081
  * @param {number} forLength Positive value only. negative valie is not allowed
21998
22082
  */
21999
- SelectionList.prototype.copyFrom = function (srcSelections, fromSrcIndex, offsetIndex, forLength) {
22083
+ SelectionList.prototype.copyFrom = function (srcSelections, fromSrcIndex, offset, forLength) {
22000
22084
  if (forLength <= 0) { return; }
22001
22085
 
22002
- var toThisIndex = fromSrcIndex + offsetIndex;
22086
+ var toThisIndex = fromSrcIndex + offset;
22003
22087
  if (srcSelections == null) {
22004
22088
  this.deselectRange(toThisIndex, forLength);
22005
22089
  return;
@@ -22020,7 +22104,7 @@ SelectionList.prototype.copyFrom = function (srcSelections, fromSrcIndex, offset
22020
22104
  this._anchor = -1;
22021
22105
  if (srcSelections._anchor >= 0) {
22022
22106
  if (srcSelections._anchor >= fromSrcIndex && srcSelections._anchor < (fromSrcIndex + forLength)) {
22023
- this._anchor = srcSelections._anchor + offsetIndex;
22107
+ this._anchor = srcSelections._anchor + offset;
22024
22108
  }
22025
22109
  }
22026
22110
  };
@@ -22239,7 +22323,8 @@ var Scrollbar = function () {
22239
22323
  t._element.appendChild(t._trackContent); // WARNING: trackContent is not registered as ElementWrapper's content
22240
22324
 
22241
22325
  t.disableKeyboardInput(false); // Enable keyboard input by default
22242
- Scrollbar._queryNativeTrackThickness(t._dispatch.bind(t, "thicknessChanged"));
22326
+ t._onThicknessChanged = t._dispatch.bind(t, "thicknessChanged");
22327
+ Scrollbar._queryNativeTrackThickness(t._onThicknessChanged);
22243
22328
 
22244
22329
  if(!t._updateEffectiveArea()) {
22245
22330
  t.listen("thicknessChanged", t._updateEffectiveArea);
@@ -22409,6 +22494,12 @@ Scrollbar.prototype._wheelScrolling = "";
22409
22494
  * @ignore
22410
22495
  */
22411
22496
  Scrollbar.prototype._mouseWheelLogic = null;
22497
+ /** @type {Function}
22498
+ * @private
22499
+ * @ignore
22500
+ */
22501
+ Scrollbar.prototype._onThicknessChanged = null;
22502
+
22412
22503
 
22413
22504
  /** @type {number}
22414
22505
  * @private
@@ -22516,6 +22607,7 @@ Scrollbar._retrieveNativeTrackThinkness = function () {
22516
22607
  outer.style.overflow = 'scroll';
22517
22608
  var w2 = inner.offsetWidth;
22518
22609
 
22610
+ // Sometimes, w1 may be equal to w2 on certain browsers or devices, such as a Macbook when opened on the built-in screen. In such cases, the outer.style.overflow scroll may not change the offsetWidth, and the outer.clientWidth will be the same as the inner offsetWidth. As a result, the native track thickness may not be found
22519
22611
  if(w1 == w2) {
22520
22612
  w2 = outer.clientWidth;
22521
22613
  }
@@ -22555,6 +22647,16 @@ Scrollbar.updateTrackThickness = function () {
22555
22647
 
22556
22648
  /** @override */
22557
22649
  Scrollbar.prototype.dispose = function () {
22650
+
22651
+ var sbListeners = Scrollbar._listeners;
22652
+ if(sbListeners) {
22653
+ var idx = sbListeners.indexOf(this._onThicknessChanged);
22654
+ if(idx >= 0 ) {
22655
+ sbListeners.splice(idx, 1);
22656
+ this._onThicknessChanged = null;
22657
+ }
22658
+ }
22659
+
22558
22660
  this.unlistenAll();
22559
22661
  if(this._smoothingId) {
22560
22662
  clearInterval(this._smoothingId);
@@ -24076,10 +24178,18 @@ LayoutGrid.prototype._ctxRows;
24076
24178
  * @private
24077
24179
  */
24078
24180
  LayoutGrid.prototype._boundLayer = null;
24079
- /** @type {Element}
24181
+ /** @type {Array.<Element>}
24182
+ * @private
24183
+ */
24184
+ LayoutGrid.prototype._colBounds = null;
24185
+ /** @type {Array.<Element>}
24080
24186
  * @private
24081
24187
  */
24082
- LayoutGrid.prototype._columnBound = null;
24188
+ LayoutGrid.prototype._colBoundCache = null;
24189
+ /** @type {boolean}
24190
+ * @private
24191
+ */
24192
+ LayoutGrid.prototype._colSelDirty = false;
24083
24193
  /** @type {HScrollbar}
24084
24194
  * @private
24085
24195
  */
@@ -24103,6 +24213,8 @@ LayoutGrid.prototype.dispose = function () {
24103
24213
  }
24104
24214
 
24105
24215
  this._colCount = this._rowCount = this._activeRowEnd = this._availableRowCount = 0;
24216
+ this._colBounds = this._colBoundCache = null;
24217
+ this._colSelDirty = false;
24106
24218
 
24107
24219
  this._highlightedCells.length = 0;
24108
24220
  this._ctx = null;
@@ -26044,16 +26156,15 @@ LayoutGrid.prototype.getContextRow = function (rowIndex) {
26044
26156
  LayoutGrid.prototype.selectColumn = function (colIndex, selected) {
26045
26157
  this.enableColumnClass(colIndex, "selected-column", selected);
26046
26158
 
26047
- var columnBound = this._columnBound;
26048
- if(!columnBound) {
26049
- columnBound = this._columnBound = document.createElement("div");
26050
- columnBound.className = "selection-bound column-bound";
26051
- }
26052
- var boundLayer = this._boundLayer;
26053
- if(!boundLayer) {
26054
- boundLayer = this._boundLayer = document.createElement("div");
26055
- boundLayer.className = "cover-layer";
26056
- this._updateLayers();
26159
+ if(selected) {
26160
+ this._colSelDirty = true;
26161
+
26162
+ var boundLayer = this._boundLayer;
26163
+ if(!boundLayer) {
26164
+ boundLayer = this._boundLayer = document.createElement("div");
26165
+ boundLayer.className = "cover-layer";
26166
+ this._updateLayers();
26167
+ }
26057
26168
  }
26058
26169
  };
26059
26170
  /** @public
@@ -26156,24 +26267,56 @@ LayoutGrid.prototype.calculateColumnBounds = function (lftIdx, rgtIdx, outPositi
26156
26267
  };
26157
26268
  /** @public
26158
26269
  * @ignore
26159
- * @param {!Array.<number>} positions Left and right bound positions in pixel
26160
- * @param {!Array.<boolean>} noBorders Boolean values indicating existence of left and right CSS borders
26270
+ * @param {!Array.<Array>} posAry Left and right bound positions in pixel
26271
+ * @param {!Array.<Array>} noBorderAry Boolean values indicating existence of left and right CSS borders
26161
26272
  * @param {number=} topPx Top position of bound
26162
26273
  */
26163
- LayoutGrid.prototype.updateColumnBounds = function (positions, noBorders, topPx) {
26164
- var columnBound = this._columnBound;
26165
- if(!columnBound) {
26274
+ LayoutGrid.prototype.updateColumnBounds = function (posAry, noBorderAry, topPx) {
26275
+ if(!this._colSelDirty) {
26166
26276
  return;
26167
26277
  }
26168
26278
 
26169
- var lftPx = positions[0];
26170
- var rgtPx = positions[1];
26171
- if(lftPx >= rgtPx) {
26172
- var pn = columnBound.parentNode;
26279
+ var cbs = this._colBounds;
26280
+ var cbc = this._colBoundCache;
26281
+ if(!cbs) {
26282
+ cbs = this._colBounds = [];
26283
+ }
26284
+ if(!cbc) {
26285
+ cbc = this._colBoundCache = [];
26286
+ }
26287
+
26288
+ var rangeCount = posAry.length;
26289
+ var i;
26290
+ var pn = null; // parentNode
26291
+ var columnBound = null;
26292
+
26293
+ // Remove unused bounds from document
26294
+ var activeCount = cbs.length;
26295
+ for(i = rangeCount; i < activeCount; ++i) {
26296
+ columnBound = cbs[i];
26297
+ pn = columnBound.parentNode;
26173
26298
  if(pn) {
26174
26299
  pn.removeChild(columnBound);
26175
26300
  }
26176
- } else {
26301
+ }
26302
+ cbs.length = activeCount = rangeCount;
26303
+
26304
+ if(!rangeCount) {
26305
+ this._colSelDirty = false;
26306
+ return;
26307
+ }
26308
+
26309
+ for(i = 0; i < rangeCount; ++i) {
26310
+ var positions = posAry[i];
26311
+ var noBorders = noBorderAry[i];
26312
+ var lftPx = /** @type{number} */(positions[0]);
26313
+ var rgtPx = /** @type{number} */(positions[1]);
26314
+
26315
+ columnBound = cbc[i];
26316
+ if(!columnBound) {
26317
+ columnBound = cbc[i] = document.createElement("div");
26318
+ columnBound.className = "selection-bound column-bound";
26319
+ }
26177
26320
  columnBound.style.left = lftPx + "px";
26178
26321
  columnBound.style.width = (rgtPx - lftPx) + "px";
26179
26322
 
@@ -26183,7 +26326,10 @@ LayoutGrid.prototype.updateColumnBounds = function (positions, noBorders, topPx)
26183
26326
  columnBound.classList.toggle("no-left-bound", noBorders[0]);
26184
26327
  columnBound.classList.toggle("no-right-bound", noBorders[1]);
26185
26328
  if(this._boundLayer) {
26186
- this._boundLayer.appendChild(columnBound);
26329
+ if(!cbs[i]) {
26330
+ cbs[i] = columnBound;
26331
+ this._boundLayer.appendChild(columnBound);
26332
+ }
26187
26333
  }
26188
26334
  }
26189
26335
  };
@@ -33691,10 +33837,18 @@ VirtualizedLayoutGrid.prototype._selectionList = null;
33691
33837
  * @private
33692
33838
  */
33693
33839
  VirtualizedLayoutGrid.prototype._reverter = null;
33694
- /** @type {Element}
33840
+ /** @type {Array.<Element>}
33841
+ * @private
33842
+ */
33843
+ VirtualizedLayoutGrid.prototype._rowBounds = null;
33844
+ /** @type {Array.<Element>}
33845
+ * @private
33846
+ */
33847
+ VirtualizedLayoutGrid.prototype._rowBoundCache = null;
33848
+ /** @type {boolean}
33695
33849
  * @private
33696
33850
  */
33697
- VirtualizedLayoutGrid.prototype._rowBound = null;
33851
+ VirtualizedLayoutGrid.prototype._rowSelDirty = false;
33698
33852
  /** @type {Element}
33699
33853
  * @private
33700
33854
  */
@@ -33760,6 +33914,9 @@ VirtualizedLayoutGrid.prototype.dispose = function () {
33760
33914
  this._grid.dispose();
33761
33915
  this._dispose();
33762
33916
  this._reverter.dispose();
33917
+
33918
+ this._rowBounds = this._rowBoundCache = null;
33919
+ this._rowSelDirty = false;
33763
33920
  if(this._rowBoundTimer) {
33764
33921
  clearTimeout(this._rowBoundTimer);
33765
33922
  this._rowBoundTimer = 0;
@@ -34211,9 +34368,10 @@ VirtualizedLayoutGrid.prototype.setSelectedRow = function (rowIndex, opt_selecte
34211
34368
  this._grid.setSelectedRow(rowIndex - this._firstIndex, selected);
34212
34369
 
34213
34370
  if(selected) {
34214
- this._initRowBounds();
34371
+ this._rowSelDirty = true;
34372
+ this._initBoundLayer();
34215
34373
  }
34216
- this._updateRowBounds();
34374
+ this._requestUpdatingRowBounds();
34217
34375
  };
34218
34376
 
34219
34377
  /** @inheritDoc */
@@ -34226,14 +34384,15 @@ VirtualizedLayoutGrid.prototype.selectSingleRow = function (rowIndex) {
34226
34384
  VirtualizedLayoutGrid.prototype.selectRowRange = function (rowIndex, length) {
34227
34385
  this._selectionList.selectRange(rowIndex, length);
34228
34386
  this._updateRowSelection();
34229
- this._initRowBounds();
34230
- this._updateRowBounds();
34387
+ this._rowSelDirty = true;
34388
+ this._initBoundLayer();
34389
+ this._requestUpdatingRowBounds();
34231
34390
  };
34232
34391
  /** @inheritDoc */
34233
34392
  VirtualizedLayoutGrid.prototype.clearSelectedRows = function () {
34234
34393
  var count = this._selectionList.clearAllSelections();
34235
34394
  this._grid.clearSelectedRows();
34236
- this._updateRowBounds();
34395
+ this._requestUpdatingRowBounds(); // WARNING: Row bounds are not removed from the document immediately
34237
34396
  return count;
34238
34397
  };
34239
34398
  /** @inheritDoc */
@@ -34675,12 +34834,12 @@ VirtualizedLayoutGrid.prototype._updateCellBounds = function () {
34675
34834
  };
34676
34835
  /** @public
34677
34836
  * @ignore
34678
- * @param {!Array.<number>} positions Left and right bound positions in pixel
34679
- * @param {!Array.<boolean>} noBorders Boolean values indicating existence of left and right CSS borders
34837
+ * @param {!Array.<Array>} posAry Left and right bound positions in pixel
34838
+ * @param {!Array.<Array>} noBorderAry Boolean values indicating existence of left and right CSS borders
34680
34839
  * @param {number=} topPx Top position of bound
34681
34840
  */
34682
- VirtualizedLayoutGrid.prototype.updateColumnBounds = function (positions, noBorders, topPx) {
34683
- this._grid.updateColumnBounds(positions, noBorders, topPx);
34841
+ VirtualizedLayoutGrid.prototype.updateColumnBounds = function (posAry, noBorderAry, topPx) {
34842
+ this._grid.updateColumnBounds(posAry, noBorderAry, topPx);
34684
34843
  this._updateRowBounds();
34685
34844
  };
34686
34845
  /** @private
@@ -34695,16 +34854,6 @@ VirtualizedLayoutGrid.prototype._initBoundLayer = function () {
34695
34854
  };
34696
34855
  /** @private
34697
34856
  */
34698
- VirtualizedLayoutGrid.prototype._initRowBounds = function () {
34699
- var rowBound = this._rowBound;
34700
- if(!rowBound) {
34701
- rowBound = this._rowBound = document.createElement("div");
34702
- rowBound.className = "selection-bound";
34703
- }
34704
- this._initBoundLayer();
34705
- };
34706
- /** @private
34707
- */
34708
34857
  VirtualizedLayoutGrid.prototype._requestUpdatingRowBounds = function () {
34709
34858
  if(!this._rowBoundTimer) {
34710
34859
  this._rowBoundTimer = setTimeout(this._updateRowBounds, 10);
@@ -34716,54 +34865,88 @@ VirtualizedLayoutGrid.prototype._updateRowBounds = function () {
34716
34865
  this._rowBoundTimer = 0;
34717
34866
  this._updateCellBounds();
34718
34867
 
34719
- var rowBound = this._rowBound;
34720
- if(!rowBound) {
34868
+ if(!this._rowSelDirty) {
34721
34869
  return;
34722
34870
  }
34723
- var topIdx = this.getFirstSelectedRow();
34724
- var btmIdx = -1; // Inclusive
34725
- var topPx = 0;
34726
- var btmPx = 0;
34727
- var rowCount = this._layoutY.getLaneCount();
34728
- if(topIdx >= rowCount) {
34729
- topIdx = rowCount - 1;
34871
+ var rbs = this._rowBounds;
34872
+ var rbc = this._rowBoundCache;
34873
+ if(!rbs) {
34874
+ rbs = this._rowBounds = [];
34730
34875
  }
34731
- if(topIdx >= 0) {
34732
- btmIdx = this.getLastSelectedRow();
34733
- if(btmIdx >= rowCount) {
34734
- btmIdx = rowCount - 1;
34735
- }
34736
- topPx = this._layoutY.getLaneStart(topIdx);
34737
- btmPx = this._layoutY.getLaneEnd(btmIdx);
34876
+ if(!rbc) {
34877
+ rbc = this._rowBoundCache = [];
34738
34878
  }
34739
34879
 
34740
- if(topPx >= btmPx) {
34741
- var pn = rowBound.parentNode;
34880
+ var selList = this._selectionList;
34881
+ var rowCount = this._layoutY.getLaneCount();
34882
+ selList.deselectFrom(rowCount); // TODO: move this to setRowCount
34883
+
34884
+ var selRanges = selList.getConnectedRanges();
34885
+ var rangeCount = selRanges.length;
34886
+ var i;
34887
+ var pn = null; // parentNode
34888
+ var rowBound = null;
34889
+
34890
+ // Remove unused bounds from document
34891
+ var activeCount = rbs.length;
34892
+ for(i = rangeCount; i < activeCount; ++i) {
34893
+ rowBound = rbs[i];
34894
+ pn = rowBound.parentNode;
34742
34895
  if(pn) {
34743
34896
  pn.removeChild(rowBound);
34744
34897
  }
34745
- } else {
34898
+ }
34899
+ rbs.length = activeCount = rangeCount;
34900
+
34901
+ if(!rangeCount) {
34902
+ var selCount = selList.getSelectionCount();
34903
+ if(!selCount) {
34904
+ this._rowSelDirty = false;
34905
+ }
34906
+ return;
34907
+ }
34908
+
34909
+ // Prepare shared parameters
34910
+ var scrollLeft = 0;
34911
+ var pinnedLftCount = 0;
34912
+ var pinnedRgtCount = 0;
34913
+ var endOfScroll = false;
34914
+ if(this._hscrollbar) {
34915
+ scrollLeft = this._hscrollbar.getScrollLeft();
34916
+ pinnedLftCount = this._hscrollbar.getPinnedLeftColumnCount();
34917
+ pinnedRgtCount = this._hscrollbar.getPinnedRightColumnCount();
34918
+ endOfScroll = this._hscrollbar.isEndOfHorizontalScroll();
34919
+ }
34920
+ var noLeftBound = !pinnedLftCount && scrollLeft > 0;
34921
+ var noRightBound = !pinnedRgtCount && !endOfScroll;
34922
+ var boundWidth = this._grid._getViewSize();
34923
+
34924
+ // Create row bound elements based on number of selection ranges
34925
+ for(i = 0; i < rangeCount; ++i) {
34926
+ var pair = selRanges[i];
34927
+ var topIdx = pair[0];
34928
+ var btmIdx = pair[1]; // Inclusive
34929
+ var topPx = this._layoutY.getLaneStart(topIdx);
34930
+ var btmPx = this._layoutY.getLaneEnd(btmIdx);
34931
+
34932
+ rowBound = rbc[i];
34933
+ if(!rowBound) {
34934
+ rowBound = rbc[i] = document.createElement("div");
34935
+ rowBound.className = "selection-bound";
34936
+ }
34937
+
34746
34938
  rowBound.style.top = topPx + "px";
34747
34939
  rowBound.style.height = (btmPx - topPx) + "px";
34748
-
34749
- var boundWidth = this._grid._getViewSize();
34750
34940
  rowBound.style.width = boundWidth + "px";
34751
34941
 
34752
- var scrollLeft = 0;
34753
- var pinnedLftCount = 0;
34754
- var pinnedRgtCount = 0;
34755
- var endOfScroll = false;
34756
- if(this._hscrollbar) {
34757
- scrollLeft = this._hscrollbar.getScrollLeft();
34758
- pinnedLftCount = this._hscrollbar.getPinnedLeftColumnCount();
34759
- pinnedRgtCount = this._hscrollbar.getPinnedRightColumnCount();
34760
- endOfScroll = this._hscrollbar.isEndOfHorizontalScroll();
34761
- }
34762
- rowBound.classList.toggle("no-left-bound", !pinnedLftCount && scrollLeft > 0);
34763
- rowBound.classList.toggle("no-right-bound", !pinnedRgtCount && !endOfScroll);
34942
+ rowBound.classList.toggle("no-left-bound", noLeftBound);
34943
+ rowBound.classList.toggle("no-right-bound", noRightBound);
34764
34944
 
34765
34945
  if(this._boundLayer) {
34766
- this._boundLayer.appendChild(rowBound);
34946
+ if(!rbs[i]) {
34947
+ rbs[i] = rowBound;
34948
+ this._boundLayer.appendChild(rowBound);
34949
+ }
34767
34950
  }
34768
34951
  }
34769
34952
  };
@@ -35408,7 +35591,7 @@ Core.prototype._groupDefs = null;
35408
35591
  * @return {string}
35409
35592
  */
35410
35593
  Core.getVersion = function () {
35411
- return "5.1.39";
35594
+ return "5.1.41";
35412
35595
  };
35413
35596
  /** {@link ElementWrapper#dispose}
35414
35597
  * @override
@@ -38934,47 +39117,72 @@ Core.prototype._updateColumnBounds = function () {
38934
39117
  return;
38935
39118
  }
38936
39119
 
39120
+ var sectCount = this._settings.length;
39121
+ if(!sectCount) {
39122
+ return;
39123
+ }
39124
+
39125
+ // Collecting column selection and selection ranges
39126
+ var selRanges = [];
39127
+ var pair = null;
38937
39128
  var colCount = this.getColumnCount();
38938
- var colIndices = [];
39129
+ var selIndices = [];
38939
39130
  var i;
38940
39131
  for(i = 0; i < colCount; i++) {
38941
39132
  if(this.isSelectedColumn(i)) {
38942
- colIndices.push(i);
39133
+ selIndices.push(i);
39134
+ if(!pair) {
39135
+ pair = [i, -1];
39136
+ }
39137
+ } else if(pair) {
39138
+ pair[1] = i - 1;
39139
+ selRanges.push(pair);
39140
+ pair = null;
38943
39141
  }
38944
39142
  }
39143
+ if(pair) {
39144
+ pair[1] = colCount - 1;
39145
+ selRanges.push(pair);
39146
+ pair = null;
39147
+ }
39148
+
38945
39149
  var arg = {
38946
- selectedColumns: colIndices
39150
+ "selectedColumns": selIndices,
39151
+ "selectionRanges": selRanges
38947
39152
  };
38948
39153
  this._dispatch("beforeColumnBoundUpdate", arg);
38949
39154
 
38950
- var len = this.getColumnCount();
38951
- var lftIdx = -1;
38952
- var rgtIdx = -1;
38953
- for(i = 0; i < len; ++i) {
38954
- if(this.isSelectedColumn(i)) {
38955
- rgtIdx = i;
38956
- if(lftIdx < 0) {
38957
- lftIdx = i;
38958
- }
38959
- }
38960
- }
38961
- var sectCount = this._settings.length;
38962
- if(sectCount) {
38963
- var sectionSetting = this._settings[0];
38964
- var section = sectionSetting.getSection();
39155
+ // Calculate position from ranges
39156
+ var rangeCount = selRanges.length;
39157
+ var posAry = [];
39158
+ var noBorderAry = [];
39159
+ var topSectionSettings = this._settings[0];
39160
+ var section = topSectionSettings.getSection();
39161
+ for(i = 0; i < rangeCount; ++i) {
39162
+ pair = selRanges[i];
38965
39163
  var positions = [0, 0];
38966
39164
  var noBorders = [false, false];
38967
- section.calculateColumnBounds(lftIdx, rgtIdx, positions, noBorders);
38968
- var topPx = 0;
38969
- if(sectionSetting.getType() === "title" && arg.topBoundRowIndex != null) {
38970
- topPx = this._layoutY.getLaneStart(arg.topBoundRowIndex);
38971
- }
38972
- section.updateColumnBounds(positions, noBorders, topPx);
38973
- for(i = 1; i < sectCount; i++) {
38974
- section = this._settings[i].getSection();
38975
- section.updateColumnBounds(positions, noBorders);
39165
+ section.calculateColumnBounds(pair[0], pair[1], positions, noBorders);
39166
+ if(positions[0] < positions[1]) {
39167
+ posAry.push(positions);
39168
+ noBorderAry.push(noBorders);
38976
39169
  }
38977
39170
  }
39171
+
39172
+ // Render column bounds
39173
+ var topPx = 0;
39174
+ var topBoundIdx = -1;
39175
+ if(arg["topBoundRowIndex"] != null) {
39176
+ topBoundIdx = +arg["topBoundRowIndex"];
39177
+ }
39178
+ if(topBoundIdx >= 0 && topSectionSettings.getType() === "title") {
39179
+ topPx = this._layoutY.getLaneStart(topBoundIdx);
39180
+ }
39181
+ section.updateColumnBounds(posAry, noBorderAry, topPx);
39182
+ for(i = 1; i < sectCount; i++) {
39183
+ section = this._settings[i].getSection();
39184
+ section.updateColumnBounds(posAry, noBorderAry);
39185
+ }
38978
39186
  };
38979
39187
 
38980
39188
  /** @public
@@ -45349,7 +45557,7 @@ Grid.prototype.removeRow = function(rowRef) {
45349
45557
  if(this._mainGrid) {
45350
45558
  return this._mainGrid.removeRow(this._getRowId(rowRef));
45351
45559
  }
45352
- var rowDef = this._getRowDefinition(rowRef);
45560
+ var rowDef = this._getRowDefinitionByRef(rowRef);
45353
45561
  if(rowDef) {
45354
45562
  if(!rowDef.isAutoGenerated()) { // Users cannot remove auto-generated row by themselves
45355
45563
  this._removeRow(rowDef);
@@ -45380,7 +45588,7 @@ Grid.prototype.removeRows = function(rowRefs) {
45380
45588
 
45381
45589
  // Verify user input
45382
45590
  for(i = 0; i < len; ++i) {
45383
- rowDef = this._getRowDefinition(rowRefs[i]);
45591
+ rowDef = this._getRowDefinitionByRef(rowRefs[i]);
45384
45592
  if(rowDef) {
45385
45593
  if(!rowDef.isAutoGenerated()) {
45386
45594
  rowDefs.push(rowDef);
@@ -45516,7 +45724,7 @@ Grid.prototype.setRic = function(rowRef, str, options) {
45516
45724
  this._mainGrid.setRic(this._toRowId(rowRef), str);
45517
45725
  return;
45518
45726
  }
45519
- var rowDef = this._getRowDefinition(rowRef);
45727
+ var rowDef = this._getRowDefinitionByRef(rowRef);
45520
45728
  if(rowDef) {
45521
45729
  options = options || {};
45522
45730
  var newChain = false;
@@ -45551,7 +45759,7 @@ Grid.prototype.setRic = function(rowRef, str, options) {
45551
45759
  * @param {Grid~RowReference} rowRef
45552
45760
  */
45553
45761
  Grid.prototype.unlinkChain = function(rowRef) {
45554
- var rowDef = this._getRowDefinition(rowRef);
45762
+ var rowDef = this._getRowDefinitionByRef(rowRef);
45555
45763
  if(!rowDef) {
45556
45764
  return;
45557
45765
  }
@@ -45730,7 +45938,8 @@ Grid.prototype.getRowType = function(rowRef) {
45730
45938
  var rowDef = this.getRowDefinition(rowRef);
45731
45939
  return rowDef ? rowDef.getType() : "";
45732
45940
  };
45733
- /** @public
45941
+ /** Get RowDefinition object by either number or row id
45942
+ * @public
45734
45943
  * @param {number|string} rowRef Row index as shown in the view or row id (string)
45735
45944
  * @return {RowDefinition}
45736
45945
  */
@@ -45760,7 +45969,7 @@ Grid.prototype._getRowDefinitionById = function(rowId) {
45760
45969
  * @param {Grid~RowReference} rowRef
45761
45970
  * @return {RowDefinition}
45762
45971
  */
45763
- Grid.prototype._getRowDefinition = function(rowRef) {
45972
+ Grid.prototype._getRowDefinitionByRef = function(rowRef) {
45764
45973
  if(rowRef instanceof RowDefinition) {
45765
45974
  if(rowRef.getRowId()) { // The row may have been removed from the grid
45766
45975
  return /** @type{!RowDefinition} */(rowRef);
@@ -45864,7 +46073,7 @@ Grid.prototype.setRicData = function(ric, values) {
45864
46073
  * @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
45865
46074
  */
45866
46075
  Grid.prototype.setRowData = function(rowRef, values) {
45867
- var rowDef = this._getRowDefinition(rowRef);
46076
+ var rowDef = this._getRowDefinitionByRef(rowRef);
45868
46077
  if(rowDef) {
45869
46078
  rowDef.setRowData(values);
45870
46079
  }
@@ -45876,7 +46085,7 @@ Grid.prototype.setRowData = function(rowRef, values) {
45876
46085
  * @param {Object} values
45877
46086
  */
45878
46087
  Grid.prototype.setStaticRowData = function(rowRef, values) {
45879
- var rowDef = this._getRowDefinition(rowRef);
46088
+ var rowDef = this._getRowDefinitionByRef(rowRef);
45880
46089
  if(rowDef) {
45881
46090
  rowDef.setStaticRowData(values);
45882
46091
  }
@@ -45889,7 +46098,7 @@ Grid.prototype.setStaticRowData = function(rowRef, values) {
45889
46098
  * @param {*} value
45890
46099
  */
45891
46100
  Grid.prototype.setStaticData = function(rowRef, field, value) {
45892
- var rowDef = this._getRowDefinition(rowRef);
46101
+ var rowDef = this._getRowDefinitionByRef(rowRef);
45893
46102
  if(rowDef) {
45894
46103
  rowDef.setStaticData(field, value);
45895
46104
  }
@@ -46239,7 +46448,7 @@ Grid.prototype._onDataChanged = function(e) {
46239
46448
  // The new data update has no row definition, meaning that we have found a new constituent from a chain.
46240
46449
  var subId = rowData[SUB_ID]; // The constituent will share the same sub id as its parent
46241
46450
  if(subId) {
46242
- var parentDef = this._getRowDefinition(subId);
46451
+ var parentDef = this._getRowDefinitionById(subId);
46243
46452
  if(parentDef && parentDef.getRic() !== rowData["RIC"]) { // TODO: Check for delayed ric
46244
46453
  if(!this._chainMembers) {
46245
46454
  this._chainMembers = {};
@@ -46271,7 +46480,7 @@ Grid.prototype._addMemberOfChain = function(rowData) {
46271
46480
  for(i = 0; i < len; ++i) {
46272
46481
  rowData = /** @type{!Object} */(rows[i]);
46273
46482
  var subId = rowData[SUB_ID];
46274
- var parentDef = this._getRowDefinition(subId);
46483
+ var parentDef = this._getRowDefinitionById(subId);
46275
46484
  if(parentDef) {
46276
46485
  var childDef = parentDef.addConstituent(/** @type{string} */(rowData["RIC"]), this._dt);
46277
46486
  if(childDef) {
@@ -46417,7 +46626,7 @@ Grid.prototype.getPageCount = function() {
46417
46626
  * @param {Grid~RowReference} rowRef
46418
46627
  */
46419
46628
  Grid.prototype.toggleChain = function(rowRef) {
46420
- var rowDef = this._getRowDefinition(rowRef);
46629
+ var rowDef = this._getRowDefinitionByRef(rowRef);
46421
46630
  if(rowDef) {
46422
46631
  rowDef.toggleChain();
46423
46632
  }
@@ -46429,7 +46638,7 @@ Grid.prototype.toggleChain = function(rowRef) {
46429
46638
  * @return {boolean}
46430
46639
  */
46431
46640
  Grid.prototype.setClassification = function(rowRef, fields) {
46432
- var rowDef = this._getRowDefinition(rowRef);
46641
+ var rowDef = this._getRowDefinitionByRef(rowRef);
46433
46642
  if(rowDef) {
46434
46643
  return this._dt.setSegmentClassification(rowDef.getRowId(), fields);
46435
46644
  }
@@ -48163,7 +48372,9 @@ MockSubscription.prototype._getUpdateData = function(ric) {
48163
48372
 
48164
48373
 
48165
48374
  // CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/jet/CollectionDict.js
48166
- /** @constructor */
48375
+ /** @description CollectionDict stores a collection (Array) of any value using a text (string) as a key for accessing the collection.
48376
+ * @constructor
48377
+ */
48167
48378
  var CollectionDict = function() {
48168
48379
  this._dict = {};
48169
48380
  };
@@ -48290,9 +48501,17 @@ CollectionDict.prototype.getAllItems = function() {
48290
48501
  return null;
48291
48502
  };
48292
48503
  /** @public
48504
+ * @param {string=} key
48293
48505
  * @return {number}
48294
48506
  */
48295
- CollectionDict.prototype.getItemCount = function() {
48507
+ CollectionDict.prototype.getItemCount = function(key) {
48508
+ if(key) {
48509
+ var items = this._dict[key] || null;
48510
+ if(items) {
48511
+ return items.length;
48512
+ }
48513
+ return 0;
48514
+ }
48296
48515
  return this._count;
48297
48516
  };
48298
48517
  /** @public
@@ -48525,6 +48744,7 @@ MockSubscriptions.prototype.removeSubscription = function(subId) {
48525
48744
  child["parent"] = null;
48526
48745
  }
48527
48746
  sub["children"] = null;
48747
+ sub["ricList"] = null;
48528
48748
  }
48529
48749
  };
48530
48750
  /** @public
@@ -48591,9 +48811,9 @@ MockSubscriptions.prototype.start = function() {
48591
48811
  /** @public */
48592
48812
  MockSubscriptions.prototype.stop = function() {
48593
48813
  this._working = false;
48594
- if(this._timerId >= 0) {
48814
+ if(this._timerId) {
48595
48815
  window.clearTimeout(this._timerId);
48596
- this._timerId = -1;
48816
+ this._timerId = 0;
48597
48817
  }
48598
48818
  };
48599
48819
 
@@ -48726,26 +48946,55 @@ MockSubscriptions.prototype._addSymbol = function(ric, asChain, subId) {
48726
48946
  sub["ric"] = ric;
48727
48947
  sub["chain"] = asChain;
48728
48948
  sub["id"] = subId;
48729
- sub["dataId"] = subId + sub["ric"];
48949
+ sub["dataId"] = subId + ric;
48730
48950
  this._subMap[subId] = sub; // Collect all user subscriptions
48731
- this._dataMap.addItem(sub["ric"], sub);
48951
+ this._dataMap.addItem(ric, sub);
48952
+ var subs = this._dataMap.getItems(ric);
48953
+ var subCount = subs.length;
48954
+
48955
+ this._dispatch("subscriptionAdded", {"subs": [sub]});
48956
+
48957
+ var childSub = null;
48958
+ var childCount = 0;
48959
+ var i;
48732
48960
  if(asChain) {
48733
- sub["children"] = [];
48734
- var childCount = MockSubscriptions.simpleDigest(ric) % 10 + 4;
48735
- for(var i = 0; i < childCount; ++i) {
48736
- // Note that constituents should have no subscription object. They should share the same subscription as their parent. Hence we does not register it to the _subMap
48737
- var childSub = {};
48738
- childSub["ric"] = "Child_" + String.fromCharCode(65 + i);
48739
- childSub["id"] = subId; // Child shares the same sub id as its chain parent
48740
- childSub["dataId"] = subId + childSub["ric"];
48741
- childSub["parent"] = sub; // This does not exist in real subscription
48742
- sub["children"].push(childSub);
48961
+ // Note that constituents should have no subscription object. They should share the same subscription as their parent. Hence we does not register it to the _subMap
48962
+ if(subCount === 1) { // The first chain detected
48963
+ sub["children"] = [];
48964
+ childCount = MockSubscriptions.simpleDigest(ric) % 10 + 4;
48965
+ for(i = 0; i < childCount; ++i) {
48966
+ childSub = {};
48967
+ childSub["ric"] = "Child_" + String.fromCharCode(65 + i);
48968
+ childSub["id"] = subId; // Child shares the same sub id as its chain parent
48969
+ childSub["dataId"] = subId + childSub["ric"];
48970
+ childSub["parent"] = sub; // This does not exist in real subscription
48971
+ sub["children"].push(childSub);
48972
+
48973
+ this._dataMap.addItem(_joinSubKeys(sub, childSub), childSub);
48974
+ }
48975
+ } else {
48976
+ var firstSub = subs[0];
48977
+ var constituents = firstSub["children"];
48978
+ childCount = constituents.length;
48979
+ sub["children"] = new Array(childCount);
48980
+
48981
+ for(i = 0; i < childCount; ++i) {
48982
+ childSub = {};
48983
+ childSub["ric"] = constituents[i]["ric"];
48984
+ childSub["id"] = subId; // Child shares the same sub id as its chain parent
48985
+ childSub["dataId"] = subId + childSub["ric"];
48986
+ childSub["parent"] = sub; // This does not exist in real subscription
48987
+ sub["children"][i] = childSub;
48743
48988
 
48744
- this._dataMap.addItem(_joinSubKeys(sub, childSub), childSub);
48989
+ this._dataMap.addItem(_joinSubKeys(sub, childSub), childSub);
48990
+ }
48991
+ }
48992
+ }
48993
+ if(subCount > 1) { // Duplicate RIC/CHAIN detected
48994
+ if(this._working) {
48995
+ setTimeout(this._updateDuplicateSymbol.bind(this, ric), 10);
48745
48996
  }
48746
48997
  }
48747
-
48748
- this._dispatch("subscriptionAdded", {"subs": [sub]});
48749
48998
 
48750
48999
  this._connect();
48751
49000
  return subId;
@@ -48765,14 +49014,15 @@ MockSubscriptions.simpleDigest = function(str) {
48765
49014
 
48766
49015
  /** @private */
48767
49016
  MockSubscriptions.prototype._connect = function() {
48768
- if(!this._working || this._timerId >= 0) { return; }
48769
- var delay = this._dataGen.randInt(this._minInterval, this._maxInterval);
48770
- this._timerId = window.setTimeout(this._onSubscriptionResponse, delay);
49017
+ if(this._working && !this._timerId) {
49018
+ var delay = this._dataGen.randInt(this._minInterval, this._maxInterval);
49019
+ this._timerId = window.setTimeout(this._onSubscriptionResponse, delay);
49020
+ }
48771
49021
  };
48772
49022
 
48773
49023
  /** @private */
48774
49024
  MockSubscriptions.prototype._onSubscriptionResponse = function() {
48775
- this._timerId = -1;
49025
+ this._timerId = 0;
48776
49026
 
48777
49027
  var keys = this._dataMap.getAllKeys(); // list of all rics
48778
49028
  var len = keys ? keys.length : 0;
@@ -48786,34 +49036,14 @@ MockSubscriptions.prototype._onSubscriptionResponse = function() {
48786
49036
  var maxRow = (this._percentageDataUpdate + 0.02) * len;
48787
49037
  maxRow = maxRow < len ? maxRow : len; // not more than all rows
48788
49038
  var numRows = this._dataGen.randInt(minRow, maxRow);
49039
+ var fields = this._fields;
48789
49040
 
48790
49041
  for(var i = 0; i < numRows; i++) {
48791
49042
  var key = keys[this._dataGen.randIndex(len)]; // WARNING: Same sub could be picked more than once
48792
- var subs = this._dataMap.getItems(key);
49043
+ var subs = this._dataMap.getItems(key); // Get all subs with the same RIC
48793
49044
 
48794
- var sub = subs[0];
48795
- var ric = sub.ric;
48796
- var prevData = sub.prevData;
48797
-
48798
- var values = {};
48799
- var options = {
48800
- text: ric,
48801
- prefix: sub["parent"] ? sub["parent"]["ric"] : ""
48802
- };
48803
- for(var field in this._fields){
48804
- var data = this._dataGen.generateQuoteData(field, options);
48805
- if(prevData) {
48806
- if(data.changeOnly) {
48807
- if(prevData[field] === data.value) {
48808
- continue;
48809
- }
48810
- }
48811
- prevData[field] = data.value;
48812
- }
48813
-
48814
- values[field] = data.value;
48815
- values[field + "_FORMATTED"] = data.formattedValue;
48816
- }
49045
+ var sub = subs[0]; // Only the first sub is need to generate data
49046
+ var values = this._generateQuoteData(sub, fields);
48817
49047
 
48818
49048
  var jLen = subs.length;
48819
49049
  for(var j = 0; j < jLen; ++j) {
@@ -48825,6 +49055,109 @@ MockSubscriptions.prototype._onSubscriptionResponse = function() {
48825
49055
  };
48826
49056
  /** @private
48827
49057
  * @param {Object} sub
49058
+ * @param {Object} fields
49059
+ * @return {!Object}
49060
+ */
49061
+ MockSubscriptions.prototype._generateQuoteData = function(sub, fields) {
49062
+ var ric = sub.ric;
49063
+ var prevData = sub.prevData;
49064
+
49065
+ var values = {};
49066
+ var options = {
49067
+ text: ric,
49068
+ prefix: sub["parent"] ? sub["parent"]["ric"] : "" // prefix for constituents
49069
+ };
49070
+ for(var field in fields){
49071
+ var data = this._dataGen.generateQuoteData(field, options);
49072
+ var formattedField = field + "_FORMATTED";
49073
+ if(prevData) {
49074
+ if(data.changeOnly) {
49075
+ if(prevData[field] === data.value) {
49076
+ continue;
49077
+ }
49078
+ }
49079
+ prevData[field] = data.value;
49080
+ prevData[formattedField] = data.formattedValue;
49081
+ }
49082
+
49083
+ values[field] = data.value;
49084
+ values[formattedField] = data.formattedValue;
49085
+ }
49086
+ return values;
49087
+ };
49088
+
49089
+
49090
+ /** @private
49091
+ * @param {Object} parentSub
49092
+ * @param {string} ric
49093
+ * @return {Object}
49094
+ */
49095
+ MockSubscriptions.prototype._getChildSubByRic = function(parentSub, ric) {
49096
+ var children = parentSub["children"];
49097
+ if(children) {
49098
+ var childCount = children.length;
49099
+ for(var i = 0; i < childCount; ++i) {
49100
+ var child = children[i];
49101
+ if(child["ric"] === ric) {
49102
+ return child;
49103
+ }
49104
+ }
49105
+ }
49106
+ return null;
49107
+ };
49108
+ /** @private
49109
+ * @param {string} ric
49110
+ */
49111
+ MockSubscriptions.prototype._updateDuplicateSymbol = function(ric) {
49112
+ var subs = this._dataMap.getItems(ric);
49113
+ if(!subs) {
49114
+ return;
49115
+ }
49116
+ var subCount = subs.length;
49117
+ if(subCount < 2) {
49118
+ return;
49119
+ }
49120
+ var firstSub = subs[0];
49121
+ var prevData = firstSub["prevData"];
49122
+ var isChain = firstSub["chain"] ? true : false;
49123
+ var i;
49124
+ if(prevData) {
49125
+ for(i = 1; i < subCount; ++i) {
49126
+ var sub = subs[i];
49127
+ if(!sub["prevData"]) {
49128
+ this._dispatchDataChanged(sub, prevData);
49129
+ }
49130
+ }
49131
+ }
49132
+
49133
+
49134
+ if(!isChain) {
49135
+ return;
49136
+ }
49137
+ var ricList = firstSub["ricList"];
49138
+ if(!ricList) {
49139
+ return;
49140
+ }
49141
+ var childCount = ricList.length;
49142
+
49143
+ for(i = 1; i < subCount; ++i) {
49144
+ var sub2 = subs[i];
49145
+ var ricList2 = sub2["ricList"];
49146
+ var childCount2 = ricList2 ? ricList2.length : 0;
49147
+ for(var j = childCount2; j < childCount; ++j) {
49148
+ var childRic = ricList[j];
49149
+ var childSub = this._getChildSubByRic(firstSub, childRic);
49150
+ var childSub2 = this._getChildSubByRic(sub2, childRic);
49151
+ if(childSub && childSub2) {
49152
+ if(childSub["prevData"]) {
49153
+ this._dispatchDataChanged(childSub2, childSub["prevData"]);
49154
+ }
49155
+ }
49156
+ }
49157
+ }
49158
+ };
49159
+ /** @private
49160
+ * @param {Object} sub
48828
49161
  * @param {Object} dataUpdates
48829
49162
  */
48830
49163
  MockSubscriptions.prototype._dispatchDataChanged = function(sub, dataUpdates) {
@@ -48844,6 +49177,15 @@ MockSubscriptions.prototype._dispatchDataChanged = function(sub, dataUpdates) {
48844
49177
  values["STATUS_FORMATTED"] = this._statusMap["1"];
48845
49178
  values["SUB_ID"] = sub["id"];
48846
49179
  copyValues(values, prevData);
49180
+
49181
+ var parentSub = sub.parent;
49182
+ if(parentSub) { // This is the first time constituent have the data
49183
+ var ricList = parentSub["ricList"];
49184
+ if(!ricList) {
49185
+ ricList = parentSub["ricList"] = [];
49186
+ }
49187
+ parentSub["ricList"].push(sub["ric"]);
49188
+ }
48847
49189
  }
48848
49190
  this._dispatch("dataChanged", evtArg);
48849
49191
  };
@@ -48901,7 +49243,7 @@ MockSubscriptions.prototype._working = false;
48901
49243
  /** @type {number}
48902
49244
  * @private
48903
49245
  */
48904
- MockSubscriptions.prototype._timerId = -1;
49246
+ MockSubscriptions.prototype._timerId = 0;
48905
49247
 
48906
49248
  /** @type {number}
48907
49249
  * @private