@refinitiv-ui/efx-grid 6.0.159 → 6.0.161

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.
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.159" };
3
+ window.EFX_GRID = { version: "6.0.161" };
@@ -48464,22 +48464,46 @@ Grid_Grid.prototype._getRowId = function(rowRef) {
48464
48464
  return "";
48465
48465
  };
48466
48466
 
48467
+ /** Clear all existing data from the specified column(s).
48468
+ * @public
48469
+ * @param {Grid~ColumnReference|Array.<Grid~ColumnReference>} colRefs
48470
+ */
48471
+ Grid_Grid.prototype.clearColumnData = function(colRefs) {
48472
+ let colIndices = this.getColumnIndices(colRefs);
48473
+ let colCount = colIndices.length;
48474
+ if(!colCount) {
48475
+ return;
48476
+ }
48477
+ let emptyData = {};
48478
+ for(let c = 0; c < colCount; ++c) {
48479
+ let colIndex = colIndices[c];
48480
+ let field = this.getColumnField(colIndex);
48481
+ if(field) {
48482
+ emptyData[field] = null;
48483
+ }
48484
+ }
48485
+
48486
+ let rowDefs = this.getAllRowDefinitions();
48487
+ let rowCount = rowDefs.length;
48488
+ for(let r = 0; r < rowCount; ++r) {
48489
+ rowDefs[r].setRowData(emptyData); // There is a conflator caching the data change in DataCache
48490
+ }
48491
+ };
48492
+
48467
48493
  /** @public
48468
48494
  * @param {Grid~ColumnReference} colRef
48469
48495
  * @return {number}
48470
48496
  */
48471
48497
  Grid_Grid.prototype.getColumnIndex = function(colRef) {
48472
- if(colRef) {
48473
- if(colRef instanceof ColumnDefinition) {
48474
- let colCount = this.getColumnCount();
48475
- for(let i = 0; i < colCount; ++i) {
48476
- let colDef = this.getColumnDefinition(i);
48477
- if(colDef === colRef) {
48478
- return i;
48479
- }
48498
+ if(colRef instanceof ColumnDefinition) {
48499
+ let colCount = this.getColumnCount();
48500
+ for(let i = 0; i < colCount; ++i) {
48501
+ let colDef = this.getColumnDefinition(i);
48502
+ if(colDef === colRef) {
48503
+ return i;
48480
48504
  }
48481
- return -1;
48482
48505
  }
48506
+ return -1;
48483
48507
  }
48484
48508
  return this._grid.getColumnIndex(colRef);
48485
48509
  };
@@ -48490,14 +48514,16 @@ Grid_Grid.prototype.getColumnIndex = function(colRef) {
48490
48514
  */
48491
48515
  Grid_Grid.prototype.getColumnIndices = function(colRefs) {
48492
48516
  let ary = [];
48493
- let colCount = this.getColumnCount();
48494
- let inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
48495
- let len = inputAry.length;
48496
- // Verify user input
48497
- for(let i = 0; i < len; ++i) {
48498
- let colIndex = this.getColumnIndex(inputAry[i]);
48499
- if(colIndex >= 0 && colIndex < colCount) {
48500
- ary.push(colIndex); // WARNING: We have not checked for duplication
48517
+ if(colRefs || colRefs === 0) {
48518
+ let colCount = this.getColumnCount();
48519
+ let inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
48520
+ let len = inputAry.length;
48521
+ // Verify user input
48522
+ for(let i = 0; i < len; ++i) {
48523
+ let colIndex = this.getColumnIndex(inputAry[i]);
48524
+ if(colIndex >= 0 && colIndex < colCount) {
48525
+ ary.push(colIndex); // WARNING: We have not checked for duplication
48526
+ }
48501
48527
  }
48502
48528
  }
48503
48529
  return ary;