@refinitiv-ui/efx-grid 6.0.37 → 6.0.39

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 (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
@@ -13277,7 +13277,7 @@ RowDefinition.prototype._permId = "";
13277
13277
  /** @type {string|null}
13278
13278
  * @private
13279
13279
  */
13280
- RowDefinition.prototype._label = null; // Label overrides _ric and _displayText
13280
+ RowDefinition.prototype._label = null; // Label overrides _ric and _permId
13281
13281
  /** @type {boolean|null}
13282
13282
  * @private
13283
13283
  */
@@ -13444,15 +13444,15 @@ RowDefinition.prototype.initialize = function(rowOptions) {
13444
13444
 
13445
13445
  var expanded = this._expanded;
13446
13446
  var symbol = this._ric || this._chainRic;
13447
- var asChain = rowOptions["asChain"] || !!this._chainRic;
13447
+ var asChain = this._isChain || !!this._chainRic;
13448
13448
  if(this._ric && this._ric.indexOf("0#") >= 0){
13449
13449
  asChain = true;
13450
13450
  expanded = true;
13451
13451
  }
13452
- if(rowOptions["asChain"] === false){
13452
+ if(this._isChain === false){
13453
13453
  asChain = false;
13454
13454
  }
13455
- if(rowOptions["collapsed"] === true){
13455
+ if(this._expanded === false){
13456
13456
  expanded = false;
13457
13457
  }
13458
13458
  if(symbol || this._permId){
@@ -13467,7 +13467,7 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
13467
13467
  var parentDef = /** @type{RowDefinition} */(rowOptions["parent"]);
13468
13468
  if(this.setParent(parentDef)) {
13469
13469
  this._dataId = /** @type{string} */(rowOptions["dataId"]); // Constituent will have the same subId as its parent but with different ric
13470
-
13470
+ this._ric = /** @type{string} */(rowOptions["ric"]);
13471
13471
  this._dc = parentDef._dc; // Parent chain must have data cache
13472
13472
  if(this._dc) {
13473
13473
  var rowData = this.getRowData(); // Do not trigger any data update
@@ -13522,7 +13522,7 @@ RowDefinition.prototype.setContent = function(userInput, permId, asChain, expand
13522
13522
  if(asChain === false){
13523
13523
  this._ric = this._userInput;
13524
13524
  } else {
13525
- this._ric = expanded ? this._userInput.replace("0#", "") : this._userInput;
13525
+ this._ric = expanded === false ? this._userInput : this._userInput.replace("0#", "");
13526
13526
  this._expanded = expanded;
13527
13527
  this._isChain = true; // Only chain can be expanded by 0#
13528
13528
  this._chainRic = this._userInput;
@@ -15803,10 +15803,11 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
15803
15803
  obj["minWidth"] = value;
15804
15804
  }
15805
15805
 
15806
- value = core.isColumnVisible(colIndex);
15807
15806
  // If "hidden" property already available from core/extensions, don't override this property
15808
- if(!value && obj["hidden"] == null) {
15809
- obj["hidden"] = true;
15807
+ if(obj["hidden"] == null) {
15808
+ if(!core.getColumnVisibility(colIndex, 0)) {
15809
+ obj["hidden"] = true;
15810
+ }
15810
15811
  }
15811
15812
 
15812
15813
  value = core.getColumnAlignment(colIndex);
@@ -19313,18 +19314,18 @@ TrackLayout.prototype.showLane = function (index, opt_val) {
19313
19314
  };
19314
19315
  /** @public
19315
19316
  * @param {number} index
19316
- * @param {boolean=} opt_hidden
19317
- * @param {number=} opt_bitIndex
19317
+ * @param {boolean=} hidden
19318
+ * @param {number=} bitIndex
19318
19319
  * @return {boolean}
19319
19320
  */
19320
- TrackLayout.prototype.hideLane = function (index, opt_hidden, opt_bitIndex) {
19321
+ TrackLayout.prototype.hideLane = function (index, hidden, bitIndex) {
19321
19322
  if (index < 0 || index >= this._laneCount) { return false; }
19322
19323
 
19323
19324
  var col = this._newColumn(index);
19324
19325
  var prevVis = !col.invisibility;
19325
19326
 
19326
- var bit = (opt_bitIndex != null) ? this._bits[opt_bitIndex] : 1;
19327
- if(opt_hidden !== false) {
19327
+ var bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
19328
+ if(hidden !== false) {
19328
19329
  col.invisibility |= bit; // Add invisibility bit
19329
19330
  } else {
19330
19331
  col.invisibility &= ~bit; // Remove invisibility bit
@@ -19335,6 +19336,24 @@ TrackLayout.prototype.hideLane = function (index, opt_hidden, opt_bitIndex) {
19335
19336
  }
19336
19337
  return false;
19337
19338
  };
19339
+ /** Return true if the lane does not exist nor is not hidden. Return false only if the lane is hidden by the specified bit
19340
+ * @public
19341
+ * @param {number} index
19342
+ * @param {number=} bitIndex
19343
+ * @return {boolean}
19344
+ */
19345
+ TrackLayout.prototype.getLaneVisibilityBit = function (index, bitIndex) {
19346
+ if (index >= 0 && index < this._laneCount) {
19347
+ var col = this._cols[index];
19348
+ if(col) {
19349
+ var bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
19350
+ if(col.invisibility & bit) {
19351
+ return false;
19352
+ }
19353
+ }
19354
+ }
19355
+ return true;
19356
+ };
19338
19357
  /** @public
19339
19358
  * @param {boolean=} opt_shown
19340
19359
  */
@@ -35465,6 +35484,7 @@ var Core = function (opt_initializer) {
35465
35484
  _t._onVScroll = _t._onVScroll.bind(_t);
35466
35485
  _t._onHScroll = _t._onHScroll.bind(_t);
35467
35486
  _t._onSyncVScroll = _t._onSyncVScroll.bind(_t);
35487
+ _t._onSyncHScroll = _t._onSyncHScroll.bind(_t);
35468
35488
  _t.updateLayout = _t.updateLayout.bind(_t);
35469
35489
  _t._onRowRefresh = _t._onRowRefresh.bind(_t);
35470
35490
  _t._onVScrollEnabled = _t._onVScrollEnabled.bind(_t);
@@ -35577,7 +35597,8 @@ var Core = function (opt_initializer) {
35577
35597
  "rowPositionChanged",
35578
35598
  "beforeColumnBoundUpdate",
35579
35599
  "beforeBatchOperation",
35580
- "afterBatchOperation"
35600
+ "afterBatchOperation",
35601
+ "pinningChanged"
35581
35602
  );
35582
35603
 
35583
35604
  // For debugging in advanced optimization mode
@@ -35926,7 +35947,7 @@ Core.prototype._batches = null;
35926
35947
  * @return {string}
35927
35948
  */
35928
35949
  Core.getVersion = function () {
35929
- return "5.1.50";
35950
+ return "5.1.53";
35930
35951
  };
35931
35952
  /** {@link ElementWrapper#dispose}
35932
35953
  * @override
@@ -35968,6 +35989,12 @@ Core.prototype.dispose = function () {
35968
35989
  mainScrolbar.unlisten("scroll", this._onSyncVScroll);
35969
35990
  this._vscrollbar._mainScrollbar = null;
35970
35991
  }
35992
+ mainScrolbar = this._hscrollbar._mainScrollbar;
35993
+ if(mainScrolbar) {
35994
+ mainScrolbar.unlisten("scroll", this._onSyncHScroll);
35995
+ this._hscrollbar._mainScrollbar = null;
35996
+ }
35997
+
35971
35998
  this._vscrollbar.dispose();
35972
35999
  this._hscrollbar.dispose();
35973
36000
  this._rowHeightConflator.dispose();
@@ -38281,10 +38308,14 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
38281
38308
  var colCount = this.getColumnCount();
38282
38309
  var leftPinnedCount = 0;
38283
38310
  var rightPinnedCount = 0;
38311
+ var dirty = false;
38284
38312
  if (frozenColIndex || frozenColIndex === 0) {
38285
38313
  this._hScrollbarEnabled = true;
38286
38314
  leftPinnedCount = (frozenColIndex >= 0) ? frozenColIndex + 1 : 0;
38287
- this._pinnedLeftColumnCount = leftPinnedCount; // This variable is used for caching
38315
+ if (this._pinnedLeftColumnCount !== leftPinnedCount) {
38316
+ dirty = true;
38317
+ this._pinnedLeftColumnCount = leftPinnedCount; // This variable is used for caching
38318
+ }
38288
38319
 
38289
38320
  for (i = 0; i < colCount; ++i) {
38290
38321
  colDef = this._getColumnDef(i);
@@ -38295,7 +38326,10 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
38295
38326
  }
38296
38327
  if(numRightColumn != null) {
38297
38328
  rightPinnedCount = numRightColumn > 0 ? numRightColumn : 0;
38298
- this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
38329
+ if (this._pinnedLeftColumnCount !== rightPinnedCount) {
38330
+ dirty = true;
38331
+ this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
38332
+ }
38299
38333
 
38300
38334
  for (i = colCount; --i >= 0;) {
38301
38335
  colDef = this._getColumnDef(i);
@@ -38306,6 +38340,12 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
38306
38340
  this._onColumnCountChanged(); // Activate horizontal scrollbar and column virtualization
38307
38341
  this._updateScrollbarWidth(true, true);
38308
38342
  this._updateColumnSeparators();
38343
+
38344
+ if (dirty) {
38345
+ if (!this._isEventDispatching("pinningChanged")) {
38346
+ this._dispatch("pinningChanged", {});
38347
+ }
38348
+ }
38309
38349
  };
38310
38350
 
38311
38351
  /** @private
@@ -39130,6 +39170,26 @@ Core.prototype.synchronizeVScrollbar = function (subGrid) {
39130
39170
  this._vscrollbar.listen("scroll", subGrid._onSyncVScroll);
39131
39171
  };
39132
39172
 
39173
+ /** Synchronize two horizontal scrollbars of two grid, by hiding its scrollbar and using the one from the given grid
39174
+ * @public
39175
+ * @param {Core} subGrid
39176
+ */
39177
+ Core.prototype.synchronizeHScrollbar = function (subGrid) {
39178
+ subGrid.unlisten("mousemove", subGrid._onMouseMove);
39179
+ subGrid.listen("mousemove", this._onMouseMove);
39180
+
39181
+ var hscrollbar = subGrid.getHScrollbar();
39182
+ hscrollbar._mainScrollbar = this._hscrollbar; // HACK
39183
+
39184
+ hscrollbar.setStyle("visibility", "hidden");
39185
+ hscrollbar.setStyle("pointerEvents", "none");
39186
+ hscrollbar.disableMouseWheel(); // Disable sub-grid wheel behavior
39187
+ hscrollbar.attachToExternalElement(this._hscrollbar.getParent()); // MouseWheel event is still available on the main
39188
+
39189
+ // TODO: Check if we need to re-append this._hscrollbar to move it to the front over other grid elements.
39190
+ this._hscrollbar.listen("scroll", subGrid._onSyncHScroll);
39191
+ };
39192
+
39133
39193
  /** Fires data binding event without actual change in the data source. <br>
39134
39194
  * This will force visual elements to be re-rendered with the latest data in the data source.
39135
39195
  * @public
@@ -39272,7 +39332,7 @@ Core.prototype.getHorizontalLayout = function () {
39272
39332
  * @ignore
39273
39333
  * @param {number} colIndex
39274
39334
  * @param {boolean} bool
39275
- * @param {number} flag Default is 0
39335
+ * @param {number} flag
39276
39336
  * @return {boolean}
39277
39337
  */
39278
39338
  Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
@@ -39292,6 +39352,16 @@ Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
39292
39352
  }
39293
39353
  return false;
39294
39354
  };
39355
+ /** Get visibility state for the specified flag. This is for internal use only
39356
+ * @public
39357
+ * @ignore
39358
+ * @param {number} colIndex
39359
+ * @param {number=} flag
39360
+ * @return {boolean}
39361
+ */
39362
+ Core.prototype.getColumnVisibility = function (colIndex, flag) {
39363
+ return this._layoutX.getLaneVisibilityBit(colIndex, flag);
39364
+ };
39295
39365
 
39296
39366
  /** @public
39297
39367
  * @param {number} size
@@ -40785,6 +40855,12 @@ Core.prototype._onSyncVScroll = function (e) {
40785
40855
  this._vscrollbar.setScrollTop(e.scrollTop);
40786
40856
  };
40787
40857
  /** @private
40858
+ * @param {Object} e
40859
+ */
40860
+ Core.prototype._onSyncHScroll = function (e) {
40861
+ this._hscrollbar.setScrollLeft(e.scrollLeft);
40862
+ };
40863
+ /** @private
40788
40864
  * @return {number} index of footer section
40789
40865
  */
40790
40866
  Core.prototype._getFooterStartIndex = function () {
@@ -46871,50 +46947,72 @@ Grid.prototype.freezeColumn = function(colIndex, pinnedRightColumns) {
46871
46947
  }
46872
46948
  this._grid.freezeColumn(colIndex, pinnedRightColumns);
46873
46949
  };
46950
+
46874
46951
  /** Pin column to the left side by moving the specified column to the rightmost of the frozen columns. <br>
46875
46952
  * The method will do nothing if the specified column is already pinned to the left side
46876
46953
  * @public
46877
46954
  * @param {Grid~ColumnReference|Array.<Grid~ColumnReference>} colRef
46955
+ * @param {string=} side Available values are: left|right. If no value is supplied, the column will be pinned to the left.
46878
46956
  * @return {boolean}
46879
46957
  */
46880
- Grid.prototype.pinColumn = function(colRef) {
46958
+ Grid.prototype.pinColumn = function(colRef, side) {
46881
46959
  if(Array.isArray(colRef)) {
46882
46960
  var ary = colRef;
46883
46961
  var len = ary.length;
46884
46962
 
46885
46963
  var dirty = 0;
46886
46964
  for(var i = 0; i < len; ++i) {
46887
- dirty |= this._pinColumn(ary[i]);
46965
+ dirty |= this._pinColumn(ary[i], side);
46888
46966
  }
46889
46967
  return dirty ? true : false;
46890
46968
  }
46891
- return this._pinColumn(colRef);
46969
+ return this._pinColumn(colRef, side);
46892
46970
  };
46893
46971
  /** @private
46894
46972
  * @param {Grid~ColumnReference} colRef
46973
+ * @param {string=} side Available values are: left|right. If no value is supplied, the column will be pinned to the left.
46895
46974
  * @return {boolean}
46896
46975
  */
46897
- Grid.prototype._pinColumn = function(colRef) {
46976
+ Grid.prototype._pinColumn = function(colRef, side) {
46898
46977
  var colIndex = this.getColumnIndex(colRef);
46899
- if(colIndex < 0) {
46978
+ var colCount = this.getColumnCount();
46979
+ if(colIndex < 0 || colIndex > colCount) {
46900
46980
  return false;
46901
46981
  }
46902
- var pinnedCount = this._grid.getFrozenColumnCount();
46903
- if(colIndex < pinnedCount) {
46904
- return false; // The column is already pinned area
46905
- }
46906
- if(!pinnedCount) {
46907
- var stationaryIdx = this._grid.getStationaryColumnIndex();
46908
- if(stationaryIdx >= 0) {
46909
- pinnedCount = stationaryIdx;
46910
- if(colIndex > stationaryIdx) {
46911
- pinnedCount++;
46982
+
46983
+ var leftPinnedCount = this._grid.getPinnedLeftColumnCount();
46984
+ var rightPinnedCount = this._grid.getPinnedRightColumnCount();
46985
+ var stationaryIdx = this._grid.getStationaryColumnIndex();
46986
+
46987
+ if(side && side.toLowerCase() === "right") {
46988
+ var rightPinnedIndex = this._grid.getFirstPinnedRightIndex();
46989
+ if(colIndex >= rightPinnedIndex) {
46990
+ return false; // The column is already pinned area
46991
+ }
46992
+
46993
+ if(stationaryIdx >= 0 && colIndex <= stationaryIdx) {
46994
+ return false;
46995
+ }
46996
+
46997
+ this.moveColumnById(colIndex, rightPinnedIndex);
46998
+ rightPinnedCount += 1;
46999
+ leftPinnedCount -= 1;
47000
+ } else {
47001
+ if(colIndex < leftPinnedCount) {
47002
+ return false; // The column is already pinned area
47003
+ }
47004
+ if(!leftPinnedCount) {
47005
+ if(stationaryIdx >= 0) {
47006
+ leftPinnedCount = stationaryIdx;
47007
+ if(colIndex > stationaryIdx) {
47008
+ leftPinnedCount++;
47009
+ }
46912
47010
  }
46913
47011
  }
47012
+ this.moveColumnById(colIndex, leftPinnedCount);
46914
47013
  }
46915
47014
 
46916
- this.moveColumnById(colIndex, pinnedCount);
46917
- this._grid.freezeColumn(pinnedCount);
47015
+ this._grid.freezeColumn(leftPinnedCount, rightPinnedCount);
46918
47016
  return true;
46919
47017
  };
46920
47018
  /** Unpin column from the left side by moving the specified column to the end of the frozen columns. <br>
@@ -46947,13 +47045,16 @@ Grid.prototype._unpinColumn = function(colRef, dest) {
46947
47045
  if(colIndex < 0) {
46948
47046
  return false;
46949
47047
  }
46950
- var pinnedCount = this._grid.getFrozenColumnCount();
46951
- if(!pinnedCount) {
47048
+
47049
+ var leftPinnedCount = this._grid.getPinnedLeftColumnCount();
47050
+ var rightPinnedCount = this._grid.getPinnedRightColumnCount();
47051
+ var colCount = this.getColumnCount();
47052
+ var firstRightPinnedIndex = colCount - rightPinnedCount;
47053
+
47054
+ if(colIndex >= leftPinnedCount && colIndex < firstRightPinnedIndex) {
46952
47055
  return false;
46953
47056
  }
46954
- if(colIndex >= pinnedCount) {
46955
- return false; // The column is outside of frozen area
46956
- }
47057
+
46957
47058
  var srcId = null;
46958
47059
  var destId = null;
46959
47060
  if(dest != null) {
@@ -46964,11 +47065,19 @@ Grid.prototype._unpinColumn = function(colRef, dest) {
46964
47065
 
46965
47066
  var stationaryIdx = this._grid.getStationaryColumnIndex();
46966
47067
 
46967
- if(colIndex > stationaryIdx) {
46968
- this.moveColumnById(colIndex, pinnedCount);
46969
- }
47068
+ if(colIndex < leftPinnedCount) {
47069
+ if(colIndex > stationaryIdx) {
47070
+ this.moveColumnById(colIndex, leftPinnedCount);
47071
+ }
47072
+
47073
+ this._grid.freezeColumn(leftPinnedCount - 2, rightPinnedCount); // Column index is used for freezing
47074
+ } else if(colIndex >= firstRightPinnedIndex) {
47075
+ if(colIndex > stationaryIdx) {
47076
+ this.moveColumnById(colIndex, firstRightPinnedIndex);
47077
+ }
46970
47078
 
46971
- this._grid.freezeColumn(pinnedCount - 2); // Column index is used for freezing
47079
+ this._grid.freezeColumn(leftPinnedCount - 1, rightPinnedCount - 1); // Column index is used for freezing
47080
+ }
46972
47081
 
46973
47082
  if(colIndex > stationaryIdx) {
46974
47083
  if(destId != null) {
@@ -46983,11 +47092,12 @@ Grid.prototype._unpinColumn = function(colRef, dest) {
46983
47092
  * @return {boolean}
46984
47093
  */
46985
47094
  Grid.prototype.unpinAllColumns = function() {
46986
- var pinnedCount = this._grid.getFrozenColumnCount();
46987
- if(!pinnedCount) {
47095
+ var leftPinnedCount = this._grid.getPinnedLeftColumnCount();
47096
+ var rightPinnedCount = this._grid.getPinnedRightColumnCount();
47097
+ if(!leftPinnedCount && !rightPinnedCount) {
46988
47098
  return false;
46989
47099
  }
46990
- this._grid.freezeColumn(-1); // Column index is used for freezing
47100
+ this._grid.freezeColumn(-1, 0); // Column index is used for left freezing and column count is used for right freezing
46991
47101
  return true;
46992
47102
  };
46993
47103