@refinitiv-ui/efx-grid 6.0.46 → 6.0.47

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.
@@ -14948,6 +14948,14 @@ DataTable.prototype._removedRows = null;
14948
14948
  */
14949
14949
  DataTable.prototype._userSegmentComparer = null;
14950
14950
  /** @private
14951
+ * @type {number}
14952
+ */
14953
+ DataTable.prototype._segmentSortOrder = 0;
14954
+ /** @private
14955
+ * @type {*}
14956
+ */
14957
+ DataTable.prototype._segmentSortContext = null;
14958
+ /** @private
14951
14959
  * @type {Object.<string, Object>}
14952
14960
  */
14953
14961
  DataTable.prototype._clsSource = null;
@@ -16120,6 +16128,51 @@ DataTable.prototype.getSegmentChildIds = function(segmentId) {
16120
16128
  }
16121
16129
  return null;
16122
16130
  };
16131
+ /** Sort all of existing segments by multiple sort logics
16132
+ * @public
16133
+ * @param {Function|Array.<Function>} sortLogics
16134
+ * @param {Array.<number>} sortOrders
16135
+ * @param {Array.<string>} cids
16136
+ * @return {boolean}
16137
+ */
16138
+ DataTable.prototype.sortSeparators = function (sortLogics, sortOrders, cids) {
16139
+ var dirty = false;
16140
+ if(!this._segments){
16141
+ return false;
16142
+ }
16143
+ if(typeof sortLogics === "function"){
16144
+ return this.sortSegments(sortLogics);
16145
+ }
16146
+ var sortingDefs = DataTable._buildSortContext(
16147
+ [],
16148
+ cids,
16149
+ sortOrders,
16150
+ sortLogics
16151
+ );
16152
+ var defCount = sortingDefs ? sortingDefs.length : 0;
16153
+ if(!defCount){
16154
+ return dirty;
16155
+ }
16156
+
16157
+ var sortOrder = 0;
16158
+ var sortLogic, sortContext;
16159
+ if(defCount > 1) {
16160
+ sortLogic = DataTable._multiColumnSeparatorCompareLogic;
16161
+ sortContext = sortingDefs;
16162
+ sortOrder = 1; // sortOrder is not used by _multiColumnSeparatorCompareLogic
16163
+ } else { // Single level sorting
16164
+ sortLogic = DataTable._singleColumnSeparatorCompareLogic;
16165
+ sortContext = sortingDefs[0];
16166
+ sortOrder = /** @type{number} */(sortContext[3]);
16167
+ }
16168
+ this._segmentSortOrder = sortOrder;
16169
+ this._segmentSortContext = sortContext;
16170
+ dirty = this.sortSegments(sortLogic);
16171
+ this._segmentSortOrder = 0;
16172
+ this._segmentSortContext = null;
16173
+
16174
+ return dirty;
16175
+ };
16123
16176
  /** Sort all of existing segments by given compare function
16124
16177
  * @public
16125
16178
  * @param {Function} compare
@@ -16188,7 +16241,9 @@ DataTable.prototype.sortSegments = function (compare) {
16188
16241
  DataTable.prototype._bySegmentSeparator = function (segmentA, segmentB) {
16189
16242
  return /** @type{number} */(this._userSegmentComparer(
16190
16243
  this.getRowData(segmentA.getId()),
16191
- this.getRowData(segmentB.getId())
16244
+ this.getRowData(segmentB.getId()),
16245
+ this._segmentSortOrder,
16246
+ this._segmentSortContext
16192
16247
  ));
16193
16248
  };
16194
16249
 
@@ -16529,6 +16584,47 @@ DataTable._singleColumnCompareLogic = function(a, b, order, sortingDef) {
16529
16584
  sortingDef[4] // Context object
16530
16585
  ));
16531
16586
  };
16587
+ /** Performance is extremely vital in this method
16588
+ * @public
16589
+ * @ignore
16590
+ * @function
16591
+ * @param {*} a
16592
+ * @param {*} b
16593
+ * @param {number} order Not used by in this method
16594
+ * @param {Array.<Array>} sortingDefs
16595
+ * @return {number}
16596
+ */
16597
+ DataTable._multiColumnSeparatorCompareLogic = function(a, b, order, sortingDefs) {
16598
+ var count = sortingDefs.length;
16599
+ var result = 0;
16600
+ for(var c = 0; c < count; ++c) {
16601
+ var sortingDef = sortingDefs[c];
16602
+ result = DataTable._singleColumnSeparatorCompareLogic(a, b, sortingDef[3], sortingDef);
16603
+ if(result) {
16604
+ return result;
16605
+ }
16606
+ }
16607
+ return result;
16608
+ };
16609
+ /** Performance is extremely vital in this method
16610
+ * @public
16611
+ * @ignore
16612
+ * @function
16613
+ * @param {*} a
16614
+ * @param {*} b
16615
+ * @param {number} order
16616
+ * @param {Array} sortingDef
16617
+ * @return {number}
16618
+ */
16619
+ DataTable._singleColumnSeparatorCompareLogic = function(a, b, order, sortingDef) {
16620
+ var key = /** @type{string} */(sortingDef[0]);
16621
+ return /** @type{number} */(sortingDef[2](
16622
+ a[key], // Value1
16623
+ b[key], // Value2
16624
+ order, // Sort order (3)
16625
+ sortingDef[4] // Context object
16626
+ ));
16627
+ };
16532
16628
  /** @public
16533
16629
  * @function
16534
16630
  * @ignore
@@ -21283,6 +21379,15 @@ DataView.prototype.getSegmentIds = function() {
21283
21379
  DataView.prototype.getSegmentChildIds = function(segmentRef) {
21284
21380
  return this._dt.getSegmentChildIds(this._toRowId(segmentRef));
21285
21381
  };
21382
+ /** Sort all of existing segments by multiple sort logics
21383
+ * @public
21384
+ * @param {Array.<Function>} sortLogics
21385
+ * @param {Array.<number>} sortOrders
21386
+ * @param {Array.<string>} cids
21387
+ */
21388
+ DataView.prototype.sortSeparators = function (sortLogics, sortOrders, cids) {
21389
+ this._dt.sortSeparators(sortLogics, sortOrders, cids);
21390
+ };
21286
21391
  /** Sort all of existing segments by given compare function
21287
21392
  * @public
21288
21393
  * @param {Function} compare
@@ -25913,7 +26018,7 @@ Core_Core.prototype._batches = null;
25913
26018
  * @return {string}
25914
26019
  */
25915
26020
  Core_Core.getVersion = function () {
25916
- return "5.1.65";
26021
+ return "5.1.66";
25917
26022
  };
25918
26023
  /** {@link ElementWrapper#dispose}
25919
26024
  * @override
@@ -32551,6 +32656,28 @@ SortableTitlePlugin.prototype.setSortingSequence = function (sequence, colRef) {
32551
32656
  SortableTitlePlugin.prototype.clearAllColumnSortingSequences = function () {
32552
32657
  this._sortingSequenceMap = null;
32553
32658
  };
32659
+ /** @public
32660
+ * @description Sorting all separators according to compare function. If compare function is not specified, separators will will be sort by current sorting states.
32661
+ * @param {Function} comparer Compare function
32662
+ */
32663
+ SortableTitlePlugin.prototype.sortSeparators = function (comparer) {
32664
+ var host = this._hosts[0];
32665
+ var dv = host.getDataSource();
32666
+ if(comparer){
32667
+ dv.sortSeparators(comparer);
32668
+ } else {
32669
+ var sortLogics = dv.getSortingLogics();
32670
+ var sortOrders = [];
32671
+ var sortFields = [];
32672
+ var sortStateCount = this._sortStates.length;
32673
+ for(var i = 0; i < sortStateCount; i++){
32674
+ var sortState = this._sortStates[i];
32675
+ sortOrders.push(sortState["sortOrder"]);
32676
+ sortFields.push(sortState["field"]);
32677
+ }
32678
+ dv.sortSeparators(sortLogics, sortOrders, sortFields);
32679
+ }
32680
+ };
32554
32681
 
32555
32682
 
32556
32683
  /** @private