@refinitiv-ui/efx-grid 6.0.128 → 6.0.130

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 (36) hide show
  1. package/lib/core/dist/core.js +258 -20
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/data/DataCache.js +29 -0
  4. package/lib/core/es6/data/DataTable.d.ts +4 -0
  5. package/lib/core/es6/data/DataTable.js +117 -1
  6. package/lib/core/es6/data/DataView.d.ts +6 -0
  7. package/lib/core/es6/data/DataView.js +43 -0
  8. package/lib/core/es6/data/SegmentCollection.d.ts +2 -0
  9. package/lib/core/es6/data/SegmentCollection.js +21 -0
  10. package/lib/core/es6/grid/Core.js +39 -10
  11. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +9 -9
  12. package/lib/grid/index.js +1 -1
  13. package/lib/row-segmenting/es6/RowSegmenting.d.ts +6 -0
  14. package/lib/row-segmenting/es6/RowSegmenting.js +62 -11
  15. package/lib/rt-grid/dist/rt-grid.js +337 -55
  16. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  17. package/lib/rt-grid/es6/DataConnector.js +1 -1
  18. package/lib/rt-grid/es6/Grid.d.ts +2 -0
  19. package/lib/rt-grid/es6/Grid.js +90 -23
  20. package/lib/rt-grid/es6/RowDefinition.d.ts +1 -1
  21. package/lib/rt-grid/es6/RowDefinition.js +26 -20
  22. package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +3 -2
  23. package/lib/tr-grid-cell-selection/es6/CellSelection.js +1100 -1124
  24. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +2 -1
  25. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +8 -2
  26. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +2 -2
  27. package/lib/types/es6/CellSelection.d.ts +3 -2
  28. package/lib/types/es6/ColumnGrouping.d.ts +2 -1
  29. package/lib/types/es6/Core/data/DataTable.d.ts +4 -0
  30. package/lib/types/es6/Core/data/DataView.d.ts +6 -0
  31. package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
  32. package/lib/types/es6/RealtimeGrid/Grid.d.ts +2 -0
  33. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +1 -1
  34. package/lib/types/es6/RowSegmenting.d.ts +6 -0
  35. package/lib/versions.json +6 -6
  36. package/package.json +1 -1
@@ -8966,6 +8966,35 @@ DataCache.prototype.cloneRowData = function (rid) {
8966
8966
  return values;
8967
8967
  };
8968
8968
 
8969
+ /**
8970
+ * @protected
8971
+ * @ignore
8972
+ * @param {string} fromRid
8973
+ * @param {string} toRid
8974
+ * @return {boolean}
8975
+ */
8976
+ DataCache.prototype._replaceRowId = function(fromRid, toRid) {
8977
+ let rows = this._rows;
8978
+ if(rows[fromRid]) {
8979
+ rows[toRid] = rows[fromRid];
8980
+ delete rows[fromRid];
8981
+ return true;
8982
+ }
8983
+ return false;
8984
+ };
8985
+ /**
8986
+ * @public
8987
+ * @ignore
8988
+ * @param {Object} ridPair
8989
+ */
8990
+ DataCache.prototype.replaceRowIds = function(ridPair) {
8991
+ if(typeof ridPair === "object") {
8992
+ for(let oldRid in ridPair) {
8993
+ this._replaceRowId(oldRid, ridPair[oldRid]);
8994
+ }
8995
+ }
8996
+ };
8997
+
8969
8998
  /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
8970
8999
  * @public
8971
9000
  * @ignore
@@ -10173,6 +10202,27 @@ SegmentCollection.prototype.getSegmentIds = function() {
10173
10202
  };
10174
10203
 
10175
10204
 
10205
+ /** @public
10206
+ * @param {Array.<string>} segmentIds
10207
+ * @param {boolean=} bool
10208
+ * @return {boolean} Returns true if there is any change. Otherwise, returns false
10209
+ */
10210
+ SegmentCollection.prototype.collapseSegments = function(segmentIds, bool) {
10211
+ if(this._segmentCount) {
10212
+ let dirty = 0;
10213
+ let len = segmentIds.length;
10214
+ for (let i = 0; i < len; i++) {
10215
+ let rowId = segmentIds[i];
10216
+ dirty |= this._segments[rowId].collapse(bool);
10217
+
10218
+ }
10219
+ if(dirty) {
10220
+ return true;
10221
+ }
10222
+ }
10223
+ return false;
10224
+ };
10225
+
10176
10226
  /** @public
10177
10227
  * @param {string} segmentId
10178
10228
  * @param {boolean=} bool
@@ -11412,6 +11462,45 @@ DataTable.prototype.swapRow = function(fromIndex, toIndex) { // No event is fire
11412
11462
  this._rids[toIndex] = rid;
11413
11463
  };
11414
11464
 
11465
+ /**
11466
+ * @protected
11467
+ * @override
11468
+ * @ignore
11469
+ * @param {string} fromRid
11470
+ * @param {string} toRid
11471
+ * @return {boolean}
11472
+ */
11473
+ DataTable.prototype._replaceRowId = function(fromRid, toRid) {
11474
+ let rids = this._rids;
11475
+ let idx = rids.indexOf(fromRid);
11476
+ if(idx >= 0) {
11477
+ rids[idx] = toRid;
11478
+ this._rows[toRid] = this._rows[fromRid];
11479
+ delete this._rows[fromRid];
11480
+ this._prevData[toRid] = this._prevData[fromRid];
11481
+ delete this._prevData[fromRid];
11482
+ return true;
11483
+ }
11484
+ return false;
11485
+ };
11486
+ /**
11487
+ * @public
11488
+ * @override
11489
+ * @ignore
11490
+ * @param {Object} ridPair
11491
+ */
11492
+ DataTable.prototype.replaceRowIds = function(ridPair) {
11493
+ if(typeof ridPair === "object") {
11494
+ let dirty = false;
11495
+ for(let oldRid in ridPair) {
11496
+ dirty |= this._replaceRowId(oldRid, ridPair[oldRid]);
11497
+ }
11498
+ if(dirty) {
11499
+ this.dispatchGlobalChange();
11500
+ }
11501
+ }
11502
+ };
11503
+
11415
11504
  /** @public
11416
11505
  * @function
11417
11506
  * @param {string} rid
@@ -11553,6 +11642,55 @@ DataTable.prototype.isFrozen = function() {
11553
11642
  return this._frozen;
11554
11643
  };
11555
11644
 
11645
+ /**
11646
+ * @public
11647
+ * @param {Array.<string>} rids
11648
+ * @param {boolean=} enabled
11649
+ * @return {boolean} Return true if there is any change
11650
+ */
11651
+ DataTable.prototype.setSegmentSeparators = function(rids, enabled) {
11652
+ let change = false;
11653
+ if (rids) {
11654
+ let len = rids.length;
11655
+ let segmentChanged = false;
11656
+ for (let i = 0; i < len; i++) {
11657
+ if(enabled !== false) {
11658
+ let rid = rids[i];
11659
+ if (!this._segments) {
11660
+ this._segments = new data_SegmentCollection();
11661
+ this._segments.addEventListener("subSegmentChanged", this._onSubSegmentChanged);
11662
+ }
11663
+ if(this._autoSegmentFilling) {
11664
+ let parentId = this._segments.getParentRowId(rid);
11665
+ if(parentId) {
11666
+ this._segments.removeSegmentChild(parentId, rid);
11667
+ }
11668
+ }
11669
+ segmentChanged = this._segments.addSegment(rid);
11670
+ } else if (this._segments) { // remove case
11671
+ let segment = this._segments.getSegment(rid);
11672
+ if(segment) {
11673
+ if(this._segments.removeSegment(rid)) {
11674
+ change = true;
11675
+ if(!this._segments.getSegmentCount()) {
11676
+ this._segments = null;
11677
+ }
11678
+ }
11679
+ }
11680
+ }
11681
+
11682
+ }
11683
+ if (enabled !== false && segmentChanged) {
11684
+ this._segments.calcSegmentOrder(this._rids);
11685
+ change = true;
11686
+ }
11687
+ if(change) {
11688
+ this.dispatchGlobalChange();
11689
+ }
11690
+ }
11691
+ return change;
11692
+
11693
+ };
11556
11694
 
11557
11695
  /**
11558
11696
  * @public
@@ -11579,7 +11717,7 @@ DataTable.prototype.setSegmentSeparator = function(rid, enabled) {
11579
11717
  this._segments.calcSegmentOrder(this._rids);
11580
11718
  change = true;
11581
11719
  }
11582
- } else if(this._segments) {
11720
+ } else if(this._segments) { // mean remove separator
11583
11721
  let segment = this._segments.getSegment(rid);
11584
11722
  if(segment) {
11585
11723
  memberCount = segment.getChildCount();
@@ -11805,6 +11943,34 @@ DataTable.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
11805
11943
  }
11806
11944
  return false;
11807
11945
  };
11946
+
11947
+ /** @public
11948
+ * @param {Array.<Object>} segmentArr Segment array that contain "segmentId", "rowIds" to set segment children
11949
+ * @return {boolean} Return true if there is any change
11950
+ */
11951
+ DataTable.prototype.setSegmentChildren = function(segmentArr) {
11952
+ if(!this._segments) {
11953
+ return false;
11954
+ }
11955
+ this.removeAllSegmentChildren();
11956
+ let len = segmentArr.length;
11957
+ let dirty;
11958
+ for (let i = 0; i < len; i++) {
11959
+ let obj = segmentArr[i];
11960
+ if(this._segments.addSegmentChildren(obj.segmentId, obj.rowIds)) {
11961
+ dirty = true;
11962
+ }
11963
+ }
11964
+ if(dirty) {
11965
+ this._sort(null);
11966
+ this._dispatchPositionChange(); // Force rerendering, even if there is no position change
11967
+
11968
+ this.requestClassifying();
11969
+ return true;
11970
+ }
11971
+
11972
+ return false;
11973
+ };
11808
11974
  /** @public
11809
11975
  * @param {string} segmentId Row id
11810
11976
  * @param {string} rid Row id
@@ -12687,12 +12853,6 @@ const ROW_TYPES = {
12687
12853
  GROUP_MEMBER: "GROUP_MEMBER"
12688
12854
  };
12689
12855
 
12690
- /** @type {RegExp}
12691
- * @private
12692
- * @const
12693
- */
12694
- const ROW_ID_PATTERN = /^_[^_]+_$/;
12695
-
12696
12856
  /** @private
12697
12857
  * @function
12698
12858
  * @param {Object} obj
@@ -12737,6 +12897,11 @@ RowDefinition._runningId = 0;
12737
12897
  * @private
12738
12898
  */
12739
12899
  RowDefinition._childDataField = "CHILD_VALUES";
12900
+ /** @type {RegExp}
12901
+ * @private
12902
+ * @const
12903
+ */
12904
+ RowDefinition.ROW_ID_PATTERN = /^_[^_]+_$/;
12740
12905
  //#region Private Members
12741
12906
  /** @type {string}
12742
12907
  * @private
@@ -12892,7 +13057,7 @@ RowDefinition.prototype.initialize = function(rowOptions) {
12892
13057
  if(!this._autoGenerated) {
12893
13058
  let userRowId = rowOptions["rowId"];
12894
13059
  if(userRowId && typeof userRowId === "string") {
12895
- if(userRowId.match(ROW_ID_PATTERN)) {
13060
+ if(userRowId.match(RowDefinition.ROW_ID_PATTERN)) {
12896
13061
  console.warn("Please change the rowId format to avoid duplicated rows' id causing unexpected behavior.");
12897
13062
  } else {
12898
13063
  this._rowId = userRowId;
@@ -13543,12 +13708,7 @@ RowDefinition.prototype.isRealTimeRow = function() {
13543
13708
  * @return {boolean} If a subscription is made, return true.
13544
13709
  */
13545
13710
  RowDefinition.prototype.subscribeForUpdates = function(subs) {
13546
- if(subs) {
13547
- this._subs = subs;
13548
- } else {
13549
- subs = this._subs;
13550
- }
13551
- if(!subs) {
13711
+ if(!(subs || this._subs)) {
13552
13712
  return false;
13553
13713
  }
13554
13714
  if(!this.isRealTimeRow() && !this.getPermId()) {
@@ -13556,7 +13716,11 @@ RowDefinition.prototype.subscribeForUpdates = function(subs) {
13556
13716
  }
13557
13717
  // TODO: Check if the same subscription is being made.
13558
13718
  this.unsubscribeForUpdates();
13559
-
13719
+ if(subs) {
13720
+ this._subs = subs;
13721
+ } else {
13722
+ subs = this._subs;
13723
+ }
13560
13724
  if(this.isChain()) {
13561
13725
  let symbol = this._chainRic;
13562
13726
  if(!symbol){
@@ -13580,14 +13744,17 @@ RowDefinition.prototype.subscribeForUpdates = function(subs) {
13580
13744
  };
13581
13745
  /** Unsubscribe existing real-time data service. Static data is maintained
13582
13746
  * @public
13747
+ * @param {boolean=} keepData
13583
13748
  * @returns {null} Always return null
13584
13749
  */
13585
- RowDefinition.prototype.unsubscribeForUpdates = function() {
13750
+ RowDefinition.prototype.unsubscribeForUpdates = function(keepData) {
13586
13751
  if(this.isSubscribing()) { // Only normal real-time rows and chains have both subId and subscription object
13587
13752
  this._subs["removeSubscription"](this._subId);
13588
13753
  this._subId = "";
13589
- this.resetUpdates();
13590
- this.resetRowData(); // Real-time data is removed while static data is maintained
13754
+ if(!keepData) {
13755
+ this.resetUpdates();
13756
+ this.resetRowData(); // Real-time data is removed while static data is maintained
13757
+ }
13591
13758
  }
13592
13759
  return null;
13593
13760
  };
@@ -13806,8 +13973,9 @@ RowDefinition.prototype.addConstituent = function(ric) {
13806
13973
  /** Used to convert autogenerated row to regular real-time row
13807
13974
  * @public
13808
13975
  * @ignore
13976
+ * @param {string=} userRowId
13809
13977
  */
13810
- RowDefinition.prototype.toRealTimeRow = function() {
13978
+ RowDefinition.prototype.toRealTimeRow = function(userRowId) {
13811
13979
  if(!this.isConstituent()) {
13812
13980
  return; // Only a constituent can be converted to a real-time row
13813
13981
  }
@@ -13818,7 +13986,11 @@ RowDefinition.prototype.toRealTimeRow = function() {
13818
13986
  this._parent = null;
13819
13987
  this._depthLevel = 0;
13820
13988
 
13821
- this.resetRowData(); // WARNING: existing real-time data is lost after this line
13989
+ if(userRowId) {
13990
+ this._rowId = userRowId;
13991
+ this._userId = true;
13992
+ }
13993
+
13822
13994
  this.subscribeForUpdates(subs); // Static data remains intact
13823
13995
  };
13824
13996
 
@@ -13829,7 +14001,7 @@ RowDefinition.prototype.unlinkChain = function() {
13829
14001
  return;
13830
14002
  }
13831
14003
 
13832
- this.unsubscribeForUpdates(); // Static data remains intact
14004
+ this.unsubscribeForUpdates(true); // Static data remains intact
13833
14005
 
13834
14006
  let view = this._view;
13835
14007
  if(view) {
@@ -31421,6 +31593,23 @@ DataView.prototype.synchronizeRowOrder = function() {
31421
31593
  this._dt._sort(this._sortingDefs);
31422
31594
  }
31423
31595
  };
31596
+ /**
31597
+ * @public
31598
+ * @param {Array<string>} rowIds
31599
+ * @param {boolean=} enabled
31600
+ * @return {boolean} Return true if there is any change
31601
+ */
31602
+ DataView.prototype.setSegmentSeparators = function(rowIds, enabled) {
31603
+ if(rowIds) {
31604
+ enabled = enabled !== false;
31605
+ if(enabled) {
31606
+ this.synchronizeRowOrder();
31607
+ }
31608
+ // TODO: Force expanding of segment before unsetting segment separator
31609
+ return this._dt.setSegmentSeparators(rowIds, enabled);
31610
+ }
31611
+ return false;
31612
+ };
31424
31613
  /** Set visible row as segment separator (hidden or filtered rows cannot be a segment separator)
31425
31614
  * @public
31426
31615
  * @param {string|number} rowRef Row id or row index
@@ -31521,6 +31710,22 @@ DataView.prototype.collapseSegment = function(rowRef, collapsed) {
31521
31710
  return false;
31522
31711
  };
31523
31712
  /** @public
31713
+ * @param {Array<string|number>} rowIds
31714
+ * @param {boolean=} collapsed
31715
+ * @return {boolean} Return true if there is any change
31716
+ */
31717
+ DataView.prototype.collapseSegments = function(rowIds, collapsed) {
31718
+ collapsed = collapsed !== false;
31719
+ let segments = this._dt._getSegmentSeparators();
31720
+ if(segments) {
31721
+ if(segments.collapseSegments(rowIds, collapsed)) {
31722
+ this._refreshAndNotify(); // dispatch global change event
31723
+ return true;
31724
+ }
31725
+ }
31726
+ return false;
31727
+ };
31728
+ /** @public
31524
31729
  * @param {string|number} rowRef Row id or row index
31525
31730
  * @param {boolean=} expanded
31526
31731
  * @return {boolean} Return true if there is any change
@@ -31599,6 +31804,16 @@ DataView.prototype.addSegmentChildren = function(segmentRef, rowRefs, dataIds) {
31599
31804
  return false;
31600
31805
  };
31601
31806
  /** @public
31807
+ * @param {Array<Object>} segmentArr Segment array that contain "segmentId", "rowIds" to set segment children
31808
+ * @return {boolean} Return true if there is any change
31809
+ */
31810
+ DataView.prototype.setSegmentChildren = function(segmentArr) {
31811
+ if(this._dt._getSegmentSeparators()) {
31812
+ return this._dt.setSegmentChildren(segmentArr);
31813
+ }
31814
+ return false;
31815
+ };
31816
+ /** @public
31602
31817
  * @param {string|number} segmentRef Row id or row index
31603
31818
  * @param {string|number} rowRef Row id, row index
31604
31819
  * @return {boolean} Return true if there is any change
@@ -36302,7 +36517,7 @@ Core.prototype._hasPendingRowChange = false;
36302
36517
  * @return {string}
36303
36518
  */
36304
36519
  Core.getVersion = function () {
36305
- return "5.1.125";
36520
+ return "5.1.129";
36306
36521
  };
36307
36522
  /** {@link ElementWrapper#dispose}
36308
36523
  * @override
@@ -42177,7 +42392,7 @@ DataConnector.prototype._fieldChangedConflator = null;
42177
42392
  * @private
42178
42393
  */
42179
42394
  DataConnector.prototype._ricChangedConflator = null;
42180
- /** @type {Object.<string, RowDefinition>}
42395
+ /** @type {Object.<string, Array.<RowDefinition>>}
42181
42396
  * @private
42182
42397
  */
42183
42398
  DataConnector.prototype._rowDefMap = null;
@@ -43467,7 +43682,15 @@ SortableTitlePlugin.prototype.isSorting = function () {
43467
43682
  * @fires SortableTitlePlugin#columnSorted
43468
43683
  */
43469
43684
  SortableTitlePlugin.prototype.sortColumn = function (colRef, sortOrder, opt_arg) {
43470
- this._sortColumn(this._prepareSorting(colRef, sortOrder), opt_arg);
43685
+ let sortOptions = this._prepareSorting(colRef, sortOrder);
43686
+ this._sortColumn(sortOptions, opt_arg);
43687
+ if (opt_arg && opt_arg["isUserAction"]) { // Currently, the 'isUserAction' flag is triggered by a user clicking on the title and clicking the filter dialog. TODO: preClicked should be firing too.
43688
+ let ce = {};
43689
+ ce["colIndex"] = sortOptions.colIndex;
43690
+ ce["sortOrder"] = this.getSortOrder(sortOptions.colIndex);
43691
+ ce["dataColumnName"] = this.getColumnSortingField(sortOptions.colIndex); // This should be deprecated
43692
+ this._dispatch("clicked", ce);
43693
+ }
43471
43694
  };
43472
43695
 
43473
43696
  /** Sort multiple columns at once
@@ -43866,14 +44089,6 @@ SortableTitlePlugin.prototype._proceedSorting = function (hitObj) {
43866
44089
  if(grid && grid["focus"]) {
43867
44090
  grid["focus"]();
43868
44091
  }
43869
-
43870
- if (this._hasListener("clicked")) {
43871
- let ce = {};
43872
- ce["colIndex"] = colIndex;
43873
- ce["sortOrder"] = this.getSortOrder(colIndex);
43874
- ce["dataColumnName"] = this.getColumnSortingField(colIndex); // This should be deprecated
43875
- this._dispatch("clicked", ce);
43876
- }
43877
44092
  }
43878
44093
  };
43879
44094
 
@@ -44787,6 +45002,14 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
44787
45002
  * @description Fired only when a row will be removed through Grid's API and before occurring of the actual removal
44788
45003
  */
44789
45004
 
45005
+ /** @event Grid#beforeUnlinked
45006
+ * @description Trigger before unlinking a chain row.
45007
+ * @type {Object}
45008
+ * @property {RowDefinition} chain An row definition object of a chain row.
45009
+ * @property {boolean} collapsed Collapsing state of a chain row.
45010
+ * @property {Object} ridMap A map of constituent rics and row ids used to customize row ids.
45011
+ */
45012
+
44790
45013
  /** @private
44791
45014
  * @param {RowDefinition} rowDef
44792
45015
  * @return {Object}
@@ -45136,6 +45359,10 @@ Grid.prototype._formulaConflator = null;
45136
45359
  */
45137
45360
  Grid.prototype._chainConflator = null;
45138
45361
  /** @private
45362
+ * @type {Object}
45363
+ */
45364
+ Grid.prototype._constituentMap = null;
45365
+ /** @private
45139
45366
  * @type {number}
45140
45367
  */
45141
45368
  Grid.prototype._clientWidth = NaN;
@@ -45217,11 +45444,6 @@ Grid.prototype._topSection = true;
45217
45444
  * @private
45218
45445
  */
45219
45446
  Grid.prototype._focusingArgs = null;
45220
- /** @type {boolean}
45221
- * @private
45222
- */
45223
- Grid.prototype._unlinking = false;
45224
-
45225
45447
 
45226
45448
  /** @public
45227
45449
  */
@@ -47306,6 +47528,7 @@ Grid.prototype.removeAllRows = function() {
47306
47528
  this._dcConflator.reset();
47307
47529
  this._formulaConflator.reset();
47308
47530
  this._chainConflator.reset();
47531
+ this._constituentMap = null;
47309
47532
  this._connector.removeAllRics();
47310
47533
 
47311
47534
  // TODO: This logic should also be in the core grid
@@ -47449,13 +47672,41 @@ Grid.prototype.unlinkChain = function(rowRef) {
47449
47672
  return;
47450
47673
  }
47451
47674
 
47452
- this._unlinking = true;
47453
-
47454
47675
  let childRowDefs = rowDef.getDescendants(); // TODO: Support nested child
47455
47676
  if(childRowDefs) {
47456
- if(rowDef.isChainExpanded()) {
47457
- for(let i = 0; i < childRowDefs.length; i++) {
47458
- childRowDefs[i].toRealTimeRow();
47677
+ let len = childRowDefs.length;
47678
+ let ridMap = {};
47679
+ for(let i = 0; i < len; i++) {
47680
+ ridMap[childRowDefs[i].getRic()] = "";
47681
+ }
47682
+ let collapsed = rowDef.isChainCollapsed();
47683
+ let args = {
47684
+ chain: rowDef,
47685
+ collapsed: collapsed,
47686
+ ridMap: ridMap
47687
+ };
47688
+ this._dispatch("beforeUnlinked", args);
47689
+
47690
+ if(!collapsed) {
47691
+ let rowIdChanged = false;
47692
+ let ridPair = {};
47693
+ for(let i = 0; i < len; i++) {
47694
+ let childRowDef = childRowDefs[i];
47695
+ let mappedRowId = ridMap[childRowDef.getRic()];
47696
+ if(mappedRowId) {
47697
+ if(mappedRowId.match(RowDefinition.ROW_ID_PATTERN)) {
47698
+ console.warn("Please change the rowId format to avoid duplicated rows' id causing unexpected behavior.");
47699
+ mappedRowId = "";
47700
+ } else {
47701
+ rowIdChanged = true;
47702
+ ridPair[childRowDef.getRowId()] = mappedRowId;
47703
+ }
47704
+ }
47705
+ childRowDef.toRealTimeRow(mappedRowId);
47706
+ }
47707
+ if(rowIdChanged) {
47708
+ this._dc.replaceRowIds(ridPair);
47709
+ this._dt.replaceRowIds(ridPair);
47459
47710
  }
47460
47711
  } else {
47461
47712
  this._removeConstituentRows(childRowDefs);
@@ -47463,8 +47714,6 @@ Grid.prototype.unlinkChain = function(rowRef) {
47463
47714
  }
47464
47715
 
47465
47716
  rowDef.unlinkChain();
47466
-
47467
- this._unlinking = false;
47468
47717
  };
47469
47718
 
47470
47719
  /** Alias to setRic
@@ -47778,6 +48027,15 @@ Grid.prototype.getAllRics = function() {
47778
48027
  Grid.prototype.hasRic = function() {
47779
48028
  return this._connector.hasRic();
47780
48029
  };
48030
+ /** Returns RIC of given row reference.
48031
+ * @public
48032
+ * @param {(string|number)=} rowRef
48033
+ * @return {string}
48034
+ */
48035
+ Grid.prototype.getRic = function(rowRef) {
48036
+ let rowDef = this.getRowDefinition(rowRef);
48037
+ return rowDef.getRic();
48038
+ };
47781
48039
  /** A shorthand to set row data based on index of the specified row. It is better to keep rowDefinition object for updating data directly as row index can be changed by sorting and filtering.
47782
48040
  * @public
47783
48041
  * @param {Grid~RowReference} rowRef
@@ -48205,15 +48463,15 @@ Grid.prototype._onQuote2PostUpdate = function (e) {
48205
48463
  * @param {Object} e
48206
48464
  */
48207
48465
  Grid.prototype._onQ2DataChanged = function (e) {
48208
- let subId = e["subId"];
48209
- let rowDef = this._getRowDefinitionById(subId);
48466
+ let rowDef = this._getRowDefinitionById(e["subId"]);
48210
48467
  if(!rowDef) {
48211
48468
  return; // WARNING: This should not be happened because row has been removed but the data is still received
48212
48469
  }
48213
48470
 
48471
+ let ric = e["ric"];
48214
48472
  let values = e["values"];
48215
48473
  if (values) {
48216
- let ric = e["ric"];
48474
+ let duplicateRics = null;
48217
48475
  if(rowDef.verifyConstituent(ric)) {
48218
48476
  let parentDef = rowDef;
48219
48477
  let childDef = parentDef.getConstituent(ric);
@@ -48224,15 +48482,28 @@ Grid.prototype._onQ2DataChanged = function (e) {
48224
48482
  if(!childDef) {
48225
48483
  return; // Parent chain is not alive
48226
48484
  }
48485
+ duplicateRics = this._connector.getRowDefByRic(ric);
48227
48486
  this._connector.addRic(childDef); // TODO: JET/RTK should not re-subscribe this
48487
+ if(!this._constituentMap) {
48488
+ this._constituentMap = {};
48489
+ }
48490
+ this._constituentMap[childDef.getRowId()] = childDef;
48228
48491
  this._registerConstituents(childDef);
48229
48492
  }
48230
48493
  }
48231
48494
 
48495
+ if(duplicateRics && duplicateRics.length) {
48496
+ let duplicateRic = duplicateRics[0];
48497
+ duplicateRic.cloneRowData(values, values);
48498
+ }
48499
+
48232
48500
  rowDef.setRowData(values); // Trigger data changes
48233
- } else if(rowDef.isConstituent()) { // Subscription and its parent has been removed by Real-time provider
48234
- rowDef.setParent(null); // Manually remove child reference from its parent
48235
- this._removeRow(rowDef);
48501
+ } else { // The constituent is requested to be removed by the real-time data provider
48502
+ let childDef = rowDef.getConstituent(ric); // WARNING: normal ric and its delayed version must match with the one first given
48503
+ if(childDef) {
48504
+ childDef.setParent(null); // Manually remove child reference from its parent
48505
+ this._removeRow(childDef);
48506
+ }
48236
48507
  }
48237
48508
  };
48238
48509
 
@@ -48243,6 +48514,9 @@ Grid.prototype._registerConstituents = function(rowDef) {
48243
48514
  if(this._chainConflator.conflate(rowDef)) {
48244
48515
  return;
48245
48516
  }
48517
+
48518
+ this._constituentMap = null;
48519
+
48246
48520
  let view = this._dv;
48247
48521
  let dt = view ? view.getDataSource() : null;
48248
48522
  if(!dt) {
@@ -48552,14 +48826,21 @@ Grid.prototype._onDataComposed = function(e) {
48552
48826
  return; // Cannot do data composition if there is no change in data
48553
48827
  }
48554
48828
 
48555
- let rowData = e["rowData"];
48556
- if(!rowData) {
48829
+ if(!e["rowData"]) {
48557
48830
  return; // Row could already be removed or global change event is sent
48558
48831
  }
48559
48832
 
48560
- let rowDef = this._getRowDefinitionById(e["rid"]);
48833
+ let rowId = e["rid"];
48834
+ let rowDef = this._getRowDefinitionById(rowId);
48561
48835
  if(!rowDef) {
48562
- return; // Somehow the given row id is invalid
48836
+ rowDef = this._constituentMap ? this._constituentMap[rowId] : null; // Row def could be in pending for adding to view
48837
+ if(!rowDef) {
48838
+ return; // Somehow the given row id is invalid
48839
+ }
48840
+ if(rowDef.isDisposed()) {
48841
+ this._constituentMap[rowId] = null;
48842
+ return;
48843
+ }
48563
48844
  }
48564
48845
 
48565
48846
  if(this._autoDateConversion) { // auto data conversion
@@ -49133,7 +49414,8 @@ Grid.prototype._onTabNavigation = function(e) {
49133
49414
  */
49134
49415
  Grid.prototype._getEventHandlers = function() {
49135
49416
  return {
49136
- "tabNavigation": this._onTabNavigation
49417
+ "tabNavigation": this._onTabNavigation,
49418
+ "q2DataChanged": this._onQ2DataChanged
49137
49419
  };
49138
49420
  };
49139
49421