@refinitiv-ui/efx-grid 6.0.109 → 6.0.110

Sign up to get free protection for your applications and to get access to all the features.
@@ -175,6 +175,10 @@ declare class Core extends ElementWrapper {
175
175
 
176
176
  public setColumnStyle(colIndex: number, style: string, value: string, opt_type?: string|null): void;
177
177
 
178
+ public getColumnBackgroundColor(colIndex: number): string;
179
+
180
+ public setColumnBackgroundColor(colIndex: number, color?: string|null): void;
181
+
178
182
  public enableColumnClass(colIndex: number, clsName: string, enabled?: boolean|null, opt_type?: string|null): boolean;
179
183
 
180
184
  public hasColumnClass(colIndex: number, clsName: string, opt_type?: string|null): boolean;
@@ -620,7 +620,7 @@ Core.prototype._hasPendingRowChange = false;
620
620
  * @return {string}
621
621
  */
622
622
  Core.getVersion = function () {
623
- return "5.1.111";
623
+ return "5.1.113";
624
624
  };
625
625
  /** {@link ElementWrapper#dispose}
626
626
  * @override
@@ -763,6 +763,9 @@ Core.prototype.getConfigObject = function (gridOptions) {
763
763
  if (columnDef["rightPinned"]) {
764
764
  column["rightPinned"] = columnDef["rightPinned"];
765
765
  }
766
+ if (columnDef["backgroundColor"]) {
767
+ column["backgroundColor"] = columnDef["backgroundColor"];
768
+ }
766
769
  }
767
770
 
768
771
  // It will be overwrite in rt-grid or atlas-blotter
@@ -2051,6 +2054,10 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
2051
2054
  if (value != null) {
2052
2055
  colDef["rightPinned"] = value ? true : false;
2053
2056
  }
2057
+ value = jsonObj["backgroundColor"];
2058
+ if (value != null) {
2059
+ this.setColumnBackgroundColor(index, value);
2060
+ }
2054
2061
 
2055
2062
  this.setColumnRenderingHandler(index, jsonObj["renderingHandler"]);
2056
2063
  this.setColumnDataBindingHandler(index, jsonObj["dataBindingHandler"]);
@@ -2310,6 +2317,56 @@ Core.prototype.setColumnStyle = function (colIndex, style, value, opt_type) {
2310
2317
  }
2311
2318
  };
2312
2319
 
2320
+ /** @public
2321
+ * @param {number} colIndex
2322
+ * @return {string}
2323
+ */
2324
+ Core.prototype.getColumnBackgroundColor = function(colIndex) {
2325
+ let colDef = this._getColumnDef(colIndex);
2326
+ return colDef["backgroundColor"] || "";
2327
+ };
2328
+ /** @public
2329
+ * @param {number} colIndex
2330
+ * @param {string=} color
2331
+ */
2332
+ Core.prototype.setColumnBackgroundColor = function(colIndex, color) {
2333
+ if(colIndex == null || typeof colIndex !== "number") {
2334
+ return;
2335
+ }
2336
+
2337
+ let colDef = this._getColumnDef(colIndex);
2338
+ if(colDef["backgroundColor"] === color) {
2339
+ return;
2340
+ }
2341
+
2342
+ colDef["backgroundColor"] = color;
2343
+ color = color != null ? color : "";
2344
+
2345
+ let sectionCount = this._settings.length;
2346
+ for(let i = 0; i < sectionCount; ++i) {
2347
+ let settings = this._settings[i];
2348
+ let section = settings.getSection();
2349
+ if(!section) {
2350
+ continue;
2351
+ }
2352
+
2353
+ if(settings.getType() !== "content") {
2354
+ let rowCount = section.getRowCount();
2355
+ for(let r = 0; r < rowCount; r++) {
2356
+ let cellSpan = section.getCellColSpan(colIndex, r);
2357
+ if(cellSpan > 1) { continue; }
2358
+ let cell = section.getCell(colIndex, r);
2359
+ if(cell) {
2360
+ cell.setStyle("backgroundColor", color);
2361
+ }
2362
+ }
2363
+ } else {
2364
+ let column = section.getColumn(colIndex);
2365
+ column.setStyle("backgroundColor", color);
2366
+ }
2367
+ }
2368
+ };
2369
+
2313
2370
  /** @public
2314
2371
  * @param {number} colIndex
2315
2372
  * @param {string} clsName
@@ -4969,6 +5026,9 @@ Core.prototype._dispatchRowExpansionBinding = function (e) {
4969
5026
  }
4970
5027
 
4971
5028
  let ctxRow = section.getContextRow(r);
5029
+ if(!ctxRow) {
5030
+ continue; // The row may have been pushed out of view due to row count or height changed during the binding
5031
+ }
4972
5032
  let parentId = dataView.getExpansionParentByRowId(rowId);
4973
5033
  if(parentId) { // dispatch to render row expansion
4974
5034
  e["originalRowData"] = dataView.getRowData(parentId);
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.109" };
3
+ window.EFX_GRID = { version: "6.0.110" };
@@ -14857,6 +14857,7 @@ PredefinedFormula.remove = function(field) {
14857
14857
  * @property {boolean=} rightPinned=false If enabled, the column will not be part of the scrollable area and is pinned to the right side
14858
14858
  * @property {Object=} info=null For storing any additional information to the column
14859
14859
  * @property {boolean=} focusable=false If enabled, the column will be used to find focusable element when pressing tab key
14860
+ * @property {string=} backgroundColor CSS color value
14860
14861
  */
14861
14862
 
14862
14863
  /** mapping of field type to javascript type
@@ -15975,6 +15976,24 @@ ColumnDefinition.prototype._setCoreColumnDef = function(obj) {
15975
15976
  ColumnDefinition.prototype.isFocusable = function() {
15976
15977
  return this._focusable;
15977
15978
  };
15979
+ /** @public
15980
+ * @return {string}
15981
+ */
15982
+ ColumnDefinition.prototype.getBackgroundColor = function() {
15983
+ let core = this._eventArg["core"];
15984
+ let grid = this._eventArg["grid"];
15985
+ let colIndex = grid.getColumnIndex(this);
15986
+ return core.getColumnBackgroundColor(colIndex);
15987
+ };
15988
+ /** @public
15989
+ * @param {string} color
15990
+ */
15991
+ ColumnDefinition.prototype.setBackgroundColor = function(color) {
15992
+ let core = this._eventArg["core"];
15993
+ let grid = this._eventArg["grid"];
15994
+ let colIndex = grid.getColumnIndex(this);
15995
+ core.setColumnBackgroundColor(colIndex, color);
15996
+ };
15978
15997
 
15979
15998
 
15980
15999
  /* harmony default export */ var js_ColumnDefinition = (ColumnDefinition);
@@ -35781,7 +35800,6 @@ let Core = function (opt_initializer) {
35781
35800
  _t._onRowHightlighted = _t._onRowHightlighted.bind(_t);
35782
35801
  _t._onGridClicked = _t._onGridClicked.bind(_t);
35783
35802
  _t._onKeyDown = _t._onKeyDown.bind(_t);
35784
- _t._onKeyUp = _t._onKeyUp.bind(_t);
35785
35803
 
35786
35804
  _t._onWindowResize = _t._onWindowResize.bind(_t);
35787
35805
  _t._onSectionDataChanged = _t._onSectionDataChanged.bind(_t);
@@ -35869,7 +35887,6 @@ let Core = function (opt_initializer) {
35869
35887
 
35870
35888
 
35871
35889
  _t._element.addEventListener("keydown", _t._onKeyDown);
35872
- _t._element.addEventListener("keyup", _t._onKeyUp);
35873
35890
  if (util.isMobile || util.isTouchDevice) {
35874
35891
  _t._element.addEventListener("touchmove", _t._onMouseMove, false);
35875
35892
  } else {
@@ -36276,7 +36293,7 @@ Core.prototype._hasPendingRowChange = false;
36276
36293
  * @return {string}
36277
36294
  */
36278
36295
  Core.getVersion = function () {
36279
- return "5.1.110";
36296
+ return "5.1.112";
36280
36297
  };
36281
36298
  /** {@link ElementWrapper#dispose}
36282
36299
  * @override
@@ -36419,6 +36436,9 @@ Core.prototype.getConfigObject = function (gridOptions) {
36419
36436
  if (columnDef["rightPinned"]) {
36420
36437
  column["rightPinned"] = columnDef["rightPinned"];
36421
36438
  }
36439
+ if (columnDef["backgroundColor"]) {
36440
+ column["backgroundColor"] = columnDef["backgroundColor"];
36441
+ }
36422
36442
  }
36423
36443
 
36424
36444
  // It will be overwrite in rt-grid or atlas-blotter
@@ -37707,6 +37727,10 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
37707
37727
  if (value != null) {
37708
37728
  colDef["rightPinned"] = value ? true : false;
37709
37729
  }
37730
+ value = jsonObj["backgroundColor"];
37731
+ if (value != null) {
37732
+ this.setColumnBackgroundColor(index, value);
37733
+ }
37710
37734
 
37711
37735
  this.setColumnRenderingHandler(index, jsonObj["renderingHandler"]);
37712
37736
  this.setColumnDataBindingHandler(index, jsonObj["dataBindingHandler"]);
@@ -37966,6 +37990,56 @@ Core.prototype.setColumnStyle = function (colIndex, style, value, opt_type) {
37966
37990
  }
37967
37991
  };
37968
37992
 
37993
+ /** @public
37994
+ * @param {number} colIndex
37995
+ * @return {string}
37996
+ */
37997
+ Core.prototype.getColumnBackgroundColor = function(colIndex) {
37998
+ let colDef = this._getColumnDef(colIndex);
37999
+ return colDef["backgroundColor"] || "";
38000
+ };
38001
+ /** @public
38002
+ * @param {number} colIndex
38003
+ * @param {string=} color
38004
+ */
38005
+ Core.prototype.setColumnBackgroundColor = function(colIndex, color) {
38006
+ if(colIndex == null || typeof colIndex !== "number") {
38007
+ return;
38008
+ }
38009
+
38010
+ let colDef = this._getColumnDef(colIndex);
38011
+ if(colDef["backgroundColor"] === color) {
38012
+ return;
38013
+ }
38014
+
38015
+ colDef["backgroundColor"] = color;
38016
+ color = color != null ? color : "";
38017
+
38018
+ let sectionCount = this._settings.length;
38019
+ for(let i = 0; i < sectionCount; ++i) {
38020
+ let settings = this._settings[i];
38021
+ let section = settings.getSection();
38022
+ if(!section) {
38023
+ continue;
38024
+ }
38025
+
38026
+ if(settings.getType() !== "content") {
38027
+ let rowCount = section.getRowCount();
38028
+ for(let r = 0; r < rowCount; r++) {
38029
+ let cellSpan = section.getCellColSpan(colIndex, r);
38030
+ if(cellSpan > 1) { continue; }
38031
+ let cell = section.getCell(colIndex, r);
38032
+ if(cell) {
38033
+ cell.setStyle("backgroundColor", color);
38034
+ }
38035
+ }
38036
+ } else {
38037
+ let column = section.getColumn(colIndex);
38038
+ column.setStyle("backgroundColor", color);
38039
+ }
38040
+ }
38041
+ };
38042
+
37969
38043
  /** @public
37970
38044
  * @param {number} colIndex
37971
38045
  * @param {string} clsName
@@ -41117,31 +41191,9 @@ Core.prototype._onKeyDown = function (e) {
41117
41191
 
41118
41192
  if(onTheEdge && !e.defaultPrevented) {
41119
41193
  if(onTheEdge > 0 && e.shiftKey) {
41120
- this._firstHiddenInput.focus(); // jump to the top
41121
- e.preventDefault();
41194
+ this._firstHiddenInput.focus(); // jump to the top and move out of grid
41122
41195
  } else if(onTheEdge < 0 && !e.shiftKey) {
41123
- this._lastHiddenInput.focus(); // skip to the end
41124
- e.preventDefault();
41125
- }
41126
- }
41127
- };
41128
- /** @private
41129
- * @param {Object} e
41130
- */
41131
- Core.prototype._onKeyUp = function (e) {
41132
- if(!_isTabCommand(e)) {
41133
- return;
41134
- }
41135
- var activeElem = _getActiveElement(this._element);
41136
- if(e.shiftKey) {
41137
- if(activeElem === this._lastHiddenInput) {
41138
- this._firstHiddenInput.focus();
41139
- e.preventDefault();
41140
- }
41141
- } else {
41142
- if(activeElem === this._firstHiddenInput) {
41143
- this._lastHiddenInput.focus();
41144
- e.preventDefault();
41196
+ this._lastHiddenInput.focus(); // skip to the end and move out of grid
41145
41197
  }
41146
41198
  }
41147
41199
  };
@@ -46678,6 +46730,27 @@ Grid.prototype.setColumnName = function(colIndex, str) {
46678
46730
  };
46679
46731
  /** @public
46680
46732
  * @param {Grid~ColumnReference} colRef
46733
+ * @return {string}
46734
+ */
46735
+ Grid.prototype.getColumnBackgroundColor = function(colRef) {
46736
+ let colDef = this.getColumnDefinition(colRef);
46737
+ if(colDef) {
46738
+ return colDef.getBackgroundColor();
46739
+ }
46740
+ return "";
46741
+ };
46742
+ /** @public
46743
+ * @param {Grid~ColumnReference} colRef
46744
+ * @param {string} color
46745
+ */
46746
+ Grid.prototype.setColumnBackgroundColor = function(colRef, color) {
46747
+ let colDef = this.getColumnDefinition(colRef);
46748
+ if(colDef) {
46749
+ colDef.setBackgroundColor(color);
46750
+ }
46751
+ };
46752
+ /** @public
46753
+ * @param {Grid~ColumnReference} colRef
46681
46754
  * @param {Function=} func
46682
46755
  */
46683
46756
  Grid.prototype.setColumnRenderer = function(colRef, func) {