@refinitiv-ui/efx-grid 6.0.33 → 6.0.34

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/lib/core/dist/core.js +112 -36
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/data/DataTable.d.ts +1 -1
  4. package/lib/core/es6/data/DataTable.js +9 -8
  5. package/lib/core/es6/data/DataView.js +1 -1
  6. package/lib/core/es6/data/Segment.d.ts +2 -0
  7. package/lib/core/es6/data/Segment.js +16 -0
  8. package/lib/core/es6/data/SegmentCollection.d.ts +1 -3
  9. package/lib/core/es6/data/SegmentCollection.js +25 -18
  10. package/lib/core/es6/grid/Core.js +1 -1
  11. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +7 -7
  12. package/lib/grid/index.js +1 -1
  13. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  14. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  15. package/lib/grid/themes/halo/efx-grid.less +2 -0
  16. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  17. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  18. package/lib/rt-grid/dist/rt-grid.js +425 -153
  19. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  20. package/lib/rt-grid/es6/ColumnDefinition.js +13 -8
  21. package/lib/rt-grid/es6/DataConnector.js +3 -2
  22. package/lib/rt-grid/es6/Grid.d.ts +3 -1
  23. package/lib/rt-grid/es6/Grid.js +116 -15
  24. package/lib/rt-grid/es6/RowDefinition.d.ts +7 -2
  25. package/lib/rt-grid/es6/RowDefinition.js +48 -10
  26. package/lib/rt-grid/es6/SnapshotFiller.d.ts +1 -0
  27. package/lib/rt-grid/es6/SnapshotFiller.js +1 -11
  28. package/lib/tr-grid-column-stack/es6/ColumnStack.js +21 -10
  29. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +12 -5
  30. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +128 -42
  31. package/lib/tr-grid-heat-map/es6/HeatMap.d.ts +3 -3
  32. package/lib/tr-grid-heat-map/es6/HeatMap.js +13 -2
  33. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +2 -1
  34. package/lib/tr-grid-row-dragging/es6/RowDragging.js +142 -17
  35. package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +20 -20
  36. package/lib/tr-grid-textformatting/es6/TextFormatting.js +37 -138
  37. package/lib/tr-grid-util/es6/CellPainter.d.ts +1 -1
  38. package/lib/tr-grid-util/es6/CellPainter.js +56 -55
  39. package/lib/tr-grid-util/es6/FieldFormatter.js +6 -2
  40. package/lib/tr-grid-util/es6/NumberFormatter.js +23 -11
  41. package/lib/tr-grid-util/es6/Util.d.ts +3 -0
  42. package/lib/tr-grid-util/es6/Util.js +53 -0
  43. package/lib/types/es6/ConditionalColoring.d.ts +12 -5
  44. package/lib/types/es6/Core/data/Segment.d.ts +2 -0
  45. package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -3
  46. package/lib/types/es6/Core/grid/Core.d.ts +4 -0
  47. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +1 -0
  48. package/lib/types/es6/HeatMap.d.ts +3 -3
  49. package/lib/types/es6/RealtimeGrid/Grid.d.ts +3 -1
  50. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +7 -2
  51. package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +1 -0
  52. package/lib/types/es6/RowDragging.d.ts +2 -1
  53. package/lib/types/es6/TextFormatting.d.ts +20 -20
  54. package/lib/versions.json +6 -6
  55. package/package.json +1 -1
@@ -9,7 +9,7 @@
9
9
  /* harmony export */ "Qr": () => (/* binding */ isEmptyObject),
10
10
  /* harmony export */ "kI": () => (/* binding */ cloneObject)
11
11
  /* harmony export */ });
12
- /* unused harmony exports Util, extendObject, arrayToObject, extendProperty, extendArrayProperty, parseCondition, prettifyCss, getShadowRoot, injectCss, isIE, isMac, isTouchDevice, nestedObjectToArray, rgb2Hex, prepareTSVContent */
12
+ /* unused harmony exports Util, extendObject, deepEqual, arrayToObject, extendProperty, extendArrayProperty, parseCondition, prettifyCss, getShadowRoot, injectCss, isIE, isMac, isTouchDevice, nestedObjectToArray, rgb2Hex, prepareTSVContent */
13
13
  /** @namespace */
14
14
  var Util = {};
15
15
 
@@ -212,6 +212,58 @@ var extendProperty = function (obj, extender, propName) {
212
212
  }
213
213
  }
214
214
  };
215
+
216
+
217
+ /** Compare the values of obj1 and obj2. if they are the same object or have the same value, the result will be true. Otherwise, it will return false.
218
+ * @public
219
+ * @param {*} obj1
220
+ * @param {*} obj2
221
+ * @return {boolean}
222
+ */
223
+ var deepEqual = function (obj1, obj2) {
224
+
225
+ if(obj1 === obj2) {
226
+ return true;
227
+ }
228
+
229
+ if (typeof obj1 !== typeof obj2) {
230
+ return false;
231
+ }
232
+
233
+ if (typeof obj1 === "object") {
234
+
235
+ // We need to split array and object for performance reason
236
+ if(Array.isArray(obj1)) {
237
+ if(obj1.length !== obj2.length) {
238
+ return false;
239
+ }
240
+
241
+ for (var i = 0; i < obj1.length; i++) {
242
+ if (!deepEqual(obj1[i], obj2[i])) { // The array may not be a match if the elements are not sorted, so it will not be considered equal if there is a mismatch.
243
+ return false;
244
+ }
245
+ }
246
+
247
+ } else {
248
+
249
+ if (Object.keys(obj1).length !== Object.keys(obj2).length) {
250
+ return false;
251
+ }
252
+
253
+ for (var key in obj1) {
254
+ if (!deepEqual(obj1[key], obj2[key])) {
255
+ return false;
256
+ }
257
+ }
258
+ }
259
+
260
+
261
+ return true;
262
+ }
263
+
264
+ return false;
265
+
266
+ };
215
267
  /** Array.push() is much faster than Array.concat(). The downside is the parameters must be an array, whereas concat() has no such requirement. <br>
216
268
  * This method excels in extending known array property in an object.
217
269
  * @public
@@ -14060,6 +14112,22 @@ Segment.prototype.getOrder = function() {
14060
14112
  }
14061
14113
  return this._order * 10000;
14062
14114
  };
14115
+ /** Get the last (highest) order from the entire tree regardless of the current position segment in the hierachy
14116
+ * @public
14117
+ * @return {number}
14118
+ */
14119
+ Segment.prototype.getLastOrder = function() {
14120
+ if(this._subSegDef) {
14121
+ var subSegments = this._subSegDef.subSegments;
14122
+ if(subSegments) {
14123
+ var lastSegment = subSegments[subSegments.length - 1];
14124
+ if(lastSegment) {
14125
+ return lastSegment.getOrder();
14126
+ }
14127
+ }
14128
+ }
14129
+ return this.getOrder();
14130
+ };
14063
14131
  /** @public
14064
14132
  * @param {number} val
14065
14133
  */
@@ -14181,9 +14249,10 @@ SegmentCollection.prototype.dispose = function() {
14181
14249
  };
14182
14250
  /** @public
14183
14251
  * @param {string} rid
14252
+ * @param {Array.<string>=} childRids Children of the newly added segment. This is a shorthand to addSegmentChildren method
14184
14253
  * @return {boolean} Returns true if there is any change. Otherwise, returns false
14185
14254
  */
14186
- SegmentCollection.prototype.addSegment = function(rid) {
14255
+ SegmentCollection.prototype.addSegment = function(rid, childRids) {
14187
14256
  if(rid && !this._segments[rid]) {
14188
14257
  if(this.getParentRowId(rid)) {
14189
14258
  console.log("child of a segment cannot be set as a segment separator");
@@ -14194,6 +14263,10 @@ SegmentCollection.prototype.addSegment = function(rid) {
14194
14263
  segment.addEventListener("subSegmentRemoved", this._onSubSegmentRemoved);
14195
14264
  ++this._segmentCount;
14196
14265
  this._segmentList = null; // order could be changed
14266
+
14267
+ if(childRids && childRids.length) {
14268
+ segment.addChildren(childRids);
14269
+ }
14197
14270
  return true;
14198
14271
  }
14199
14272
  return false;
@@ -14541,9 +14614,10 @@ SegmentCollection.prototype.calcSegmentOrder = function(rids) {
14541
14614
  };
14542
14615
  /** @public
14543
14616
  * @param {!Array.<string>} rids Array of row ids
14617
+ * @param {boolean=} partial Indicating that the given ids are not the whole list
14544
14618
  * @return {Array.<number>} Returns Array of segment values, if there are at least one segment, otherwise returns null
14545
- */
14546
- SegmentCollection.prototype.getSegmentValues = function(rids) {
14619
+ */ //
14620
+ SegmentCollection.prototype.getSegmentValues = function(rids, partial) {
14547
14621
  var rowCount = rids ? rids.length : 0;
14548
14622
  if(!rowCount) {
14549
14623
  return null;
@@ -14560,29 +14634,30 @@ SegmentCollection.prototype.getSegmentValues = function(rids) {
14560
14634
  var rid = rids[r];
14561
14635
  curSegment = segmentSeparators[rid];
14562
14636
  if(curSegment) { // segment separator
14563
- if(prevSegment !== curSegment) {
14564
- prevSegment = curSegment;
14565
- segmentVal = curSegment.getOrder() * 100;
14566
- if(segmentVal > highestVal) {
14567
- highestVal = segmentVal;
14637
+ segmentVal = curSegment.getOrder() * 100;
14638
+ offset = 0;
14639
+ if(!curSegment.isSubSegment()) {
14640
+ if(prevSegment !== curSegment) {
14641
+ prevSegment = curSegment;
14642
+ highestVal = curSegment.getLastOrder() * 100;
14568
14643
  }
14569
14644
  }
14570
- offset = 0;
14571
14645
  } else {
14572
14646
  var parentId = childToSegmentId[rid];
14573
14647
  if(parentId) { // segment member
14574
14648
  curSegment = segmentSeparators[parentId];
14575
- if(prevSegment !== curSegment) {
14576
- prevSegment = curSegment;
14577
- segmentVal = curSegment.getOrder() * 100;
14578
- if(segmentVal > highestVal) {
14579
- highestVal = segmentVal;
14580
- }
14581
- }
14649
+ segmentVal = curSegment.getOrder() * 100;
14582
14650
  offset = 1;
14651
+ if(partial) {
14652
+ highestVal = curSegment.getLastOrder() * 100;
14653
+ }
14583
14654
  } else { // row outside of segments
14584
- segmentVal = highestVal;
14585
- offset = 10;
14655
+ if(highestVal) {
14656
+ segmentVal = highestVal;
14657
+ offset = 10;
14658
+ } else {
14659
+ segmentVal = offset = 0;
14660
+ }
14586
14661
  }
14587
14662
  }
14588
14663
 
@@ -15764,11 +15839,12 @@ DataTable.prototype.getSegmentParentRowId = function(rid) {
15764
15839
  /**
15765
15840
  * @public
15766
15841
  * @param {Array.<string>=} rids If no row id is given, row ids of this data table is used instead
15842
+ * @param {boolean=} partial Indicating that the given ids are not the whole list
15767
15843
  * @return {Array.<number>} Return null if there is no segmentation
15768
15844
  */
15769
- DataTable.prototype.getSegmentValues = function(rids) {
15845
+ DataTable.prototype.getSegmentValues = function(rids, partial) {
15770
15846
  if(this._segments) {
15771
- return this._segments.getSegmentValues(rids || this._rids);
15847
+ return this._segments.getSegmentValues(rids || this._rids, partial);
15772
15848
  }
15773
15849
  return null;
15774
15850
  };
@@ -15851,9 +15927,9 @@ DataTable.prototype.addSegmentChild = function(segmentId, rid, dataId) {
15851
15927
  if(this._segments) {
15852
15928
  var dirty = this._segments.addSegmentChild(segmentId, rid, dataId);
15853
15929
  if(dirty) {
15854
- if(this._sort(null)) {
15855
- this._dispatchPositionChange();
15856
- }
15930
+ this._sort(null);
15931
+ this._dispatchPositionChange(); // Force rerendering, even if there is no position change
15932
+
15857
15933
  this.requestClassifying();
15858
15934
  return true;
15859
15935
  }
@@ -15870,9 +15946,9 @@ DataTable.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
15870
15946
  if(this._segments) {
15871
15947
  var dirty = this._segments.addSegmentChildren(segmentId, rids, dataIds);
15872
15948
  if(dirty) {
15873
- if(this._sort(null)) {
15874
- this._dispatchPositionChange();
15875
- }
15949
+ this._sort(null);
15950
+ this._dispatchPositionChange(); // Force rerendering, even if there is no position change
15951
+
15876
15952
  this.requestClassifying();
15877
15953
  return true;
15878
15954
  }
@@ -21864,7 +21940,7 @@ DataView.prototype._sort = function() {
21864
21940
  if(this._dt._getSegmentSeparators() || this.isSorting()) {
21865
21941
  var rids = this._rids;
21866
21942
  var dataRows = this._dt.getMultipleRowData(rids);
21867
- var segmentValues = this._dt.getSegmentValues(rids);
21943
+ var segmentValues = this._dt.getSegmentValues(rids, true); // WARNING: This does not work well for hidden/filtered rows
21868
21944
  var change = data_DataTable._performMultiLevelSorting(dataRows, this._sortingDefs, segmentValues);
21869
21945
 
21870
21946
  if(change) {
@@ -25618,7 +25694,7 @@ Core_Core.prototype._groupDefs = null;
25618
25694
  * @return {string}
25619
25695
  */
25620
25696
  Core_Core.getVersion = function () {
25621
- return "5.1.42";
25697
+ return "5.1.45";
25622
25698
  };
25623
25699
  /** {@link ElementWrapper#dispose}
25624
25700
  * @override
@@ -32442,16 +32518,16 @@ SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
32442
32518
  symbol = t._createIconElem(icon, textContent);
32443
32519
  symbol.className = "sort-symbol";
32444
32520
  cell["insertFloatingIcon"](symbol, 0);
32445
-
32446
- if (t._sortStates.length > 1) {
32447
- symbol = document.createElement("span");
32448
- symbol.className = "priority-symbol";
32449
- symbol.textContent = priority + 1;
32450
- cell["insertFloatingIcon"](symbol, 1);
32451
- }
32452
32521
  } else {
32453
32522
  cell["addClass"]("edge-indicator");
32454
32523
  }
32524
+
32525
+ if (t._sortStates.length > 1) {
32526
+ symbol = document.createElement("span");
32527
+ symbol.className = "priority-symbol";
32528
+ symbol.textContent = priority + 1;
32529
+ cell["insertFloatingIcon"](symbol, 1);
32530
+ }
32455
32531
  } else if (t._sortableIndicator) { // Can sort but currently not sorting
32456
32532
  icon = SortableTitlePlugin._icons["sortable"];
32457
32533
  symbol = t._createIconElem(icon, CODE_DIAMOND);