@refinitiv-ui/efx-grid 6.0.37 → 6.0.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. package/lib/core/dist/core.js +165 -20
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/grid/Core.d.ts +2 -0
  4. package/lib/core/es6/grid/Core.js +62 -5
  5. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +3 -0
  6. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +41 -7
  7. package/lib/core/es6/grid/util/TrackLayout.d.ts +3 -1
  8. package/lib/core/es6/grid/util/TrackLayout.js +23 -5
  9. package/lib/grid/index.js +1 -1
  10. package/lib/rt-grid/dist/rt-grid.js +158 -48
  11. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  12. package/lib/rt-grid/es6/ColumnDefinition.js +4 -3
  13. package/lib/rt-grid/es6/Grid.d.ts +1 -1
  14. package/lib/rt-grid/es6/Grid.js +63 -29
  15. package/lib/rt-grid/es6/RowDefinition.js +6 -6
  16. package/lib/tr-grid-cell-selection/es6/CellSelection.js +180 -421
  17. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -0
  18. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +221 -2
  19. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +7 -1
  20. package/lib/tr-grid-column-stack/es6/ColumnStack.js +281 -69
  21. package/lib/tr-grid-row-dragging/es6/RowDragging.js +83 -3
  22. package/lib/tr-grid-row-selection/es6/RowSelection.js +18 -40
  23. package/lib/tr-grid-util/es6/GridPlugin.js +91 -42
  24. package/lib/types/es6/ColumnGrouping.d.ts +4 -0
  25. package/lib/types/es6/ColumnStack.d.ts +7 -1
  26. package/lib/types/es6/Core/grid/Core.d.ts +2 -0
  27. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +3 -1
  28. package/lib/types/es6/RealtimeGrid/Grid.d.ts +1 -1
  29. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -2
  30. package/lib/versions.json +6 -6
  31. package/package.json +1 -1
@@ -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
 
@@ -25398,6 +25452,7 @@ var Core_Core = function (opt_initializer) {
25398
25452
  _t._onVScroll = _t._onVScroll.bind(_t);
25399
25453
  _t._onHScroll = _t._onHScroll.bind(_t);
25400
25454
  _t._onSyncVScroll = _t._onSyncVScroll.bind(_t);
25455
+ _t._onSyncHScroll = _t._onSyncHScroll.bind(_t);
25401
25456
  _t.updateLayout = _t.updateLayout.bind(_t);
25402
25457
  _t._onRowRefresh = _t._onRowRefresh.bind(_t);
25403
25458
  _t._onVScrollEnabled = _t._onVScrollEnabled.bind(_t);
@@ -25510,7 +25565,8 @@ var Core_Core = function (opt_initializer) {
25510
25565
  "rowPositionChanged",
25511
25566
  "beforeColumnBoundUpdate",
25512
25567
  "beforeBatchOperation",
25513
- "afterBatchOperation"
25568
+ "afterBatchOperation",
25569
+ "pinningChanged"
25514
25570
  );
25515
25571
 
25516
25572
  // For debugging in advanced optimization mode
@@ -25859,7 +25915,7 @@ Core_Core.prototype._batches = null;
25859
25915
  * @return {string}
25860
25916
  */
25861
25917
  Core_Core.getVersion = function () {
25862
- return "5.1.50";
25918
+ return "5.1.55";
25863
25919
  };
25864
25920
  /** {@link ElementWrapper#dispose}
25865
25921
  * @override
@@ -25901,6 +25957,12 @@ Core_Core.prototype.dispose = function () {
25901
25957
  mainScrolbar.unlisten("scroll", this._onSyncVScroll);
25902
25958
  this._vscrollbar._mainScrollbar = null;
25903
25959
  }
25960
+ mainScrolbar = this._hscrollbar._mainScrollbar;
25961
+ if(mainScrolbar) {
25962
+ mainScrolbar.unlisten("scroll", this._onSyncHScroll);
25963
+ this._hscrollbar._mainScrollbar = null;
25964
+ }
25965
+
25904
25966
  this._vscrollbar.dispose();
25905
25967
  this._hscrollbar.dispose();
25906
25968
  this._rowHeightConflator.dispose();
@@ -28214,10 +28276,14 @@ Core_Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
28214
28276
  var colCount = this.getColumnCount();
28215
28277
  var leftPinnedCount = 0;
28216
28278
  var rightPinnedCount = 0;
28279
+ var dirty = false;
28217
28280
  if (frozenColIndex || frozenColIndex === 0) {
28218
28281
  this._hScrollbarEnabled = true;
28219
28282
  leftPinnedCount = (frozenColIndex >= 0) ? frozenColIndex + 1 : 0;
28220
- this._pinnedLeftColumnCount = leftPinnedCount; // This variable is used for caching
28283
+ if (this._pinnedLeftColumnCount !== leftPinnedCount) {
28284
+ dirty = true;
28285
+ this._pinnedLeftColumnCount = leftPinnedCount; // This variable is used for caching
28286
+ }
28221
28287
 
28222
28288
  for (i = 0; i < colCount; ++i) {
28223
28289
  colDef = this._getColumnDef(i);
@@ -28228,7 +28294,10 @@ Core_Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
28228
28294
  }
28229
28295
  if(numRightColumn != null) {
28230
28296
  rightPinnedCount = numRightColumn > 0 ? numRightColumn : 0;
28231
- this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
28297
+ if (this._pinnedRightColumnCount !== rightPinnedCount) {
28298
+ dirty = true;
28299
+ this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
28300
+ }
28232
28301
 
28233
28302
  for (i = colCount; --i >= 0;) {
28234
28303
  colDef = this._getColumnDef(i);
@@ -28239,6 +28308,12 @@ Core_Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
28239
28308
  this._onColumnCountChanged(); // Activate horizontal scrollbar and column virtualization
28240
28309
  this._updateScrollbarWidth(true, true);
28241
28310
  this._updateColumnSeparators();
28311
+
28312
+ if (dirty) {
28313
+ if (!this._isEventDispatching("pinningChanged")) {
28314
+ this._dispatch("pinningChanged", {});
28315
+ }
28316
+ }
28242
28317
  };
28243
28318
 
28244
28319
  /** @private
@@ -29063,6 +29138,26 @@ Core_Core.prototype.synchronizeVScrollbar = function (subGrid) {
29063
29138
  this._vscrollbar.listen("scroll", subGrid._onSyncVScroll);
29064
29139
  };
29065
29140
 
29141
+ /** Synchronize two horizontal scrollbars of two grid, by hiding its scrollbar and using the one from the given grid
29142
+ * @public
29143
+ * @param {Core} subGrid
29144
+ */
29145
+ Core_Core.prototype.synchronizeHScrollbar = function (subGrid) {
29146
+ subGrid.unlisten("mousemove", subGrid._onMouseMove);
29147
+ subGrid.listen("mousemove", this._onMouseMove);
29148
+
29149
+ var hscrollbar = subGrid.getHScrollbar();
29150
+ hscrollbar._mainScrollbar = this._hscrollbar; // HACK
29151
+
29152
+ hscrollbar.setStyle("visibility", "hidden");
29153
+ hscrollbar.setStyle("pointerEvents", "none");
29154
+ hscrollbar.disableMouseWheel(); // Disable sub-grid wheel behavior
29155
+ hscrollbar.attachToExternalElement(this._hscrollbar.getParent()); // MouseWheel event is still available on the main
29156
+
29157
+ // TODO: Check if we need to re-append this._hscrollbar to move it to the front over other grid elements.
29158
+ this._hscrollbar.listen("scroll", subGrid._onSyncHScroll);
29159
+ };
29160
+
29066
29161
  /** Fires data binding event without actual change in the data source. <br>
29067
29162
  * This will force visual elements to be re-rendered with the latest data in the data source.
29068
29163
  * @public
@@ -29205,7 +29300,7 @@ Core_Core.prototype.getHorizontalLayout = function () {
29205
29300
  * @ignore
29206
29301
  * @param {number} colIndex
29207
29302
  * @param {boolean} bool
29208
- * @param {number} flag Default is 0
29303
+ * @param {number} flag
29209
29304
  * @return {boolean}
29210
29305
  */
29211
29306
  Core_Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
@@ -29225,6 +29320,16 @@ Core_Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
29225
29320
  }
29226
29321
  return false;
29227
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
+ };
29228
29333
 
29229
29334
  /** @public
29230
29335
  * @param {number} size
@@ -30718,6 +30823,12 @@ Core_Core.prototype._onSyncVScroll = function (e) {
30718
30823
  this._vscrollbar.setScrollTop(e.scrollTop);
30719
30824
  };
30720
30825
  /** @private
30826
+ * @param {Object} e
30827
+ */
30828
+ Core_Core.prototype._onSyncHScroll = function (e) {
30829
+ this._hscrollbar.setScrollLeft(e.scrollLeft);
30830
+ };
30831
+ /** @private
30721
30832
  * @return {number} index of footer section
30722
30833
  */
30723
30834
  Core_Core.prototype._getFooterStartIndex = function () {
@@ -31170,6 +31281,7 @@ es6_Ext.inherits(SortableTitlePlugin, event_EventDispatcher);
31170
31281
  /** The sorting object which will be used for initialSort config.
31171
31282
  * @typedef {Object} SortableTitlePlugin~InitialSort
31172
31283
  * @property {number} colIndex Index of the column
31284
+ * @property {string} field field of the column
31173
31285
  * @property {SortableTitlePlugin~SortOrder=} sortOrder=null Set to "d" for descending order and "a" for ascending order
31174
31286
  * @property {SortableTitlePlugin~SortOrder=} order Alias of sortOrder
31175
31287
  */
@@ -31179,6 +31291,8 @@ SortableTitlePlugin.InitialSort;
31179
31291
  * @typedef {Object} SortableTitlePlugin~ColumnOptions
31180
31292
  * @property {boolean=} sortable=false If enable, the column can be sorted by user click
31181
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.
31182
31296
  * @property {DataTable.SortLogic=} sortLogic=null Custom compare function for sorting
31183
31297
  * @property {DataTable.SortLogic=} sortingLogic Alias to `sortLogic`
31184
31298
  * @property {DataTable.SortLogic=} sorter Alias to `sortLogic`
@@ -31383,7 +31497,7 @@ SortableTitlePlugin.prototype.afterInit = function () {
31383
31497
  // Set logic to the data source, since the data source not available during the initialization
31384
31498
  t.setSortLogics(t._sortLogic);
31385
31499
 
31386
- var userInput = t._initialSort;
31500
+ var userInput = t._initialSort; // This will be passed from the user when they want to start with initialize sort
31387
31501
  if (userInput != null) {
31388
31502
  if(Array.isArray(userInput)) {
31389
31503
  if(t._maxCount === 1) { // TODO: max count could be part of sortColumns method
@@ -31532,14 +31646,32 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
31532
31646
 
31533
31647
  if (!host) return obj;
31534
31648
 
31535
- var len = host.getColumnCount();
31536
- var col, opt, field;
31537
- 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) {
31538
31669
  col = columns[i];
31539
31670
  if (!col) {
31540
31671
  col = columns[i] = {};
31541
31672
  }
31542
31673
 
31674
+ // TODO: We should get the state from the core, instead of getting the sort options.
31543
31675
  opt = this._getSortOptions(i);
31544
31676
 
31545
31677
  if (!opt) { continue; }
@@ -31553,7 +31685,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
31553
31685
  }
31554
31686
  field = opt["field"];
31555
31687
  if (field) {
31556
- 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.
31557
31689
  col["sortBy"] = field;
31558
31690
  } // else The default value is an empty sortBy, which refers to the same column field by default.
31559
31691
 
@@ -31569,7 +31701,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
31569
31701
  extOptions = obj["sorting"] = {};
31570
31702
  }
31571
31703
 
31572
- var val = this.getSortedColumns();
31704
+ var val = sortedColumns;
31573
31705
  if(val != null) {
31574
31706
  extOptions["initialSort"] = val;
31575
31707
  }
@@ -32076,7 +32208,14 @@ SortableTitlePlugin.prototype.disableTwoStateSorting = function (disabled) {
32076
32208
  * @param {boolean=} bool=true, if set to false it will be unfreeze indicator
32077
32209
  */
32078
32210
  SortableTitlePlugin.prototype.freezeIndicator = function (bool) {
32211
+ var prevState = this._frozenIndicator;
32079
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
+
32080
32219
  };
32081
32220
  /** @public
32082
32221
  * @param {boolean=} disabled
@@ -32152,7 +32291,7 @@ SortableTitlePlugin.prototype._initialSortByColumnField = function (options) {
32152
32291
  var colCount = columns ? columns.length : 0;
32153
32292
  for (var i = 0; i < colCount; i++) {
32154
32293
  var column = columns[i];
32155
- 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
32156
32295
  if (sortOrder) {
32157
32296
  // TODO: Support multi-column sorting
32158
32297
  return {
@@ -32582,6 +32721,12 @@ SortableTitlePlugin.prototype._onColumnAdded = function (e) {
32582
32721
  } else {
32583
32722
  t.disableColumnSorting(colIndex, true);
32584
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
+ }
32585
32730
  };
32586
32731
 
32587
32732
  /** @private