@refinitiv-ui/efx-grid 6.0.127 → 6.0.129

Sign up to get free protection for your applications and to get access to all the features.
@@ -12594,6 +12594,35 @@ DataCache.prototype.cloneRowData = function (rid) {
12594
12594
  return values;
12595
12595
  };
12596
12596
 
12597
+ /**
12598
+ * @protected
12599
+ * @ignore
12600
+ * @param {string} fromRid
12601
+ * @param {string} toRid
12602
+ * @return {boolean}
12603
+ */
12604
+ DataCache.prototype._replaceRowId = function(fromRid, toRid) {
12605
+ let rows = this._rows;
12606
+ if(rows[fromRid]) {
12607
+ rows[toRid] = rows[fromRid];
12608
+ delete rows[fromRid];
12609
+ return true;
12610
+ }
12611
+ return false;
12612
+ };
12613
+ /**
12614
+ * @public
12615
+ * @ignore
12616
+ * @param {Object} ridPair
12617
+ */
12618
+ DataCache.prototype.replaceRowIds = function(ridPair) {
12619
+ if(typeof ridPair === "object") {
12620
+ for(let oldRid in ridPair) {
12621
+ this._replaceRowId(oldRid, ridPair[oldRid]);
12622
+ }
12623
+ }
12624
+ };
12625
+
12597
12626
  /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
12598
12627
  * @public
12599
12628
  * @ignore
@@ -13964,6 +13993,27 @@ SegmentCollection.prototype.getSegmentIds = function() {
13964
13993
  };
13965
13994
 
13966
13995
 
13996
+ /** @public
13997
+ * @param {Array.<string>} segmentIds
13998
+ * @param {boolean=} bool
13999
+ * @return {boolean} Returns true if there is any change. Otherwise, returns false
14000
+ */
14001
+ SegmentCollection.prototype.collapseSegments = function(segmentIds, bool) {
14002
+ if(this._segmentCount) {
14003
+ let dirty = 0;
14004
+ let len = segmentIds.length;
14005
+ for (let i = 0; i < len; i++) {
14006
+ let rowId = segmentIds[i];
14007
+ dirty |= this._segments[rowId].collapse(bool);
14008
+
14009
+ }
14010
+ if(dirty) {
14011
+ return true;
14012
+ }
14013
+ }
14014
+ return false;
14015
+ };
14016
+
13967
14017
  /** @public
13968
14018
  * @param {string} segmentId
13969
14019
  * @param {boolean=} bool
@@ -15203,6 +15253,45 @@ DataTable.prototype.swapRow = function(fromIndex, toIndex) { // No event is fire
15203
15253
  this._rids[toIndex] = rid;
15204
15254
  };
15205
15255
 
15256
+ /**
15257
+ * @protected
15258
+ * @override
15259
+ * @ignore
15260
+ * @param {string} fromRid
15261
+ * @param {string} toRid
15262
+ * @return {boolean}
15263
+ */
15264
+ DataTable.prototype._replaceRowId = function(fromRid, toRid) {
15265
+ let rids = this._rids;
15266
+ let idx = rids.indexOf(fromRid);
15267
+ if(idx >= 0) {
15268
+ rids[idx] = toRid;
15269
+ this._rows[toRid] = this._rows[fromRid];
15270
+ delete this._rows[fromRid];
15271
+ this._prevData[toRid] = this._prevData[fromRid];
15272
+ delete this._prevData[fromRid];
15273
+ return true;
15274
+ }
15275
+ return false;
15276
+ };
15277
+ /**
15278
+ * @public
15279
+ * @override
15280
+ * @ignore
15281
+ * @param {Object} ridPair
15282
+ */
15283
+ DataTable.prototype.replaceRowIds = function(ridPair) {
15284
+ if(typeof ridPair === "object") {
15285
+ let dirty = false;
15286
+ for(let oldRid in ridPair) {
15287
+ dirty |= this._replaceRowId(oldRid, ridPair[oldRid]);
15288
+ }
15289
+ if(dirty) {
15290
+ this.dispatchGlobalChange();
15291
+ }
15292
+ }
15293
+ };
15294
+
15206
15295
  /** @public
15207
15296
  * @function
15208
15297
  * @param {string} rid
@@ -15344,6 +15433,55 @@ DataTable.prototype.isFrozen = function() {
15344
15433
  return this._frozen;
15345
15434
  };
15346
15435
 
15436
+ /**
15437
+ * @public
15438
+ * @param {Array.<string>} rids
15439
+ * @param {boolean=} enabled
15440
+ * @return {boolean} Return true if there is any change
15441
+ */
15442
+ DataTable.prototype.setSegmentSeparators = function(rids, enabled) {
15443
+ let change = false;
15444
+ if (rids) {
15445
+ let len = rids.length;
15446
+ let segmentChanged = false;
15447
+ for (let i = 0; i < len; i++) {
15448
+ if(enabled !== false) {
15449
+ let rid = rids[i];
15450
+ if (!this._segments) {
15451
+ this._segments = new data_SegmentCollection();
15452
+ this._segments.addEventListener("subSegmentChanged", this._onSubSegmentChanged);
15453
+ }
15454
+ if(this._autoSegmentFilling) {
15455
+ let parentId = this._segments.getParentRowId(rid);
15456
+ if(parentId) {
15457
+ this._segments.removeSegmentChild(parentId, rid);
15458
+ }
15459
+ }
15460
+ segmentChanged = this._segments.addSegment(rid);
15461
+ } else if (this._segments) { // remove case
15462
+ let segment = this._segments.getSegment(rid);
15463
+ if(segment) {
15464
+ if(this._segments.removeSegment(rid)) {
15465
+ change = true;
15466
+ if(!this._segments.getSegmentCount()) {
15467
+ this._segments = null;
15468
+ }
15469
+ }
15470
+ }
15471
+ }
15472
+
15473
+ }
15474
+ if (enabled !== false && segmentChanged) {
15475
+ this._segments.calcSegmentOrder(this._rids);
15476
+ change = true;
15477
+ }
15478
+ if(change) {
15479
+ this.dispatchGlobalChange();
15480
+ }
15481
+ }
15482
+ return change;
15483
+
15484
+ };
15347
15485
 
15348
15486
  /**
15349
15487
  * @public
@@ -15370,7 +15508,7 @@ DataTable.prototype.setSegmentSeparator = function(rid, enabled) {
15370
15508
  this._segments.calcSegmentOrder(this._rids);
15371
15509
  change = true;
15372
15510
  }
15373
- } else if(this._segments) {
15511
+ } else if(this._segments) { // mean remove separator
15374
15512
  let segment = this._segments.getSegment(rid);
15375
15513
  if(segment) {
15376
15514
  memberCount = segment.getChildCount();
@@ -15596,6 +15734,34 @@ DataTable.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
15596
15734
  }
15597
15735
  return false;
15598
15736
  };
15737
+
15738
+ /** @public
15739
+ * @param {Array.<Object>} segmentArr Segment array that contain "segmentId", "rowIds" to set segment children
15740
+ * @return {boolean} Return true if there is any change
15741
+ */
15742
+ DataTable.prototype.setSegmentChildren = function(segmentArr) {
15743
+ if(!this._segments) {
15744
+ return false;
15745
+ }
15746
+ this.removeAllSegmentChildren();
15747
+ let len = segmentArr.length;
15748
+ let dirty;
15749
+ for (let i = 0; i < len; i++) {
15750
+ let obj = segmentArr[i];
15751
+ if(this._segments.addSegmentChildren(obj.segmentId, obj.rowIds)) {
15752
+ dirty = true;
15753
+ }
15754
+ }
15755
+ if(dirty) {
15756
+ this._sort(null);
15757
+ this._dispatchPositionChange(); // Force rerendering, even if there is no position change
15758
+
15759
+ this.requestClassifying();
15760
+ return true;
15761
+ }
15762
+
15763
+ return false;
15764
+ };
15599
15765
  /** @public
15600
15766
  * @param {string} segmentId Row id
15601
15767
  * @param {string} rid Row id
@@ -20805,6 +20971,23 @@ DataView.prototype.synchronizeRowOrder = function() {
20805
20971
  this._dt._sort(this._sortingDefs);
20806
20972
  }
20807
20973
  };
20974
+ /**
20975
+ * @public
20976
+ * @param {Array<string>} rowIds
20977
+ * @param {boolean=} enabled
20978
+ * @return {boolean} Return true if there is any change
20979
+ */
20980
+ DataView.prototype.setSegmentSeparators = function(rowIds, enabled) {
20981
+ if(rowIds) {
20982
+ enabled = enabled !== false;
20983
+ if(enabled) {
20984
+ this.synchronizeRowOrder();
20985
+ }
20986
+ // TODO: Force expanding of segment before unsetting segment separator
20987
+ return this._dt.setSegmentSeparators(rowIds, enabled);
20988
+ }
20989
+ return false;
20990
+ };
20808
20991
  /** Set visible row as segment separator (hidden or filtered rows cannot be a segment separator)
20809
20992
  * @public
20810
20993
  * @param {string|number} rowRef Row id or row index
@@ -20905,6 +21088,22 @@ DataView.prototype.collapseSegment = function(rowRef, collapsed) {
20905
21088
  return false;
20906
21089
  };
20907
21090
  /** @public
21091
+ * @param {Array<string|number>} rowIds
21092
+ * @param {boolean=} collapsed
21093
+ * @return {boolean} Return true if there is any change
21094
+ */
21095
+ DataView.prototype.collapseSegments = function(rowIds, collapsed) {
21096
+ collapsed = collapsed !== false;
21097
+ let segments = this._dt._getSegmentSeparators();
21098
+ if(segments) {
21099
+ if(segments.collapseSegments(rowIds, collapsed)) {
21100
+ this._refreshAndNotify(); // dispatch global change event
21101
+ return true;
21102
+ }
21103
+ }
21104
+ return false;
21105
+ };
21106
+ /** @public
20908
21107
  * @param {string|number} rowRef Row id or row index
20909
21108
  * @param {boolean=} expanded
20910
21109
  * @return {boolean} Return true if there is any change
@@ -20983,6 +21182,16 @@ DataView.prototype.addSegmentChildren = function(segmentRef, rowRefs, dataIds) {
20983
21182
  return false;
20984
21183
  };
20985
21184
  /** @public
21185
+ * @param {Array<Object>} segmentArr Segment array that contain "segmentId", "rowIds" to set segment children
21186
+ * @return {boolean} Return true if there is any change
21187
+ */
21188
+ DataView.prototype.setSegmentChildren = function(segmentArr) {
21189
+ if(this._dt._getSegmentSeparators()) {
21190
+ return this._dt.setSegmentChildren(segmentArr);
21191
+ }
21192
+ return false;
21193
+ };
21194
+ /** @public
20986
21195
  * @param {string|number} segmentRef Row id or row index
20987
21196
  * @param {string|number} rowRef Row id, row index
20988
21197
  * @return {boolean} Return true if there is any change
@@ -25686,7 +25895,7 @@ Core_Core.prototype._hasPendingRowChange = false;
25686
25895
  * @return {string}
25687
25896
  */
25688
25897
  Core_Core.getVersion = function () {
25689
- return "5.1.125";
25898
+ return "5.1.129";
25690
25899
  };
25691
25900
  /** {@link ElementWrapper#dispose}
25692
25901
  * @override
@@ -32031,7 +32240,15 @@ SortableTitlePlugin.prototype.isSorting = function () {
32031
32240
  * @fires SortableTitlePlugin#columnSorted
32032
32241
  */
32033
32242
  SortableTitlePlugin.prototype.sortColumn = function (colRef, sortOrder, opt_arg) {
32034
- this._sortColumn(this._prepareSorting(colRef, sortOrder), opt_arg);
32243
+ let sortOptions = this._prepareSorting(colRef, sortOrder);
32244
+ this._sortColumn(sortOptions, opt_arg);
32245
+ 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.
32246
+ let ce = {};
32247
+ ce["colIndex"] = sortOptions.colIndex;
32248
+ ce["sortOrder"] = this.getSortOrder(sortOptions.colIndex);
32249
+ ce["dataColumnName"] = this.getColumnSortingField(sortOptions.colIndex); // This should be deprecated
32250
+ this._dispatch("clicked", ce);
32251
+ }
32035
32252
  };
32036
32253
 
32037
32254
  /** Sort multiple columns at once
@@ -32430,14 +32647,6 @@ SortableTitlePlugin.prototype._proceedSorting = function (hitObj) {
32430
32647
  if(grid && grid["focus"]) {
32431
32648
  grid["focus"]();
32432
32649
  }
32433
-
32434
- if (this._hasListener("clicked")) {
32435
- let ce = {};
32436
- ce["colIndex"] = colIndex;
32437
- ce["sortOrder"] = this.getSortOrder(colIndex);
32438
- ce["dataColumnName"] = this.getColumnSortingField(colIndex); // This should be deprecated
32439
- this._dispatch("clicked", ce);
32440
- }
32441
32650
  }
32442
32651
  };
32443
32652