@refinitiv-ui/efx-grid 6.0.41 → 6.0.42

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.
@@ -320,6 +320,28 @@ declare class Grid extends EventDispatcher {
320
320
 
321
321
  public replaceRow(rowRef: Grid.RowReference|null, rowOption?: any): any;
322
322
 
323
+ public scrollToColumn(colIndex: number, leftOfView?: boolean|null): boolean;
324
+
325
+ public scrollToRow(rowIndex: number, topOfView?: boolean|null): void;
326
+
327
+ public getScrollLeft(): number;
328
+
329
+ public getScrollTop(): number;
330
+
331
+ public setScrollLeft(pixels: number): void;
332
+
333
+ public setScrollTop(pixels: number): void;
334
+
335
+ public scrollRight(pixels: number): void;
336
+
337
+ public scrollDown(pixels: number): void;
338
+
339
+ public getScrollWidth(): number;
340
+
341
+ public getScrollHeight(): number;
342
+
343
+ public getVScrollView(): any;
344
+
323
345
  }
324
346
 
325
347
  declare function borders(gridOptions?: any): any;
@@ -140,21 +140,17 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
140
140
  * @description Fired after ADC data or response received from the server
141
141
  * @property {Array.<Array>} data Data part of the server response
142
142
  */
143
-
144
143
  /** @event Grid#pageIndexChanged
145
144
  * @description Fired after page index in the data view is changed during the active pagination mode
146
145
  */
147
-
148
146
  /** @event Grid#pageCountChanged
149
147
  * @description Fired after page count in the data view is changed during the active pagination mode
150
148
  */
151
-
152
149
  /** @event Grid#dataComposed
153
150
  * @description Trigger before dataChanged. Perform any data update during the event will NOT cause more dataChanged events
154
151
  * @property {Grid} grid
155
152
  * @property {RowDefinition} rowDef
156
153
  */
157
-
158
154
  /** @event Grid#beforeRowRemoved
159
155
  * @description Fired only when a row will be removed through Grid's API and before occurring of the actual removal
160
156
  */
@@ -3921,6 +3917,7 @@ Grid.prototype._logData = function(rowDefs, options) {
3921
3917
 
3922
3918
  console.table(tbl); // eslint-disable-line
3923
3919
  };
3920
+
3924
3921
  /** @public
3925
3922
  * @description Replace existing row with a new row. Row ID would be changed, after row is replaced.
3926
3923
  * @param {Grid~RowReference} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
@@ -3944,5 +3941,95 @@ Grid.prototype.replaceRow = function(rowRef, rowOption) {
3944
3941
  }
3945
3942
  };
3946
3943
 
3944
+ /** Scroll the view to the specified column. If the column is already in the view, nothing happens. If the column is outside of the view, the view will be moved to the column with some additional offsets
3945
+ * @public
3946
+ * @param {number} colIndex
3947
+ * @param {boolean=} leftOfView Default is false. If true, the specified column will be put at the leftmost of the view (no offset)
3948
+ * @returns {boolean} Return true, if there is any change
3949
+ */
3950
+ Grid.prototype.scrollToColumn = function (colIndex, leftOfView) {
3951
+ return this._grid.scrollToColumn(colIndex, leftOfView);
3952
+ };
3953
+ /** Scroll the view to the specified row. If the row is already in the view, nothing happens. If the row is outside of the view, the view will be moved to the row with some additional offsets
3954
+ * @public
3955
+ * @param {number} rowIndex
3956
+ * @param {boolean=} topOfView=false If true, the specified row will be put at the top of the view (no offset)
3957
+ */
3958
+ Grid.prototype.scrollToRow = function (rowIndex, topOfView) {
3959
+ this._grid.scrollToRow("content", rowIndex, topOfView);
3960
+ };
3961
+
3962
+ /** Get scroll value in pixel from the horizontal scrollbar
3963
+ * @public
3964
+ * @returns {number} pixels
3965
+ */
3966
+ Grid.prototype.getScrollLeft = function () {
3967
+ return this._grid.getScrollLeft();
3968
+ };
3969
+ /** Get scroll value in pixel from the vertical scrollbar
3970
+ * @public
3971
+ * @returns {number} pixels
3972
+ */
3973
+ Grid.prototype.getScrollTop = function () {
3974
+ return this._grid.getScrollTop();
3975
+ };
3976
+
3977
+ /** Set scroll value to the horizontal scrollbar. This will move the scrollbar to specific position
3978
+ * @public
3979
+ * @param {number} pixels
3980
+ * @see {@link Grid.scrollRight}
3981
+ */
3982
+ Grid.prototype.setScrollLeft = function (pixels) {
3983
+ this._grid.setScrollLeft(pixels);
3984
+ };
3985
+ /** Set scroll value to the vertical scrollbar. This will move the scrollbar to specific position
3986
+ * @public
3987
+ * @param {number} pixels
3988
+ * @see {@link Grid.scrollDown}
3989
+ */
3990
+ Grid.prototype.setScrollTop = function (pixels) {
3991
+ this._grid.setScrollTop(pixels);
3992
+ };
3993
+
3994
+ /** Scroll the view to the right by the specified value. Use negative value to scroll the view to the left
3995
+ * @public
3996
+ * @param {number} pixels
3997
+ * @see {@link Grid.setScrollLeft}
3998
+ */
3999
+ Grid.prototype.scrollRight = function (pixels) {
4000
+ this._grid.scrollRight(pixels);
4001
+ };
4002
+ /** Scroll the view down by the specified value. Use negative value to scroll the view to the top
4003
+ * @public
4004
+ * @param {number} pixels
4005
+ * @see {@link Grid.setScrollTop}
4006
+ */
4007
+ Grid.prototype.scrollDown = function (pixels) {
4008
+ this._grid.scrollDown(pixels);
4009
+ };
4010
+
4011
+ /** Get width of scrollable area from the horizontal scrollbar. This is useful for determining the end of scrollbar
4012
+ * @public
4013
+ * @returns {number}
4014
+ */
4015
+ Grid.prototype.getScrollWidth = function () {
4016
+ return this._grid.getScrollWidth();
4017
+ };
4018
+ /** Get height of scrollable area from the vertical scrollbar. This is useful for determining the end of scrollbar
4019
+ * @public
4020
+ * @returns {number}
4021
+ */
4022
+ Grid.prototype.getScrollHeight = function () {
4023
+ return this._grid.getScrollHeight();
4024
+ };
4025
+
4026
+ /** Get information about current grid's view and the vertical scrollbar
4027
+ * @public
4028
+ * @returns {Object} Returns null, if vertical scrollbar does not exists
4029
+ */
4030
+ Grid.prototype.getVScrollView = function () {
4031
+ return this._grid.getVScrollView();
4032
+ };
4033
+
3947
4034
  export { Grid };
3948
4035
  export default Grid;
@@ -93,6 +93,10 @@ declare class ColumnGroupingPlugin extends GridPlugin {
93
93
 
94
94
  public unpinGroup(groupId: string, dest?: (number|string)|null): void;
95
95
 
96
+ public static getObjectIndex(column: any): number;
97
+
98
+ public static getObjectId(column: any): string;
99
+
96
100
  }
97
101
 
98
102
  export default ColumnGroupingPlugin;
@@ -483,7 +483,7 @@ ColumnGroupingPlugin.prototype._applyGrouping = function () {
483
483
  for (r = 0; r < rowCount; r++) {
484
484
  cell = section.getCell(c, r, false);
485
485
  if (cell) {
486
- cell.reset();
486
+ // TODO: The style and class from the user will not be reset, for example, the color or background
487
487
  cell.removeClass("no-sort");
488
488
  cell.removeAttribute("group-id");
489
489
  }
@@ -1122,14 +1122,13 @@ ColumnGroupingPlugin.prototype.setGroupDefinition = function (groupId, groupDef)
1122
1122
  if (this._groupDefs.setGroup(groupId, groupDef)) {
1123
1123
  var newDef = this._groupDefs.getGroup(groupId);
1124
1124
  if (newDef) {
1125
- var chdr = newDef.children;
1125
+ var host = this._hosts[0];
1126
+ var chdr = host.getValidColumnList(newDef.children).map(ColumnGroupingPlugin.getObjectId); //this return only valid columns without group
1126
1127
  var len = chdr.length;
1127
- // TODO: Filter out group id
1128
1128
  if (len > 1) {
1129
- this.reorderColumns(chdr, chdr[0]); // WARNING: group id doesn't work
1129
+ this.reorderColumns(chdr, chdr[0]);
1130
1130
  }
1131
1131
  }
1132
-
1133
1132
  this._applyGrouping();
1134
1133
  return groupId;
1135
1134
  }
@@ -1192,16 +1191,17 @@ ColumnGroupingPlugin.prototype._getAvaliableChildren = function (groupId) {
1192
1191
  var childCount = chdr ? chdr.length : 0;
1193
1192
  var validChildren = [];
1194
1193
  if (childCount) {
1194
+ var host = this._hosts[0];
1195
+ var validCols = host.getValidColumnList(chdr);
1196
+ validChildren = validCols.map(ColumnGroupingPlugin.getObjectId);
1195
1197
  var groupMap = this._groupDefs.getGroupMap();
1196
- // Filter out columns that do not exist
1197
1198
  for (var i = 0; i < childCount; i++) {
1198
1199
  var childId = chdr[i];
1199
- if (groupMap[childId] || this.getColumnIndex(childId) > -1) {
1200
- validChildren.push(childId); // TODO: This is slow
1200
+ if (groupMap[childId]) {
1201
+ validChildren.push(childId);
1201
1202
  }
1202
1203
  }
1203
1204
  }
1204
-
1205
1205
  return validChildren;
1206
1206
  };
1207
1207
 
@@ -1223,19 +1223,14 @@ ColumnGroupingPlugin.prototype.getGroupChildren = function (groupId) {
1223
1223
  * @return {Array.<number>}
1224
1224
  */
1225
1225
  ColumnGroupingPlugin.prototype.getChildColumnIndices = function (groupId) {
1226
+ var colIndices = [];
1227
+ var host = this._hosts[0];
1226
1228
  var colIds = this._groupDefs.getLeafDescendants(groupId);
1227
1229
  if (colIds) {
1228
- var colIndices = [];
1229
- var leafCount = colIds.length;
1230
- for (var i = 0; i < leafCount; i++) {
1231
- var index = this.getColumnIndex(colIds[i]);
1232
- if (index >= 0) {
1233
- colIndices.push(index);
1234
- }
1235
- }
1236
- return colIndices.sort(ColumnGroupingPlugin._ascSortLogic); // TODO: This could be unnecessary
1230
+ var validColList = host.getValidColumnList(colIds);
1231
+ colIndices = validColList.map(ColumnGroupingPlugin.getObjectIndex);
1232
+ return colIndices;
1237
1233
  }
1238
-
1239
1234
  return null;
1240
1235
  };
1241
1236
 
@@ -1715,5 +1710,25 @@ ColumnGroupingPlugin.prototype.unpinGroup = function (groupId, dest) {
1715
1710
  this.moveGroup(groupId, destId);
1716
1711
  }
1717
1712
  };
1713
+
1714
+ /** Get column index from column object
1715
+ * @public
1716
+ * @function
1717
+ * @param {Object} column
1718
+ * @return {number}
1719
+ */
1720
+ ColumnGroupingPlugin.getObjectIndex = function (column) {
1721
+ return column["index"];
1722
+ };
1723
+
1724
+ /** Get column id from column object
1725
+ * @public
1726
+ * @function
1727
+ * @param {Object} column
1728
+ * @return {string}
1729
+ */
1730
+ ColumnGroupingPlugin.getObjectId = function (column) {
1731
+ return column["id"];
1732
+ };
1718
1733
  export default ColumnGroupingPlugin;
1719
1734
  export { ColumnGroupingPlugin, ColumnGroupingPlugin as ColumnGrouping, ColumnGroupingPlugin as ColumnGroupingExtension };
@@ -32,8 +32,8 @@ declare namespace ColumnStackPlugin {
32
32
  id: string,
33
33
  spreading?: boolean|null,
34
34
  collapsed?: boolean|null,
35
- children: (string)[]|null,
36
- fields: (string)[]|null,
35
+ children?: (string)[]|null,
36
+ fields?: (string)[]|null,
37
37
  name?: string|null,
38
38
  activeColumn?: string|null
39
39
  };
@@ -88,7 +88,11 @@ declare class ColumnStackPlugin extends GridPlugin {
88
88
 
89
89
  public stackColumns(colRefs?: (number|string)[]|null, stackId?: string|null, options?: ColumnStackPlugin.StackConfiguration|null): boolean;
90
90
 
91
- public setStack(colRefs?: (number|string)[]|null, activeColRef?: number|string|null): boolean;
91
+ public setStack(colRefs?: (number|string)[]|null, activeColRef?: (number|string)|null): boolean;
92
+
93
+ public setStacks(stacks: (ColumnStackPlugin.StackDefinition)[]|null): void;
94
+
95
+ public getStacks(): (ColumnStackPlugin.StackDefinition)[];
92
96
 
93
97
  public unstackColumns(colIndices?: (number)[]|null): boolean;
94
98
 
@@ -120,6 +124,8 @@ declare class ColumnStackPlugin extends GridPlugin {
120
124
 
121
125
  public getStackName(stackId: string): string;
122
126
 
127
+ public getActiveColumnId(stackId: string): string;
128
+
123
129
  public getActiveColumnField(stackId: string): string;
124
130
 
125
131
  public getActiveColumnIndex(stackId: string): number;