@refinitiv-ui/efx-grid 6.0.38 → 6.0.39

Sign up to get free protection for your applications and to get access to all the features.
@@ -3667,18 +3667,18 @@ TrackLayout.prototype.showLane = function (index, opt_val) {
3667
3667
  };
3668
3668
  /** @public
3669
3669
  * @param {number} index
3670
- * @param {boolean=} opt_hidden
3671
- * @param {number=} opt_bitIndex
3670
+ * @param {boolean=} hidden
3671
+ * @param {number=} bitIndex
3672
3672
  * @return {boolean}
3673
3673
  */
3674
- TrackLayout.prototype.hideLane = function (index, opt_hidden, opt_bitIndex) {
3674
+ TrackLayout.prototype.hideLane = function (index, hidden, bitIndex) {
3675
3675
  if (index < 0 || index >= this._laneCount) { return false; }
3676
3676
 
3677
3677
  var col = this._newColumn(index);
3678
3678
  var prevVis = !col.invisibility;
3679
3679
 
3680
- var bit = (opt_bitIndex != null) ? this._bits[opt_bitIndex] : 1;
3681
- if(opt_hidden !== false) {
3680
+ var bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
3681
+ if(hidden !== false) {
3682
3682
  col.invisibility |= bit; // Add invisibility bit
3683
3683
  } else {
3684
3684
  col.invisibility &= ~bit; // Remove invisibility bit
@@ -3689,6 +3689,24 @@ TrackLayout.prototype.hideLane = function (index, opt_hidden, opt_bitIndex) {
3689
3689
  }
3690
3690
  return false;
3691
3691
  };
3692
+ /** Return true if the lane does not exist nor is not hidden. Return false only if the lane is hidden by the specified bit
3693
+ * @public
3694
+ * @param {number} index
3695
+ * @param {number=} bitIndex
3696
+ * @return {boolean}
3697
+ */
3698
+ TrackLayout.prototype.getLaneVisibilityBit = function (index, bitIndex) {
3699
+ if (index >= 0 && index < this._laneCount) {
3700
+ var col = this._cols[index];
3701
+ if(col) {
3702
+ var bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
3703
+ if(col.invisibility & bit) {
3704
+ return false;
3705
+ }
3706
+ }
3707
+ }
3708
+ return true;
3709
+ };
3692
3710
  /** @public
3693
3711
  * @param {boolean=} opt_shown
3694
3712
  */
@@ -11631,6 +11649,13 @@ GroupDefinitions.prototype.getGroups = function () {
11631
11649
  }
11632
11650
  return groupDefs;
11633
11651
  };
11652
+ /** Get array of all existing group ids
11653
+ * @public
11654
+ * @return {!Array.<string>}
11655
+ */
11656
+ GroupDefinitions.prototype.getGroupIds = function () {
11657
+ return Object.keys(this._groupMap);
11658
+ };
11634
11659
  /** @public
11635
11660
  * @return {!Object.<string, Object>}
11636
11661
  */
@@ -11737,7 +11762,18 @@ GroupDefinitions.prototype.getParentId = function (childId, groupLevel) {
11737
11762
  return parentId || "";
11738
11763
  };
11739
11764
 
11740
-
11765
+ /** Remove all existing group definitions
11766
+ * @public
11767
+ * @return {boolean}
11768
+ */
11769
+ GroupDefinitions.prototype.removeAllGroups = function () {
11770
+ for(var groupId in this._groupMap) { // eslint-disable-line
11771
+ this._groupMap = {};
11772
+ this._childToParent = {};
11773
+ return true;
11774
+ }
11775
+ return false;
11776
+ };
11741
11777
  /** Remove all existing group definitions and replace them with the given definitions.
11742
11778
  * @public
11743
11779
  * @param {Array.<Object>=} groupDefs Use null or empty array to remove all existing groups
@@ -11882,9 +11918,10 @@ GroupDefinitions.prototype.hasGroupChild = function (parentId, childId) {
11882
11918
  /** @public
11883
11919
  * @param {string} parentId Group id
11884
11920
  * @param {string} childId
11921
+ * @param {number=} position
11885
11922
  * @return {boolean}
11886
11923
  */
11887
- GroupDefinitions.prototype.addGroupChild = function (parentId, childId) {
11924
+ GroupDefinitions.prototype.addGroupChild = function (parentId, childId, position) {
11888
11925
  var groupDef = this._groupMap[parentId];
11889
11926
 
11890
11927
  if(childId && groupDef) {
@@ -11897,7 +11934,11 @@ GroupDefinitions.prototype.addGroupChild = function (parentId, childId) {
11897
11934
  if(childDef) {
11898
11935
  childDef.parentId = parentId;
11899
11936
  }
11900
- chdr.push(childId);
11937
+ if(position != null && position >= 0) {
11938
+ chdr.splice(position, 0, childId);
11939
+ } else {
11940
+ chdr.push(childId);
11941
+ }
11901
11942
  return true;
11902
11943
  }
11903
11944
  }
@@ -12006,6 +12047,18 @@ GroupDefinitions.prototype.setGroupChildren = function (groupId, newChildList) {
12006
12047
  }
12007
12048
  return false;
12008
12049
  };
12050
+
12051
+ /** @public
12052
+ * @param {string} groupId
12053
+ * @return {string}
12054
+ */
12055
+ GroupDefinitions.prototype.getGroupName = function (groupId) {
12056
+ var groupDef = this._groupMap[groupId];
12057
+ if(groupDef) {
12058
+ return groupDef.name || "";
12059
+ }
12060
+ return "";
12061
+ };
12009
12062
  /** @public
12010
12063
  * @param {string} groupId
12011
12064
  * @param {string} groupName
@@ -12022,6 +12075,7 @@ GroupDefinitions.prototype.setGroupName = function (groupId, groupName) {
12022
12075
 
12023
12076
  return false;
12024
12077
  };
12078
+
12025
12079
  /* harmony default export */ const es6_GroupDefinitions = ((/* unused pure expression or super */ null && (GroupDefinitions)));
12026
12080
 
12027
12081
 
@@ -25861,7 +25915,7 @@ Core_Core.prototype._batches = null;
25861
25915
  * @return {string}
25862
25916
  */
25863
25917
  Core_Core.getVersion = function () {
25864
- return "5.1.52";
25918
+ return "5.1.55";
25865
25919
  };
25866
25920
  /** {@link ElementWrapper#dispose}
25867
25921
  * @override
@@ -28240,7 +28294,7 @@ Core_Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
28240
28294
  }
28241
28295
  if(numRightColumn != null) {
28242
28296
  rightPinnedCount = numRightColumn > 0 ? numRightColumn : 0;
28243
- if (this._pinnedLeftColumnCount !== rightPinnedCount) {
28297
+ if (this._pinnedRightColumnCount !== rightPinnedCount) {
28244
28298
  dirty = true;
28245
28299
  this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
28246
28300
  }
@@ -29246,7 +29300,7 @@ Core_Core.prototype.getHorizontalLayout = function () {
29246
29300
  * @ignore
29247
29301
  * @param {number} colIndex
29248
29302
  * @param {boolean} bool
29249
- * @param {number} flag Default is 0
29303
+ * @param {number} flag
29250
29304
  * @return {boolean}
29251
29305
  */
29252
29306
  Core_Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
@@ -29266,6 +29320,16 @@ Core_Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
29266
29320
  }
29267
29321
  return false;
29268
29322
  };
29323
+ /** Get visibility state for the specified flag. This is for internal use only
29324
+ * @public
29325
+ * @ignore
29326
+ * @param {number} colIndex
29327
+ * @param {number=} flag
29328
+ * @return {boolean}
29329
+ */
29330
+ Core_Core.prototype.getColumnVisibility = function (colIndex, flag) {
29331
+ return this._layoutX.getLaneVisibilityBit(colIndex, flag);
29332
+ };
29269
29333
 
29270
29334
  /** @public
29271
29335
  * @param {number} size
@@ -31217,6 +31281,7 @@ es6_Ext.inherits(SortableTitlePlugin, event_EventDispatcher);
31217
31281
  /** The sorting object which will be used for initialSort config.
31218
31282
  * @typedef {Object} SortableTitlePlugin~InitialSort
31219
31283
  * @property {number} colIndex Index of the column
31284
+ * @property {string} field field of the column
31220
31285
  * @property {SortableTitlePlugin~SortOrder=} sortOrder=null Set to "d" for descending order and "a" for ascending order
31221
31286
  * @property {SortableTitlePlugin~SortOrder=} order Alias of sortOrder
31222
31287
  */
@@ -31226,6 +31291,8 @@ SortableTitlePlugin.InitialSort;
31226
31291
  * @typedef {Object} SortableTitlePlugin~ColumnOptions
31227
31292
  * @property {boolean=} sortable=false If enable, the column can be sorted by user click
31228
31293
  * @property {string=} sortBy Field to be used for sorting. If defined, user can click at the header section to sort the column
31294
+ * @property {string=} sort="" Deprecated Alias to `sortOrder`
31295
+ * @property {string=} sortOrder="" The column can be sorted in ascending and descending order by specifying the order "a", "d". This option will sort the column when it is initialized or inserted at runtime.
31229
31296
  * @property {DataTable.SortLogic=} sortLogic=null Custom compare function for sorting
31230
31297
  * @property {DataTable.SortLogic=} sortingLogic Alias to `sortLogic`
31231
31298
  * @property {DataTable.SortLogic=} sorter Alias to `sortLogic`
@@ -31430,7 +31497,7 @@ SortableTitlePlugin.prototype.afterInit = function () {
31430
31497
  // Set logic to the data source, since the data source not available during the initialization
31431
31498
  t.setSortLogics(t._sortLogic);
31432
31499
 
31433
- var userInput = t._initialSort;
31500
+ var userInput = t._initialSort; // This will be passed from the user when they want to start with initialize sort
31434
31501
  if (userInput != null) {
31435
31502
  if(Array.isArray(userInput)) {
31436
31503
  if(t._maxCount === 1) { // TODO: max count could be part of sortColumns method
@@ -31579,14 +31646,32 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
31579
31646
 
31580
31647
  if (!host) return obj;
31581
31648
 
31582
- var len = host.getColumnCount();
31583
- var col, opt, field;
31584
- for(var i = 0; i < len; ++i) {
31649
+ var sortedColumns = this.getSortedColumns();
31650
+ var col, i, len;
31651
+ // Multiple column sorting cannot retain the sort order in the column option.
31652
+ if(this._maxCount === 1 && sortedColumns != null) {
31653
+ // assign sorting state to each columns
31654
+ len = sortedColumns.length;
31655
+ for (i = 0; i < len; i++) {
31656
+ var sortedColumn = sortedColumns[i];
31657
+ var colIndex = sortedColumn["colIndex"];
31658
+ col = columns[colIndex];
31659
+ if (!col) {
31660
+ col = columns[colIndex] = {};
31661
+ }
31662
+ col["sortOrder"] = sortedColumn["sortOrder"];
31663
+ }
31664
+ }
31665
+
31666
+ len = host.getColumnCount();
31667
+ var opt, field;
31668
+ for(i = 0; i < len; ++i) {
31585
31669
  col = columns[i];
31586
31670
  if (!col) {
31587
31671
  col = columns[i] = {};
31588
31672
  }
31589
31673
 
31674
+ // TODO: We should get the state from the core, instead of getting the sort options.
31590
31675
  opt = this._getSortOptions(i);
31591
31676
 
31592
31677
  if (!opt) { continue; }
@@ -31600,7 +31685,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
31600
31685
  }
31601
31686
  field = opt["field"];
31602
31687
  if (field) {
31603
- if(col["field"] !== field) {
31688
+ if(col["field"] != null && col["field"] !== field) { // Core does not have field properties, so when you try to call getConfigObject in Core, it will return sortBy too.
31604
31689
  col["sortBy"] = field;
31605
31690
  } // else The default value is an empty sortBy, which refers to the same column field by default.
31606
31691
 
@@ -31616,7 +31701,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
31616
31701
  extOptions = obj["sorting"] = {};
31617
31702
  }
31618
31703
 
31619
- var val = this.getSortedColumns();
31704
+ var val = sortedColumns;
31620
31705
  if(val != null) {
31621
31706
  extOptions["initialSort"] = val;
31622
31707
  }
@@ -32123,7 +32208,14 @@ SortableTitlePlugin.prototype.disableTwoStateSorting = function (disabled) {
32123
32208
  * @param {boolean=} bool=true, if set to false it will be unfreeze indicator
32124
32209
  */
32125
32210
  SortableTitlePlugin.prototype.freezeIndicator = function (bool) {
32211
+ var prevState = this._frozenIndicator;
32126
32212
  this._frozenIndicator = bool !== false;
32213
+ if(prevState && !this._frozenIndicator) { // from frozen to unfrozen, update the ui
32214
+ for (var i = this._hosts.length; --i >= 0;) {
32215
+ this._updateSortableIndicator(i);
32216
+ }
32217
+ }
32218
+
32127
32219
  };
32128
32220
  /** @public
32129
32221
  * @param {boolean=} disabled
@@ -32199,7 +32291,7 @@ SortableTitlePlugin.prototype._initialSortByColumnField = function (options) {
32199
32291
  var colCount = columns ? columns.length : 0;
32200
32292
  for (var i = 0; i < colCount; i++) {
32201
32293
  var column = columns[i];
32202
- var sortOrder = column["defaultSort"] || column["sort"]; // composite and rt grid option for default sort order
32294
+ var sortOrder = column["defaultSort"]; // composite and rt grid option for default sort order
32203
32295
  if (sortOrder) {
32204
32296
  // TODO: Support multi-column sorting
32205
32297
  return {
@@ -32629,6 +32721,12 @@ SortableTitlePlugin.prototype._onColumnAdded = function (e) {
32629
32721
  } else {
32630
32722
  t.disableColumnSorting(colIndex, true);
32631
32723
  }
32724
+
32725
+ var sortOrder = column["sortOrder"] || column["sort"];
32726
+ if(sortOrder != null) {
32727
+ t.clearSortState(); // clear previous sorting state
32728
+ t.sortColumn(colIndex, sortOrder);
32729
+ }
32632
32730
  };
32633
32731
 
32634
32732
  /** @private