@refinitiv-ui/efx-grid 6.0.73 → 6.0.75

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.73" };
3
+ window.EFX_GRID = { version: "6.0.75" };
@@ -213,26 +213,8 @@ class Grid extends ResponsiveElement {
213
213
  */
214
214
  _dataUpdated() {
215
215
  const api = this.api;
216
- if (api) { // TODO: parse string data to JSON object
217
- let staticRows = this.data;
218
- if (staticRows) {
219
- const rowCount = api.getRowCount();
220
- if (!rowCount) {
221
- api.addStaticDataRows(this.data);
222
- }
223
- else {
224
- // Update data to existing row
225
- const fields = api.getColumnFields();
226
- for (let i = 0; i < rowCount; i++) {
227
- const rowDef = api.getRowDefinition(i);
228
- rowDef.updateRowData(staticRows[i], fields);
229
- }
230
- if (staticRows.length > rowCount) {
231
- staticRows = staticRows.slice(rowCount, staticRows.length);
232
- api.addStaticDataRows(staticRows);
233
- }
234
- }
235
- }
216
+ if (api && this.data) { // TODO: parse string data to JSON object
217
+ api.updateDataSet(this.data);
236
218
  }
237
219
  }
238
220
 
@@ -36235,7 +36235,7 @@ Core.prototype._firstRendered = false;
36235
36235
  * @return {string}
36236
36236
  */
36237
36237
  Core.getVersion = function () {
36238
- return "5.1.80";
36238
+ return "5.1.81";
36239
36239
  };
36240
36240
  /** {@link ElementWrapper#dispose}
36241
36241
  * @override
@@ -41106,7 +41106,7 @@ Core.prototype._onRowHeightChanged = function (e) {
41106
41106
  // TODO: Set row height one by one is not good
41107
41107
  for(var j = 0; j < len; ++j) {
41108
41108
  var evt = evts[j];
41109
- var section = /** @type {ILayoutGrid} */(evt["sender"]);
41109
+ var section = /** @type {ILayoutGrid} */(evt["section"]);
41110
41110
  if(!this._containsSection(section)) {
41111
41111
  continue; // The section is no longer contained in this grid
41112
41112
  }
@@ -46757,6 +46757,32 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
46757
46757
  }
46758
46758
  }
46759
46759
  }
46760
+
46761
+ var idMap = {};
46762
+ var newDataMap = {};
46763
+ for (i = recordCount - 1; i >= 0; i--) {
46764
+ record = records[i];
46765
+ id = record[rowIdentifier];
46766
+ rowDef = oldDataMap[id];
46767
+ newDataMap[id] = record; // Assign a new data map to compare to the previous data
46768
+ record[fieldSorting] = i;
46769
+ if(idMap[id]) { // Prevent assign data in duplicate row
46770
+ continue;
46771
+ }
46772
+ idMap[id] = true;
46773
+ if (!rowDef) {
46774
+ this.insertRow({ values: record}); // Insert last position
46775
+ } else {
46776
+ rowDef.setRowData(record);
46777
+ }
46778
+ }
46779
+ // Check Remove previous data
46780
+ for (var rowIdentifierName in oldDataMap) {
46781
+ if (oldDataMap[rowIdentifierName] && !newDataMap[rowIdentifierName]) {
46782
+ this.removeRow(oldDataMap[rowIdentifierName]); // Slow
46783
+ }
46784
+ }
46785
+ this._dt.sortOnce(ROW_DEF, "a", compareNumber, fieldSorting);
46760
46786
  } else {
46761
46787
  for (i = 0; i < rowDefCount; i++) {
46762
46788
  record = records[i];
@@ -46766,38 +46792,17 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
46766
46792
  this.removeRow(rowDefs[i]); // Need to use rowRef, can't use index in view
46767
46793
  }
46768
46794
  }
46769
- }
46770
-
46771
- // Check Update and Insert
46772
- var idMap = {};
46773
- var newDataMap = {};
46774
- for (i = recordCount - 1; i >= 0; i--) {
46775
- record = records[i];
46776
- id = rowIdentifier ? record[rowIdentifier] : i;
46777
- rowDef = oldDataMap[id];
46778
- newDataMap[id] = record; // Assign a new data map to compare to the previous data
46779
- record[fieldSorting] = i;
46780
- if(idMap[id]) { // Prevent assign data in duplicate row
46781
- continue;
46782
- }
46783
- idMap[id] = true;
46784
- if (!rowDef) {
46785
- this.insertRow({ values: record}); // Insert last position
46786
- } else {
46787
- rowDef.setRowData(record);
46788
- }
46789
- }
46790
46795
 
46791
- // Check Remove previous data
46792
- for (var rowIdentifierName in oldDataMap) {
46793
- if (oldDataMap[rowIdentifierName] && !newDataMap[rowIdentifierName]) {
46794
- this.removeRow(oldDataMap[rowIdentifierName]); // Slow
46796
+ for (i = 0; i < recordCount; i++) { // It will be sort by index when insert / update
46797
+ record = records[i];
46798
+ rowDef = oldDataMap[i];
46799
+ if (!rowDef) {
46800
+ this.insertRow({ values: record}); // Insert last position
46801
+ } else {
46802
+ rowDef.setRowData(record);
46803
+ }
46795
46804
  }
46796
46805
  }
46797
-
46798
- if(rowIdentifier) {
46799
- this._dt.sortOnce(ROW_DEF, "a", compareNumber, fieldSorting);
46800
- }
46801
46806
  };
46802
46807
  /** @private
46803
46808
  * @param {Array|Object} item