@refinitiv-ui/efx-grid 6.0.127 → 6.0.129

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.
@@ -31,7 +31,7 @@ DataConnector.prototype._fieldChangedConflator = null;
31
31
  * @private
32
32
  */
33
33
  DataConnector.prototype._ricChangedConflator = null;
34
- /** @type {Object.<string, RowDefinition>}
34
+ /** @type {Object.<string, Array.<RowDefinition>>}
35
35
  * @private
36
36
  */
37
37
  DataConnector.prototype._rowDefMap = null;
@@ -524,6 +524,10 @@ Grid.prototype._formulaConflator = null;
524
524
  */
525
525
  Grid.prototype._chainConflator = null;
526
526
  /** @private
527
+ * @type {Object}
528
+ */
529
+ Grid.prototype._constituentMap = null;
530
+ /** @private
527
531
  * @type {number}
528
532
  */
529
533
  Grid.prototype._clientWidth = NaN;
@@ -2370,10 +2374,10 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
2370
2374
  }
2371
2375
  }
2372
2376
  let rowDef = new RowDefinition(rowOption);
2377
+ rowDef.registerToView(this._dv, this._getRowId(rowRef));
2373
2378
  rowDef.setDataSource(this._dc, this._subs); // This could also subscribe chain index/ric to JET/RTK
2374
2379
  this._initDuplicateRicData(rowDef);
2375
2380
 
2376
- rowDef.registerToView(this._dv, this._getRowId(rowRef));
2377
2381
  if(rowOption && rowOption["hidden"]) {
2378
2382
  this._dv.hideRow(rowDef.getRowId()); // Try to obtain rowId in rowDef since rowId is not assigned when new rows are created.
2379
2383
  }
@@ -2694,6 +2698,7 @@ Grid.prototype.removeAllRows = function() {
2694
2698
  this._dcConflator.reset();
2695
2699
  this._formulaConflator.reset();
2696
2700
  this._chainConflator.reset();
2701
+ this._constituentMap = null;
2697
2702
  this._connector.removeAllRics();
2698
2703
 
2699
2704
  // TODO: This logic should also be in the core grid
@@ -3593,15 +3598,15 @@ Grid.prototype._onQuote2PostUpdate = function (e) {
3593
3598
  * @param {Object} e
3594
3599
  */
3595
3600
  Grid.prototype._onQ2DataChanged = function (e) {
3596
- let subId = e["subId"];
3597
- let rowDef = this._getRowDefinitionById(subId);
3601
+ let rowDef = this._getRowDefinitionById(e["subId"]);
3598
3602
  if(!rowDef) {
3599
3603
  return; // WARNING: This should not be happened because row has been removed but the data is still received
3600
3604
  }
3601
3605
 
3606
+ let ric = e["ric"];
3602
3607
  let values = e["values"];
3603
3608
  if (values) {
3604
- let ric = e["ric"];
3609
+ let duplicateRics = null;
3605
3610
  if(rowDef.verifyConstituent(ric)) {
3606
3611
  let parentDef = rowDef;
3607
3612
  let childDef = parentDef.getConstituent(ric);
@@ -3612,15 +3617,28 @@ Grid.prototype._onQ2DataChanged = function (e) {
3612
3617
  if(!childDef) {
3613
3618
  return; // Parent chain is not alive
3614
3619
  }
3620
+ duplicateRics = this._connector.getRowDefByRic(ric);
3615
3621
  this._connector.addRic(childDef); // TODO: JET/RTK should not re-subscribe this
3622
+ if(!this._constituentMap) {
3623
+ this._constituentMap = {};
3624
+ }
3625
+ this._constituentMap[childDef.getRowId()] = childDef;
3616
3626
  this._registerConstituents(childDef);
3617
3627
  }
3618
3628
  }
3619
3629
 
3630
+ if(duplicateRics && duplicateRics.length) {
3631
+ let duplicateRic = duplicateRics[0];
3632
+ duplicateRic.cloneRowData(values, values);
3633
+ }
3634
+
3620
3635
  rowDef.setRowData(values); // Trigger data changes
3621
- } else if(rowDef.isConstituent()) { // Subscription and its parent has been removed by Real-time provider
3622
- rowDef.setParent(null); // Manually remove child reference from its parent
3623
- this._removeRow(rowDef);
3636
+ } else { // The constituent is requested to be removed by the real-time data provider
3637
+ let childDef = rowDef.getConstituent(ric); // WARNING: normal ric and its delayed version must match with the one first given
3638
+ if(childDef) {
3639
+ childDef.setParent(null); // Manually remove child reference from its parent
3640
+ this._removeRow(childDef);
3641
+ }
3624
3642
  }
3625
3643
  };
3626
3644
 
@@ -3631,6 +3649,9 @@ Grid.prototype._registerConstituents = function(rowDef) {
3631
3649
  if(this._chainConflator.conflate(rowDef)) {
3632
3650
  return;
3633
3651
  }
3652
+
3653
+ this._constituentMap = null;
3654
+
3634
3655
  let view = this._dv;
3635
3656
  let dt = view ? view.getDataSource() : null;
3636
3657
  if(!dt) {
@@ -3940,17 +3961,21 @@ Grid.prototype._onDataComposed = function(e) {
3940
3961
  return; // Cannot do data composition if there is no change in data
3941
3962
  }
3942
3963
 
3943
- let rowData = e["rowData"];
3944
- if(!rowData) {
3964
+ if(!e["rowData"]) {
3945
3965
  return; // Row could already be removed or global change event is sent
3946
3966
  }
3947
3967
 
3948
- let rowDef = rowData[ROW_DEF];
3968
+ let rowId = e["rid"];
3969
+ let rowDef = this._getRowDefinitionById(rowId);
3949
3970
  if(!rowDef) {
3950
- return;
3951
- }
3952
- if(!rowDef.getDataSource()) {
3953
- return; // Somehow, rowDef is invalid and doesn't have data source
3971
+ rowDef = this._constituentMap ? this._constituentMap[rowId] : null; // Row def could be in pending for adding to view
3972
+ if(!rowDef) {
3973
+ return; // Somehow the given row id is invalid
3974
+ }
3975
+ if(rowDef.isDisposed()) {
3976
+ this._constituentMap[rowId] = null;
3977
+ return;
3978
+ }
3954
3979
  }
3955
3980
 
3956
3981
  if(this._autoDateConversion) { // auto data conversion
@@ -4011,8 +4036,8 @@ Grid.prototype._onSubSegmentChanged = function(e) {
4011
4036
  rowDef = new RowDefinition({
4012
4037
  "segmentId": segmentId // WARNING: This could cause row id duplication
4013
4038
  });
4014
- rowDef.setDataSource(this._dc); // auto generated row does not require a subscription
4015
4039
  rowDef.registerToView(this._dv);
4040
+ rowDef.setDataSource(this._dc); // auto generated row does not require a subscription
4016
4041
  }
4017
4042
  };
4018
4043
 
@@ -4524,7 +4549,8 @@ Grid.prototype._onTabNavigation = function(e) {
4524
4549
  */
4525
4550
  Grid.prototype._getEventHandlers = function() {
4526
4551
  return {
4527
- "tabNavigation": this._onTabNavigation
4552
+ "tabNavigation": this._onTabNavigation,
4553
+ "q2DataChanged": this._onQ2DataChanged
4528
4554
  };
4529
4555
  };
4530
4556
 
@@ -610,7 +610,10 @@ RowDefinition.prototype.setDataSource = function(dataSource, subs) {
610
610
  this._dc = dataSource || null;
611
611
 
612
612
  if(this._dc) {
613
- this.setRowData(_cloneObject(this._staticValues)); // Trigger data change
613
+ this.setRowData({}); // Trigger data change
614
+ if(this._staticValues) {
615
+ this.setRowData(this._staticValues); // Trigger dataComposed and add updates
616
+ }
614
617
  }
615
618
 
616
619
  this._subs = subs || null;
@@ -736,9 +739,14 @@ RowDefinition.prototype.setRowData = function(data) {
736
739
  /** @public
737
740
  */
738
741
  RowDefinition.prototype.resetRowData = function() {
739
- if(this._dc) {
740
- this._dc.setRowData(this._rowId, null);
741
- this._dc.setRowData(this._rowId, _cloneObject(this._staticValues)); // Row data is guaranteed to be existed
742
+ let dc = this._dc;
743
+ if(dc) {
744
+ let rowId = this._rowId;
745
+ dc.setRowData(rowId, null);
746
+ dc.setRowData(rowId, {}); // Row data is guaranteed to be existed
747
+ if(this._staticValues) {
748
+ dc.setRowData(rowId, this._staticValues); // Trigger dataComposed and add updates
749
+ }
742
750
  }
743
751
  };
744
752
  /** @public
@@ -2,7 +2,7 @@ import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
2
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
3
3
  import { MouseDownTrait } from "../../tr-grid-util/es6/MouseDownTrait.js";
4
4
  import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
5
- import { isIE, cloneObject, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
5
+ import { cloneObject, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
6
6
  import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
7
7
  import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
8
8
 
@@ -16,7 +16,8 @@ declare namespace CellSelectionPlugin {
16
16
  selectionChanged?: ((...params: any[]) => any)|null,
17
17
  copy?: ((...params: any[]) => any)|null,
18
18
  beforeMouseDown?: ((...params: any[]) => any)|null,
19
- selectableSections?: any[]|null
19
+ selectableSections?: any[]|null,
20
+ copyDisabled?: boolean|null
20
21
  };
21
22
 
22
23
  }