@refinitiv-ui/efx-grid 6.0.145 → 6.0.147

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.
@@ -2354,7 +2354,7 @@ Grid.prototype._cloneChain = function(newRowDef) {
2354
2354
  "subId": subId
2355
2355
  };
2356
2356
  for (let i = 0; i < count; i++) {
2357
- let childRowDef = constituents[i]; // TODO: the constituents should be sorted by CHILD_ORDER first
2357
+ let childRowDef = constituents[i];
2358
2358
  evtArg["ric"] = childRowDef.getRic();
2359
2359
  evtArg["values"] = childRowDef.cloneRowData();
2360
2360
  evtArg["values"]["SUB_ID"] = subId; // Imitate real-time service responses
@@ -61,6 +61,7 @@ let _fieldInfo = {
61
61
  "PRCTCK_1": {type: "set", members: ["\u21e7", "B\u21e7", "\u2191", "B\u2191", "26", "1", "\"1\"", "-1", "\u21e9", "B\u21e9", "\u2193", "B\u2193", "27", "2", "\"2\""] },
62
62
  "CF_NETCHNG": {type: "number", min: -100, max: 100},
63
63
  "CF_VOLUME": {type: "number", min: 0, max: 1e7},
64
+ "CHILD_ORDER": {type: "set", ignore: true, members: [undefined]}, // eslint-disable-line
64
65
  "RI_FLAG": {type: "set", members: ["R", "Q", "I", "_", ""]},
65
66
  "RI_CODE": {type: "number", min: 0, max: 2},
66
67
  "STATUS": {type: "number", min: 0, max: 6},
@@ -225,8 +226,12 @@ let randBoolean = function(seed) {
225
226
  * @return {*}
226
227
  */
227
228
  let randMember = function(set, seed) {
228
- if(set) {
229
- let index = randIndex(set.length, seed);
229
+ var len = set ? (set.length || 0) : 0;
230
+ if(len) {
231
+ if(len === 1) {
232
+ return set[0];
233
+ }
234
+ let index = randIndex(len, seed);
230
235
  return set[index];
231
236
  }
232
237
  return String.fromCharCode(randInt(65, 90, seed));
@@ -588,48 +588,44 @@ MockSubscriptions.prototype._onSubscriptionResponse = function() {
588
588
  // find key to random subs (key is subId)
589
589
  let key = keys[this._dataGen.randIndex(len)]; // WARNING: Same sub could be picked more than once
590
590
  let subs = this._dataMap.getItems(key); // Get all subs with the same RIC
591
+ let subCount = subs.length;
591
592
 
592
- let sub = subs[0]; // Only the first sub is need to generate data
593
- let values, j, jLen;
594
- let subParent = sub.parent;
593
+ let j;
594
+ let firstSub = subs[0]; // Only the first sub is need to generate data
595
+ let subParent = firstSub.parent;
595
596
  let updatePosition = this._dataGen.randInt(0, 100) < this._percentageOrderChange * 100 ? true : false; // Random chance to change dynamic chain position (2% to change)
596
597
 
597
- if(_isDynamicChain(key) && subParent && updatePosition) { // subParent in header of dynamic chain is behavior like a normal ric
598
+ let values = this._generateQuoteData(firstSub, fields);
599
+ if(_isDynamicChain(key) && subParent && updatePosition) { // subParent in header of dynamic chain behaves like a normal ric
598
600
  let children = subParent.children;
601
+ let childCount = children.length;
599
602
 
600
603
  children = _shuffleArray(children); // Random swap children in array
601
- let childrenLen = children.length;
602
- let subIndex = children.indexOf(sub);
603
- sub["CHILD_ORDER"] = subIndex;
604
-
605
- values = this._generateQuoteData(sub, fields);
606
-
607
- jLen = subs.length;
608
- for(j = 0; j < jLen; ++j) { // It could be same ric and it need to dispatch with same ric number
609
- for (let k = 0; k < childrenLen; k++) {
610
- let child = children[k];
611
- if(subs[j] === child) {
612
- values["CHILD_ORDER"] = child["CHILD_ORDER"];
613
- this._dispatchDataChanged(subs[j], values);
614
- } else {
615
- let currentChild = child["CHILD_ORDER"];
616
- this._dispatchDataChanged(child, {
617
- X_RIC_NAME: child.ric,
618
- CHILD_ORDER: currentChild
604
+ let newOrder = children.indexOf(firstSub);
605
+ firstSub["CHILD_ORDER"] = newOrder; // This is bad
606
+ values["CHILD_ORDER"] = newOrder;
607
+
608
+ childOrderChange = true;
609
+ for(j = 0; j < subCount; ++j) { // It could be same ric and it need to dispatch with same ric number
610
+ this._dispatchDataChanged(subs[j], values);
611
+ // Update child order for all children with the same parent
612
+ for (let k = 0; k < childCount; k++) { // This is not correct, if there is a duplicate dynamic chain
613
+ if(k !== newOrder) {
614
+ this._dispatchDataChanged(children[k], {
615
+ X_RIC_NAME: children[k].ric,
616
+ CHILD_ORDER: k
619
617
  });
620
618
  }
621
619
  }
622
- childOrderChange = true;
623
620
  }
624
-
625
621
  } else {
626
- values = this._generateQuoteData(sub, fields);
627
- jLen = subs.length; // Duplicate ric or chain
628
- for(j = 0; j < jLen; ++j) { // It could be same ric and it need to dispatch with same ric number
629
- let childOrder = subs[j]["CHILD_ORDER"];
622
+ if(subCount > 1) { // Duplicate CHILD_ORDER from the first sub for other sub with the same RIC (not entirely correct)
623
+ let childOrder = firstSub["CHILD_ORDER"];
630
624
  if(childOrder != null) { // Children of chain will have a CHILD_ORDER
631
625
  values["CHILD_ORDER"] = childOrder;
632
626
  }
627
+ }
628
+ for(j = 0; j < subCount; ++j) { // It could be same ric and it need to dispatch with same ric number
633
629
  this._dispatchDataChanged(subs[j], values);
634
630
  updateCount++;
635
631
  }
@@ -672,20 +668,24 @@ MockSubscriptions.prototype._generateQuoteData = function(sub, fields) {
672
668
  prefix: sub["parent"] ? sub["parent"]["ric"] : "" // prefix for constituents
673
669
  };
674
670
  for(let field in fields){
675
- let data = this._dataGen.generateQuoteData(field, options);
671
+ let fInfo = this._dataGen.generateQuoteData(field, options);
672
+ if(fInfo.ignore) {
673
+ continue;
674
+ }
675
+
676
676
  let formattedField = field + "_FORMATTED";
677
677
  if(prevData) {
678
- if(data.changeOnly) {
679
- if(prevData[field] === data.value) {
678
+ if(fInfo.changeOnly) {
679
+ if(prevData[field] === fInfo.value) {
680
680
  continue;
681
681
  }
682
682
  }
683
- prevData[field] = data.value;
684
- prevData[formattedField] = data.formattedValue;
683
+ prevData[field] = fInfo.value;
684
+ prevData[formattedField] = fInfo.formattedValue;
685
685
  }
686
686
 
687
- values[field] = data.value;
688
- values[formattedField] = data.formattedValue;
687
+ values[field] = fInfo.value;
688
+ values[formattedField] = fInfo.formattedValue;
689
689
  }
690
690
 
691
691
  // The delay symbol for X_RIC_NAME will depend on the INDICATOR field.
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.173",
2
+ "tr-grid-util": "1.3.174",
3
3
  "tr-grid-printer": "1.0.18",
4
4
  "@grid/column-dragging": "1.0.21",
5
5
  "@grid/row-segmenting": "2.0.1",
package/package.json CHANGED
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "version": "6.0.145"
72
+ "version": "6.0.147"
73
73
  }