@refinitiv-ui/efx-grid 6.0.37 → 6.0.38

Sign up to get free protection for your applications and to get access to all the features.
@@ -359,6 +359,8 @@ declare class Core extends ElementWrapper {
359
359
 
360
360
  public synchronizeVScrollbar(subGrid: Core|null): void;
361
361
 
362
+ public synchronizeHScrollbar(subGrid: Core|null): void;
363
+
362
364
  public updateRowData(sectionRef?: Core.SectionReference|null, fromRowIndex?: number|null, lastRowIndex?: number|null, userParam?: any): void;
363
365
 
364
366
  public rerender(): void;
@@ -91,6 +91,7 @@ var Core = function (opt_initializer) {
91
91
  _t._onVScroll = _t._onVScroll.bind(_t);
92
92
  _t._onHScroll = _t._onHScroll.bind(_t);
93
93
  _t._onSyncVScroll = _t._onSyncVScroll.bind(_t);
94
+ _t._onSyncHScroll = _t._onSyncHScroll.bind(_t);
94
95
  _t.updateLayout = _t.updateLayout.bind(_t);
95
96
  _t._onRowRefresh = _t._onRowRefresh.bind(_t);
96
97
  _t._onVScrollEnabled = _t._onVScrollEnabled.bind(_t);
@@ -203,7 +204,8 @@ var Core = function (opt_initializer) {
203
204
  "rowPositionChanged",
204
205
  "beforeColumnBoundUpdate",
205
206
  "beforeBatchOperation",
206
- "afterBatchOperation"
207
+ "afterBatchOperation",
208
+ "pinningChanged"
207
209
  );
208
210
 
209
211
  // For debugging in advanced optimization mode
@@ -552,7 +554,7 @@ Core.prototype._batches = null;
552
554
  * @return {string}
553
555
  */
554
556
  Core.getVersion = function () {
555
- return "5.1.50";
557
+ return "5.1.52";
556
558
  };
557
559
  /** {@link ElementWrapper#dispose}
558
560
  * @override
@@ -594,6 +596,12 @@ Core.prototype.dispose = function () {
594
596
  mainScrolbar.unlisten("scroll", this._onSyncVScroll);
595
597
  this._vscrollbar._mainScrollbar = null;
596
598
  }
599
+ mainScrolbar = this._hscrollbar._mainScrollbar;
600
+ if(mainScrolbar) {
601
+ mainScrolbar.unlisten("scroll", this._onSyncHScroll);
602
+ this._hscrollbar._mainScrollbar = null;
603
+ }
604
+
597
605
  this._vscrollbar.dispose();
598
606
  this._hscrollbar.dispose();
599
607
  this._rowHeightConflator.dispose();
@@ -2907,10 +2915,14 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
2907
2915
  var colCount = this.getColumnCount();
2908
2916
  var leftPinnedCount = 0;
2909
2917
  var rightPinnedCount = 0;
2918
+ var dirty = false;
2910
2919
  if (frozenColIndex || frozenColIndex === 0) {
2911
2920
  this._hScrollbarEnabled = true;
2912
2921
  leftPinnedCount = (frozenColIndex >= 0) ? frozenColIndex + 1 : 0;
2913
- this._pinnedLeftColumnCount = leftPinnedCount; // This variable is used for caching
2922
+ if (this._pinnedLeftColumnCount !== leftPinnedCount) {
2923
+ dirty = true;
2924
+ this._pinnedLeftColumnCount = leftPinnedCount; // This variable is used for caching
2925
+ }
2914
2926
 
2915
2927
  for (i = 0; i < colCount; ++i) {
2916
2928
  colDef = this._getColumnDef(i);
@@ -2921,7 +2933,10 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
2921
2933
  }
2922
2934
  if(numRightColumn != null) {
2923
2935
  rightPinnedCount = numRightColumn > 0 ? numRightColumn : 0;
2924
- this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
2936
+ if (this._pinnedLeftColumnCount !== rightPinnedCount) {
2937
+ dirty = true;
2938
+ this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
2939
+ }
2925
2940
 
2926
2941
  for (i = colCount; --i >= 0;) {
2927
2942
  colDef = this._getColumnDef(i);
@@ -2932,6 +2947,12 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
2932
2947
  this._onColumnCountChanged(); // Activate horizontal scrollbar and column virtualization
2933
2948
  this._updateScrollbarWidth(true, true);
2934
2949
  this._updateColumnSeparators();
2950
+
2951
+ if (dirty) {
2952
+ if (!this._isEventDispatching("pinningChanged")) {
2953
+ this._dispatch("pinningChanged", {});
2954
+ }
2955
+ }
2935
2956
  };
2936
2957
 
2937
2958
  /** @private
@@ -3756,6 +3777,26 @@ Core.prototype.synchronizeVScrollbar = function (subGrid) {
3756
3777
  this._vscrollbar.listen("scroll", subGrid._onSyncVScroll);
3757
3778
  };
3758
3779
 
3780
+ /** Synchronize two horizontal scrollbars of two grid, by hiding its scrollbar and using the one from the given grid
3781
+ * @public
3782
+ * @param {Core} subGrid
3783
+ */
3784
+ Core.prototype.synchronizeHScrollbar = function (subGrid) {
3785
+ subGrid.unlisten("mousemove", subGrid._onMouseMove);
3786
+ subGrid.listen("mousemove", this._onMouseMove);
3787
+
3788
+ var hscrollbar = subGrid.getHScrollbar();
3789
+ hscrollbar._mainScrollbar = this._hscrollbar; // HACK
3790
+
3791
+ hscrollbar.setStyle("visibility", "hidden");
3792
+ hscrollbar.setStyle("pointerEvents", "none");
3793
+ hscrollbar.disableMouseWheel(); // Disable sub-grid wheel behavior
3794
+ hscrollbar.attachToExternalElement(this._hscrollbar.getParent()); // MouseWheel event is still available on the main
3795
+
3796
+ // TODO: Check if we need to re-append this._hscrollbar to move it to the front over other grid elements.
3797
+ this._hscrollbar.listen("scroll", subGrid._onSyncHScroll);
3798
+ };
3799
+
3759
3800
  /** Fires data binding event without actual change in the data source. <br>
3760
3801
  * This will force visual elements to be re-rendered with the latest data in the data source.
3761
3802
  * @public
@@ -5411,6 +5452,12 @@ Core.prototype._onSyncVScroll = function (e) {
5411
5452
  this._vscrollbar.setScrollTop(e.scrollTop);
5412
5453
  };
5413
5454
  /** @private
5455
+ * @param {Object} e
5456
+ */
5457
+ Core.prototype._onSyncHScroll = function (e) {
5458
+ this._hscrollbar.setScrollLeft(e.scrollLeft);
5459
+ };
5460
+ /** @private
5414
5461
  * @return {number} index of footer section
5415
5462
  */
5416
5463
  Core.prototype._getFooterStartIndex = function () {
package/lib/grid/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import {Grid} from "./lib/efx-grid.js";
2
2
  export {Grid}
3
- window.EFX_GRID = { version: "6.0.37" };
3
+ window.EFX_GRID = { version: "6.0.38" };
@@ -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;
@@ -35465,6 +35465,7 @@ var Core = function (opt_initializer) {
35465
35465
  _t._onVScroll = _t._onVScroll.bind(_t);
35466
35466
  _t._onHScroll = _t._onHScroll.bind(_t);
35467
35467
  _t._onSyncVScroll = _t._onSyncVScroll.bind(_t);
35468
+ _t._onSyncHScroll = _t._onSyncHScroll.bind(_t);
35468
35469
  _t.updateLayout = _t.updateLayout.bind(_t);
35469
35470
  _t._onRowRefresh = _t._onRowRefresh.bind(_t);
35470
35471
  _t._onVScrollEnabled = _t._onVScrollEnabled.bind(_t);
@@ -35926,7 +35927,7 @@ Core.prototype._batches = null;
35926
35927
  * @return {string}
35927
35928
  */
35928
35929
  Core.getVersion = function () {
35929
- return "5.1.50";
35930
+ return "5.1.51";
35930
35931
  };
35931
35932
  /** {@link ElementWrapper#dispose}
35932
35933
  * @override
@@ -35968,6 +35969,12 @@ Core.prototype.dispose = function () {
35968
35969
  mainScrolbar.unlisten("scroll", this._onSyncVScroll);
35969
35970
  this._vscrollbar._mainScrollbar = null;
35970
35971
  }
35972
+ mainScrolbar = this._hscrollbar._mainScrollbar;
35973
+ if(mainScrolbar) {
35974
+ mainScrolbar.unlisten("scroll", this._onSyncHScroll);
35975
+ this._hscrollbar._mainScrollbar = null;
35976
+ }
35977
+
35971
35978
  this._vscrollbar.dispose();
35972
35979
  this._hscrollbar.dispose();
35973
35980
  this._rowHeightConflator.dispose();
@@ -39130,6 +39137,26 @@ Core.prototype.synchronizeVScrollbar = function (subGrid) {
39130
39137
  this._vscrollbar.listen("scroll", subGrid._onSyncVScroll);
39131
39138
  };
39132
39139
 
39140
+ /** Synchronize two horizontal scrollbars of two grid, by hiding its scrollbar and using the one from the given grid
39141
+ * @public
39142
+ * @param {Core} subGrid
39143
+ */
39144
+ Core.prototype.synchronizeHScrollbar = function (subGrid) {
39145
+ subGrid.unlisten("mousemove", subGrid._onMouseMove);
39146
+ subGrid.listen("mousemove", this._onMouseMove);
39147
+
39148
+ var hscrollbar = subGrid.getHScrollbar();
39149
+ hscrollbar._mainScrollbar = this._hscrollbar; // HACK
39150
+
39151
+ hscrollbar.setStyle("visibility", "hidden");
39152
+ hscrollbar.setStyle("pointerEvents", "none");
39153
+ hscrollbar.disableMouseWheel(); // Disable sub-grid wheel behavior
39154
+ hscrollbar.attachToExternalElement(this._hscrollbar.getParent()); // MouseWheel event is still available on the main
39155
+
39156
+ // TODO: Check if we need to re-append this._hscrollbar to move it to the front over other grid elements.
39157
+ this._hscrollbar.listen("scroll", subGrid._onSyncHScroll);
39158
+ };
39159
+
39133
39160
  /** Fires data binding event without actual change in the data source. <br>
39134
39161
  * This will force visual elements to be re-rendered with the latest data in the data source.
39135
39162
  * @public
@@ -40785,6 +40812,12 @@ Core.prototype._onSyncVScroll = function (e) {
40785
40812
  this._vscrollbar.setScrollTop(e.scrollTop);
40786
40813
  };
40787
40814
  /** @private
40815
+ * @param {Object} e
40816
+ */
40817
+ Core.prototype._onSyncHScroll = function (e) {
40818
+ this._hscrollbar.setScrollLeft(e.scrollLeft);
40819
+ };
40820
+ /** @private
40788
40821
  * @return {number} index of footer section
40789
40822
  */
40790
40823
  Core.prototype._getFooterStartIndex = function () {
@@ -46871,50 +46904,72 @@ Grid.prototype.freezeColumn = function(colIndex, pinnedRightColumns) {
46871
46904
  }
46872
46905
  this._grid.freezeColumn(colIndex, pinnedRightColumns);
46873
46906
  };
46907
+
46874
46908
  /** Pin column to the left side by moving the specified column to the rightmost of the frozen columns. <br>
46875
46909
  * The method will do nothing if the specified column is already pinned to the left side
46876
46910
  * @public
46877
46911
  * @param {Grid~ColumnReference|Array.<Grid~ColumnReference>} colRef
46912
+ * @param {string=} side Available values are: left|right. If no value is supplied, the column will be pinned to the left.
46878
46913
  * @return {boolean}
46879
46914
  */
46880
- Grid.prototype.pinColumn = function(colRef) {
46915
+ Grid.prototype.pinColumn = function(colRef, side) {
46881
46916
  if(Array.isArray(colRef)) {
46882
46917
  var ary = colRef;
46883
46918
  var len = ary.length;
46884
46919
 
46885
46920
  var dirty = 0;
46886
46921
  for(var i = 0; i < len; ++i) {
46887
- dirty |= this._pinColumn(ary[i]);
46922
+ dirty |= this._pinColumn(ary[i], side);
46888
46923
  }
46889
46924
  return dirty ? true : false;
46890
46925
  }
46891
- return this._pinColumn(colRef);
46926
+ return this._pinColumn(colRef, side);
46892
46927
  };
46893
46928
  /** @private
46894
46929
  * @param {Grid~ColumnReference} colRef
46930
+ * @param {string=} side Available values are: left|right. If no value is supplied, the column will be pinned to the left.
46895
46931
  * @return {boolean}
46896
46932
  */
46897
- Grid.prototype._pinColumn = function(colRef) {
46933
+ Grid.prototype._pinColumn = function(colRef, side) {
46898
46934
  var colIndex = this.getColumnIndex(colRef);
46899
- if(colIndex < 0) {
46935
+ var colCount = this.getColumnCount();
46936
+ if(colIndex < 0 || colIndex > colCount) {
46900
46937
  return false;
46901
46938
  }
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++;
46939
+
46940
+ var leftPinnedCount = this._grid.getPinnedLeftColumnCount();
46941
+ var rightPinnedCount = this._grid.getPinnedRightColumnCount();
46942
+ var stationaryIdx = this._grid.getStationaryColumnIndex();
46943
+
46944
+ if(side && side.toLowerCase() === "right") {
46945
+ var rightPinnedIndex = this._grid.getFirstPinnedRightIndex();
46946
+ if(colIndex >= rightPinnedIndex) {
46947
+ return false; // The column is already pinned area
46948
+ }
46949
+
46950
+ if(stationaryIdx >= 0 && colIndex <= stationaryIdx) {
46951
+ return false;
46952
+ }
46953
+
46954
+ this.moveColumnById(colIndex, rightPinnedIndex);
46955
+ rightPinnedCount += 1;
46956
+ leftPinnedCount -= 1;
46957
+ } else {
46958
+ if(colIndex < leftPinnedCount) {
46959
+ return false; // The column is already pinned area
46960
+ }
46961
+ if(!leftPinnedCount) {
46962
+ if(stationaryIdx >= 0) {
46963
+ leftPinnedCount = stationaryIdx;
46964
+ if(colIndex > stationaryIdx) {
46965
+ leftPinnedCount++;
46966
+ }
46912
46967
  }
46913
46968
  }
46969
+ this.moveColumnById(colIndex, leftPinnedCount);
46914
46970
  }
46915
46971
 
46916
- this.moveColumnById(colIndex, pinnedCount);
46917
- this._grid.freezeColumn(pinnedCount);
46972
+ this._grid.freezeColumn(leftPinnedCount, rightPinnedCount);
46918
46973
  return true;
46919
46974
  };
46920
46975
  /** Unpin column from the left side by moving the specified column to the end of the frozen columns. <br>
@@ -46947,13 +47002,16 @@ Grid.prototype._unpinColumn = function(colRef, dest) {
46947
47002
  if(colIndex < 0) {
46948
47003
  return false;
46949
47004
  }
46950
- var pinnedCount = this._grid.getFrozenColumnCount();
46951
- if(!pinnedCount) {
47005
+
47006
+ var leftPinnedCount = this._grid.getPinnedLeftColumnCount();
47007
+ var rightPinnedCount = this._grid.getPinnedRightColumnCount();
47008
+ var colCount = this.getColumnCount();
47009
+ var firstRightPinnedIndex = colCount - rightPinnedCount;
47010
+
47011
+ if(colIndex >= leftPinnedCount && colIndex < firstRightPinnedIndex) {
46952
47012
  return false;
46953
47013
  }
46954
- if(colIndex >= pinnedCount) {
46955
- return false; // The column is outside of frozen area
46956
- }
47014
+
46957
47015
  var srcId = null;
46958
47016
  var destId = null;
46959
47017
  if(dest != null) {
@@ -46964,11 +47022,19 @@ Grid.prototype._unpinColumn = function(colRef, dest) {
46964
47022
 
46965
47023
  var stationaryIdx = this._grid.getStationaryColumnIndex();
46966
47024
 
46967
- if(colIndex > stationaryIdx) {
46968
- this.moveColumnById(colIndex, pinnedCount);
46969
- }
47025
+ if(colIndex < leftPinnedCount) {
47026
+ if(colIndex > stationaryIdx) {
47027
+ this.moveColumnById(colIndex, leftPinnedCount);
47028
+ }
46970
47029
 
46971
- this._grid.freezeColumn(pinnedCount - 2); // Column index is used for freezing
47030
+ this._grid.freezeColumn(leftPinnedCount - 2, rightPinnedCount); // Column index is used for freezing
47031
+ } else if(colIndex >= firstRightPinnedIndex) {
47032
+ if(colIndex > stationaryIdx) {
47033
+ this.moveColumnById(colIndex, firstRightPinnedIndex);
47034
+ }
47035
+
47036
+ this._grid.freezeColumn(leftPinnedCount - 1, rightPinnedCount - 1); // Column index is used for freezing
47037
+ }
46972
47038
 
46973
47039
  if(colIndex > stationaryIdx) {
46974
47040
  if(destId != null) {
@@ -46983,11 +47049,12 @@ Grid.prototype._unpinColumn = function(colRef, dest) {
46983
47049
  * @return {boolean}
46984
47050
  */
46985
47051
  Grid.prototype.unpinAllColumns = function() {
46986
- var pinnedCount = this._grid.getFrozenColumnCount();
46987
- if(!pinnedCount) {
47052
+ var leftPinnedCount = this._grid.getPinnedLeftColumnCount();
47053
+ var rightPinnedCount = this._grid.getPinnedRightColumnCount();
47054
+ if(!leftPinnedCount && !rightPinnedCount) {
46988
47055
  return false;
46989
47056
  }
46990
- this._grid.freezeColumn(-1); // Column index is used for freezing
47057
+ this._grid.freezeColumn(-1, 0); // Column index is used for left freezing and column count is used for right freezing
46991
47058
  return true;
46992
47059
  };
46993
47060