@refinitiv-ui/efx-grid 6.0.54 → 6.0.56

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.
@@ -198,15 +198,6 @@ var cloneRowData = function(fromRowDef, toRowDef) {
198
198
  }
199
199
  };
200
200
 
201
- /** @private
202
- * @param {string} sortField
203
- * @param {Object} elemData
204
- * @param {number} index
205
- */
206
- var mapRowOrder = function (sortField, elemData, index) { // edit name
207
- elemData[sortField] = index; // Make column for sort with user data array
208
- };
209
-
210
201
  /** @private
211
202
  * @param {RowDefinition} rowDef
212
203
  * @return {boolean}
@@ -2458,20 +2449,11 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
2458
2449
  }
2459
2450
 
2460
2451
  // Map new data index
2461
- var newDataMap = {};
2462
2452
  var recordCount = records.length;
2463
- var record, i;
2464
- for (i = 0; i < recordCount; i++) {
2465
- record = records[i];
2466
- newDataMap[record[rowIdentifier]] = record; // Assign a new data map to compare to the previous data
2467
- }
2468
-
2469
2453
  var fieldSorting = "ROW_ORDER"; // TODO: Should be config by options
2470
- records.forEach(mapRowOrder.bind(null, fieldSorting));
2471
-
2472
2454
  var oldDataMap = {};
2473
- var rowDef, id;
2474
- var rowDefs = this.getRowDefinitions(); // WARNING: Filtered and hidden rows are not included
2455
+ var rowDef, id, record, i;
2456
+ var rowDefs = this.getAllRowDefinitions(); // Include the filter/hidden rows
2475
2457
  var rowDefCount = rowDefs.length;
2476
2458
  for (i = 0; i < rowDefCount; i++) {
2477
2459
  rowDef = rowDefs[i];
@@ -2485,26 +2467,35 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
2485
2467
  }
2486
2468
  }
2487
2469
 
2488
- // Check Remove previous data
2489
- for (var rowIdentifierName in oldDataMap) {
2490
- if (oldDataMap[rowIdentifierName] && !newDataMap[rowIdentifierName]) {
2491
- this.removeRow(oldDataMap[rowIdentifierName]); // Slow
2492
- }
2493
- }
2494
-
2495
2470
  // Check Update and Insert
2496
- for (i = 0; i < recordCount; i++) {
2471
+ var idMap = {};
2472
+ var newDataMap = {};
2473
+ for (i = recordCount - 1; i >= 0; i--) {
2497
2474
  record = records[i];
2498
2475
  id = record[rowIdentifier];
2499
2476
  rowDef = oldDataMap[id];
2477
+ newDataMap[id] = record; // Assign a new data map to compare to the previous data
2478
+ record[fieldSorting] = i;
2479
+ if(idMap[id]) { // Prevent assign data in duplicate row
2480
+ continue;
2481
+ }
2482
+ idMap[id] = true;
2500
2483
  if (!rowDef) {
2501
- this.insertRow({ values: newDataMap[id]}); // Insert last position
2484
+ this.insertRow({ values: record}); // Insert last position
2502
2485
  } else {
2503
2486
  rowDef.setRowData(record);
2504
2487
  }
2505
2488
  }
2489
+
2490
+ // Check Remove previous data
2491
+ for (var rowIdentifierName in oldDataMap) {
2492
+ if (oldDataMap[rowIdentifierName] && !newDataMap[rowIdentifierName]) {
2493
+ this.removeRow(oldDataMap[rowIdentifierName]); // Slow
2494
+ }
2495
+ }
2496
+
2506
2497
  // Sorting
2507
- this._dt.sortOnce("ROW_DEF", "a", compareNumber, fieldSorting);
2498
+ this._dt.sortOnce(ROW_DEF, "a", compareNumber, fieldSorting);
2508
2499
  };
2509
2500
  /** @private
2510
2501
  * @param {Array|Object} item
@@ -702,7 +702,7 @@ StatisticsRowPlugin.prototype._onPostSectionDataBinding = function (e) {
702
702
  }
703
703
  // Render stuff
704
704
  for(c = 0; c < colCount; ++c) {
705
- this._renderStatistics(c, statistics[c], e.actualUpdate);
705
+ this._renderStatistics(c, statistics[c], e ? e.actualUpdate : false);
706
706
  }
707
707
 
708
708
  if(this.hasListener("postRendering")) {
@@ -88,7 +88,7 @@ ColumnGroupingPlugin.prototype._legacyColumnGroups = null;
88
88
  * @private
89
89
  */
90
90
  ColumnGroupingPlugin.prototype._inPinning = false;
91
- /** @type {!Object.<string, boolean}
91
+ /** @type {!Object.<string, boolean>}
92
92
  * @description A map of selected groups
93
93
  * @private
94
94
  */
@@ -165,6 +165,8 @@ var InCellEditingPlugin = function InCellEditingPlugin(options) {
165
165
  t._createTitleEditor = t._createTitleEditor.bind(t);
166
166
  t._onColumnAdded = t._onColumnAdded.bind(t);
167
167
  t._onValueChanged = t._onValueChanged.bind(t);
168
+ t._onMultiSelectionValueChanged = t._onMultiSelectionValueChanged.bind(t);
169
+ t._onMultiSelectionEditorChanged = t._onMultiSelectionEditorChanged.bind(t);
168
170
  t._onAutoSuggestItemSelected = t._onAutoSuggestItemSelected.bind(t);
169
171
  t._hosts = [];
170
172
  if (options) {
@@ -393,7 +395,12 @@ InCellEditingPlugin.prototype._createInputElement = function (tag, attributes) {
393
395
  }
394
396
  });
395
397
  } else if (tag === typeMap.select || tag === typeMap.combobox || tag === typeMap.date) {
396
- elem.addEventListener("value-changed", t._onValueChanged);
398
+ if (tag === typeMap.combobox && attributes && attributes["multiple"]) {
399
+ elem.addEventListener("value-changed", t._onMultiSelectionValueChanged);
400
+ elem.addEventListener("opened-changed", t._onMultiSelectionEditorChanged);
401
+ } else {
402
+ elem.addEventListener("value-changed", t._onValueChanged);
403
+ }
397
404
  } else if (tag === "ef-input") {
398
405
  elem.setAttribute("type", "number");
399
406
  } else if (tag === typeMap.input) {
@@ -1481,6 +1488,26 @@ InCellEditingPlugin.prototype._onValueChanged = function (e) {
1481
1488
 
1482
1489
  this._commitText(true);
1483
1490
  };
1491
+ /** @private
1492
+ * @param {Object} e
1493
+ */
1494
+ InCellEditingPlugin.prototype._onMultiSelectionValueChanged = function (e) {
1495
+ e.currentTarget.dirty = true;
1496
+ };
1497
+ /** @private
1498
+ * @param {Object} e
1499
+ */
1500
+ InCellEditingPlugin.prototype._onMultiSelectionEditorChanged = function (e) {
1501
+ if (e.detail && e.detail.value === false) {
1502
+ if (this._activePos) {
1503
+ var inputElement = this._activePos["inputElement"];
1504
+ if (inputElement.dirty) {
1505
+ this._onValueChanged(e);
1506
+ inputElement.dirty = false;
1507
+ }
1508
+ }
1509
+ }
1510
+ };
1484
1511
 
1485
1512
  /** @private
1486
1513
  * @param {Object} e
@@ -1767,7 +1794,10 @@ InCellEditingPlugin.prototype._setText = function (content, inputElement) {
1767
1794
  inputElement.removeAttribute("checked");
1768
1795
  }
1769
1796
  } else if (inputTag === typeMap.combobox) {
1770
- if (this._elfVersion <= 3) {
1797
+ var isMultiple = inputElement.getAttribute("multiple");
1798
+ if (isMultiple) {
1799
+ inputElement.values = content.split(/, */);
1800
+ } else if (this._elfVersion <= 3) {
1771
1801
  inputElement.value = "";
1772
1802
  inputElement.value = {
1773
1803
  value: content,
@@ -1847,6 +1877,8 @@ InCellEditingPlugin.prototype._getValue = function (inputElement) {
1847
1877
  } else if (inputTag === typeMap.number || typeof inputElement._origValue === "number" // Smart data conversion based orignal value
1848
1878
  ) {
1849
1879
  return +inputElement.value;
1880
+ } else if (inputTag === typeMap.combobox && inputElement.getAttribute("multiple")) {
1881
+ return inputElement.values.join(", ");
1850
1882
  }
1851
1883
  return this._getText(inputElement);
1852
1884
  };
@@ -407,7 +407,7 @@ declare class Core extends ElementWrapper {
407
407
 
408
408
  public getValidColumnList(colIds: (string)[]|null, columnMap?: any): (string)[];
409
409
 
410
- public createColumnMap(colIds?: (string)[]|null): any;
410
+ public createColumnMap(colRefs?: (string|number)[]|null): any;
411
411
 
412
412
  public startBatch(batchType: string): boolean;
413
413
 
package/lib/versions.json CHANGED
@@ -3,14 +3,14 @@
3
3
  "tr-grid-printer": "1.0.16",
4
4
  "@grid/column-dragging": "1.0.14",
5
5
  "@grid/row-segmenting": "1.0.24",
6
- "@grid/statistics-row": "1.0.14",
6
+ "@grid/statistics-row": "1.0.15",
7
7
  "@grid/zoom": "1.0.11",
8
8
  "tr-grid-auto-tooltip": "1.1.6",
9
9
  "tr-grid-cell-selection": "1.0.33",
10
10
  "tr-grid-checkbox": "1.0.60",
11
11
  "tr-grid-column-fitter": "1.0.39",
12
12
  "tr-grid-column-formatting": "0.9.34",
13
- "tr-grid-column-grouping": "1.0.53",
13
+ "tr-grid-column-grouping": "1.0.54",
14
14
  "tr-grid-column-resizing": "1.0.28",
15
15
  "tr-grid-column-selection": "1.0.29",
16
16
  "tr-grid-column-stack": "1.0.68",
@@ -19,7 +19,7 @@
19
19
  "tr-grid-contextmenu": "1.0.39",
20
20
  "tr-grid-filter-input": "0.9.33",
21
21
  "tr-grid-heat-map": "1.0.29",
22
- "tr-grid-in-cell-editing": "1.0.78",
22
+ "tr-grid-in-cell-editing": "1.0.79",
23
23
  "tr-grid-pagination": "1.0.24",
24
24
  "tr-grid-percent-bar": "1.0.22",
25
25
  "tr-grid-range-bar": "2.0.4",
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.54"
69
+ "version": "6.0.56"
70
70
  }