@refinitiv-ui/efx-grid 6.0.26 → 6.0.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/lib/core/dist/core.js +287 -34
  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 +3 -2
  5. package/lib/core/es6/data/DataView.d.ts +1 -1
  6. package/lib/core/es6/data/DataView.js +3 -2
  7. package/lib/core/es6/data/Segment.d.ts +1 -1
  8. package/lib/core/es6/data/Segment.js +12 -3
  9. package/lib/core/es6/data/SegmentCollection.d.ts +1 -1
  10. package/lib/core/es6/data/SegmentCollection.js +3 -2
  11. package/lib/core/es6/grid/Core.d.ts +17 -3
  12. package/lib/core/es6/grid/Core.js +226 -20
  13. package/lib/core/es6/grid/components/Scrollbar.js +6 -0
  14. package/lib/grid/index.js +1 -1
  15. package/lib/row-segmenting/es6/RowSegmenting.js +21 -2
  16. package/lib/rt-grid/dist/rt-grid.js +418 -238
  17. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  18. package/lib/rt-grid/es6/ColumnDefinition.d.ts +2 -2
  19. package/lib/rt-grid/es6/ColumnDefinition.js +71 -70
  20. package/lib/rt-grid/es6/Grid.d.ts +9 -2
  21. package/lib/rt-grid/es6/Grid.js +55 -132
  22. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +12 -2
  23. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +138 -47
  24. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +14 -1
  25. package/lib/tr-grid-column-stack/es6/ColumnStack.js +317 -187
  26. package/lib/tr-grid-range-bar/es6/RangeBar.d.ts +4 -0
  27. package/lib/tr-grid-range-bar/es6/RangeBar.js +8 -0
  28. package/lib/tr-grid-util/es6/GridPlugin.d.ts +6 -0
  29. package/lib/tr-grid-util/es6/GridPlugin.js +67 -0
  30. package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +5 -1
  31. package/lib/tr-grid-util/es6/GroupDefinitions.js +34 -5
  32. package/lib/types/es6/ColumnGrouping.d.ts +12 -2
  33. package/lib/types/es6/ColumnStack.d.ts +14 -1
  34. package/lib/types/es6/Core/data/DataTable.d.ts +1 -1
  35. package/lib/types/es6/Core/data/DataView.d.ts +1 -1
  36. package/lib/types/es6/Core/data/Segment.d.ts +1 -1
  37. package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -1
  38. package/lib/types/es6/Core/grid/Core.d.ts +17 -3
  39. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +2 -2
  40. package/lib/types/es6/RealtimeGrid/Grid.d.ts +9 -2
  41. package/lib/versions.json +5 -5
  42. package/package.json +1 -1
@@ -8013,6 +8013,12 @@ Scrollbar.prototype.getDefaultMouseWheelLogic = function () {
8013
8013
  * @param {Event} e
8014
8014
  */
8015
8015
  Scrollbar.prototype._onMouseWheel = function (e) {
8016
+
8017
+ // Blacklist for prevent triggering the scrollbar when the dialog is opened.
8018
+ if(e.target.opened) { // get attribute method doesn't work in elf element
8019
+ return;
8020
+ }
8021
+
8016
8022
  if (this._isFrozen) {
8017
8023
  util._preventDefault(e);
8018
8024
  return;
@@ -11499,7 +11505,7 @@ GroupDefinitions.prototype.removeGroup = function (groupId) {
11499
11505
  var curDef = this._groupMap[groupId];
11500
11506
  if(curDef) {
11501
11507
  this.removeAllChildren(groupId);
11502
- this.removeGroupChild(groupId);
11508
+ this.unsetParent(groupId);
11503
11509
  delete this._groupMap[groupId];
11504
11510
 
11505
11511
  return true;
@@ -11558,12 +11564,26 @@ GroupDefinitions.prototype._ungroupChildren = function(children) {
11558
11564
  if (Array.isArray(children)) {
11559
11565
  var len = children.length;
11560
11566
  for(var i = 0; i < len; ++i) {
11561
- this.removeGroupChild(children[i]);
11567
+ this.unsetParent(children[i]);
11562
11568
  }
11563
11569
  }
11564
11570
  };
11565
11571
 
11566
-
11572
+ /** @public
11573
+ * @param {string} parentId Group id
11574
+ * @param {string} childId
11575
+ * @return {boolean}
11576
+ */
11577
+ GroupDefinitions.prototype.hasGroupChild = function (parentId, childId) {
11578
+ var groupDef = this._groupMap[parentId];
11579
+ if(childId && groupDef) {
11580
+ var chdr = groupDef.children;
11581
+ if(chdr) {
11582
+ return chdr.indexOf(childId) >= 0;
11583
+ }
11584
+ }
11585
+ return false;
11586
+ };
11567
11587
  /** @public
11568
11588
  * @param {string} parentId Group id
11569
11589
  * @param {string} childId
@@ -11575,7 +11595,7 @@ GroupDefinitions.prototype.addGroupChild = function (parentId, childId) {
11575
11595
  if(childId && groupDef) {
11576
11596
  var chdr = groupDef.children;
11577
11597
  if(chdr && chdr.indexOf(childId) < 0) {
11578
- this.removeGroupChild(childId); // Remove previous parent
11598
+ this.unsetParent(childId); // Remove previous parent
11579
11599
  // Add new child to group structures
11580
11600
  this._childToParent[childId] = parentId;
11581
11601
  var childDef = this._groupMap[childId];
@@ -11588,12 +11608,27 @@ GroupDefinitions.prototype.addGroupChild = function (parentId, childId) {
11588
11608
  }
11589
11609
  return false;
11590
11610
  };
11611
+ /** Remove the given child from the specified parent. If childId is not given, unsetParent will be used on parentId instead of childId.
11612
+ * @public
11613
+ * @param {string} parentId Group id
11614
+ * @param {string=} childId
11615
+ * @return {boolean}
11616
+ */
11617
+ GroupDefinitions.prototype.removeGroupChild = function (parentId, childId) {
11618
+ if(childId == null) {
11619
+ return this.unsetParent(parentId);
11620
+ }
11621
+ if(this.hasGroupChild(parentId, childId)) {
11622
+ return this.unsetParent(childId);
11623
+ }
11624
+ return false;
11625
+ };
11591
11626
  /** Remove the given child from its own parent (i.e., unset Parent of the given child).
11592
11627
  * @public
11593
11628
  * @param {string} childId
11594
11629
  * @return {boolean}
11595
11630
  */
11596
- GroupDefinitions.prototype.removeGroupChild = function (childId) {
11631
+ GroupDefinitions.prototype.unsetParent = function (childId) {
11597
11632
  var parentId = this._childToParent[childId];
11598
11633
  if(!parentId) {
11599
11634
  return false;
@@ -13354,14 +13389,23 @@ Segment.prototype.addChild = function(rid, dataId) {
13354
13389
  };
13355
13390
  /** @public
13356
13391
  * @param {Array.<string>} rids
13392
+ * @param {Array.<string>=} dataIds Row ids for retrieving data
13357
13393
  * @return {boolean}
13358
13394
  */
13359
- Segment.prototype.addChildren = function(rids) {
13395
+ Segment.prototype.addChildren = function(rids, dataIds) {
13360
13396
  var rowIds = Array.isArray(rids) ? rids : [rids];
13361
13397
  var rowCount = rowIds.length;
13362
13398
  var dirty = 0;
13363
- for(var i = 0; i < rowCount; ++i) {
13364
- dirty |= this.addChild(rowIds[i]);
13399
+ var i;
13400
+ if(dataIds != null) {
13401
+ dataIds = Array.isArray(dataIds) ? dataIds : [dataIds];
13402
+ for(i = 0; i < rowCount; ++i) {
13403
+ dirty |= this.addChild(rowIds[i], dataIds[i]);
13404
+ }
13405
+ } else {
13406
+ for(i = 0; i < rowCount; ++i) {
13407
+ dirty |= this.addChild(rowIds[i]);
13408
+ }
13365
13409
  }
13366
13410
  return dirty ? true : false;
13367
13411
  };
@@ -14187,12 +14231,13 @@ SegmentCollection.prototype.addSegmentChild = function(segmentId, rid, dataId) {
14187
14231
  /** @public
14188
14232
  * @param {string} segmentId
14189
14233
  * @param {Array.<string>} rids
14234
+ * @param {Array.<string>=} dataIds Row ids for retrieving data
14190
14235
  * @return {boolean} Returns true if there is any change. Otherwise, returns false
14191
14236
  */
14192
- SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids) {
14237
+ SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
14193
14238
  var segment = this._segments[segmentId];
14194
14239
  if(segment && !segment.isSubSegment()) {
14195
- return segment.addChildren(rids);
14240
+ return segment.addChildren(rids, dataIds);
14196
14241
  }
14197
14242
  return false;
14198
14243
  };
@@ -15656,11 +15701,12 @@ DataTable.prototype.addSegmentChild = function(segmentId, rid, dataId) {
15656
15701
  /** @public
15657
15702
  * @param {string} segmentId Row id
15658
15703
  * @param {Array.<string>} rids Row id
15704
+ * @param {Array.<string>=} dataIds Row ids for retrieving data
15659
15705
  * @return {boolean} Return true if there is any change
15660
15706
  */
15661
- DataTable.prototype.addSegmentChildren = function(segmentId, rids) {
15707
+ DataTable.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
15662
15708
  if(this._segments) {
15663
- var dirty = this._segments.addSegmentChildren(segmentId, rids);
15709
+ var dirty = this._segments.addSegmentChildren(segmentId, rids, dataIds);
15664
15710
  if(dirty) {
15665
15711
  if(this._sort(null)) {
15666
15712
  this._dispatchPositionChange();
@@ -20829,13 +20875,14 @@ DataView.prototype.addSegmentChild = function(segmentRef, rowRef, dataId) {
20829
20875
  /** @public
20830
20876
  * @param {string|number} segmentRef Row id or row index
20831
20877
  * @param {Array.<string|number>} rowRefs Array of row ids or row indices
20878
+ * @param {Array.<string>=} dataIds Row ids for retrieving data
20832
20879
  * @return {boolean} Return true if there is any change
20833
20880
  */
20834
- DataView.prototype.addSegmentChildren = function(segmentRef, rowRefs) {
20881
+ DataView.prototype.addSegmentChildren = function(segmentRef, rowRefs, dataIds) {
20835
20882
  if(this._dt._getSegmentSeparators()) {
20836
20883
  var segmentId = this._toRowId(segmentRef);
20837
20884
  var rowIds = this._toRowIds(rowRefs);
20838
- return this._dt.addSegmentChildren(segmentId, rowIds);
20885
+ return this._dt.addSegmentChildren(segmentId, rowIds, dataIds);
20839
20886
  }
20840
20887
  return false;
20841
20888
  };
@@ -25372,7 +25419,7 @@ Core_Core.prototype._groupDefs = null;
25372
25419
  * @return {string}
25373
25420
  */
25374
25421
  Core_Core.getVersion = function () {
25375
- return "5.1.34";
25422
+ return "5.1.38";
25376
25423
  };
25377
25424
  /** {@link ElementWrapper#dispose}
25378
25425
  * @override
@@ -25488,6 +25535,12 @@ Core_Core.prototype.getConfigObject = function (gridOptions) {
25488
25535
  }
25489
25536
 
25490
25537
  var columnDef = this._getColumnDef(colIndex);
25538
+ if(columnDef["userId"]) {
25539
+ column["id"] = columnDef["userId"];
25540
+ }
25541
+ if(columnDef["field"]) {
25542
+ column["field"] = columnDef["field"];
25543
+ }
25491
25544
  if (columnDef["styles"]) {
25492
25545
  column["styles"] = columnDef["styles"];
25493
25546
  }
@@ -26572,6 +26625,126 @@ Core_Core.prototype._moveColumn = function (fromCol, destCol) {
26572
26625
  return true;
26573
26626
  };
26574
26627
 
26628
+ /** If source column is not found, no operation is performed. If destination column is not found, the source column will be moved to the last position.<br>
26629
+ * Note: this method behaves slightly different from moveColumn method in that it always put source column at the position before the specified destination column, while moveColumn method will put column at exactly at the destination index.
26630
+ * @public
26631
+ * @param {number|string} srcCol Column Id or index
26632
+ * @param {(number|string)=} destCol Column Id or index of the destination
26633
+ * @return {boolean} Return true if there is any change, and false otherwise
26634
+ * @see {@link Core#moveColumn}
26635
+ * @example
26636
+ * grid.moveColumnById(3, 1); // Move column 3 to position before column 1
26637
+ * grid.moveColumnById(0, 2); // Move column 0 to position before column 2 (column index 1)
26638
+ * grid.moveColumnById(0, 1); // Nothing is moved
26639
+ * grid.moveColumnById("sourceColumnId", "anotherId");
26640
+ * grid.moveColumnById("sourceColumnId", ""); // move to the last position
26641
+ */
26642
+ Core_Core.prototype.moveColumnById = function (srcCol, destCol) {
26643
+ var colCount = this.getColumnCount();
26644
+ var srcIndex = this.getColumnIndex(srcCol);
26645
+ if(srcIndex < 0 || srcIndex >= colCount) {
26646
+ return false;
26647
+ }
26648
+ var destIndex = destCol != null ? this.getColumnIndex(destCol) : -1;
26649
+ if(destIndex < 0) {
26650
+ destIndex = colCount;
26651
+ }
26652
+ return this._moveColumnByIndex(srcIndex, destIndex);
26653
+ };
26654
+ /** Move column without verification for better performance
26655
+ * @private
26656
+ * @param {number} srcIndex Column index
26657
+ * @param {number} destIndex Column index of the destination
26658
+ * @return {boolean} Return true if there is any change, and false otherwise
26659
+ */
26660
+ Core_Core.prototype._moveColumnByIndex = function (srcIndex, destIndex) {
26661
+ if(srcIndex < destIndex) { // Ensure that the source column is put in front of the destination index
26662
+ --destIndex;
26663
+ }
26664
+ if(srcIndex === destIndex) {
26665
+ return false;
26666
+ }
26667
+ return this.moveColumn(srcIndex, destIndex);
26668
+ };
26669
+ /** @public
26670
+ * @param {number|string|Array.<number|string>} colRefs List of column index or column id to be moved
26671
+ * @param {(number|string)=} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
26672
+ * @return {boolean} Return true if there is any change, and false otherwise
26673
+ */
26674
+ Core_Core.prototype.reorderColumns = function (colRefs, destCol) {
26675
+ var destId = "";
26676
+ if(typeof destCol === "number") {
26677
+ destId = this.getColumnId(destCol);
26678
+ } else if(destCol) {
26679
+ destId = destCol;
26680
+ }
26681
+
26682
+ if(Array.isArray(colRefs)) {
26683
+ var srcLen = colRefs.length;
26684
+ if(srcLen > 1) {
26685
+ var colIds = this.getColumnIds();
26686
+ var colCount = colIds.length;
26687
+ var srcIds = [];
26688
+ var invalidDest = false;
26689
+ var i, srcId, srcIdx;
26690
+ for(i = 0; i < srcLen; ++i) {
26691
+ var colRef = colRefs[i];
26692
+ if(typeof colRef === "number") {
26693
+ srcIdx = colRef;
26694
+ srcId = colIds[colRef] || "";
26695
+ } else {
26696
+ srcId = colRef;
26697
+ srcIdx = colIds.indexOf(srcId);
26698
+ }
26699
+ if(srcId && srcIdx >= 0) {
26700
+ srcIds.push(srcId);
26701
+ if(destId === srcId) {
26702
+ invalidDest = true; // Destination must not exist in source columns
26703
+ }
26704
+ }
26705
+ }
26706
+
26707
+ var destIdx;
26708
+ srcLen = srcIds.length;
26709
+ if(invalidDest) { // Find the next valid destination where it is not contained in the source columns
26710
+ destIdx = this.getColumnIndex(destId);
26711
+ if(destIdx >= 0) {
26712
+ while(++destIdx < colCount) {
26713
+ destId = colIds[destIdx];
26714
+ if(srcIds.indexOf(destId) < 0) {
26715
+ break;
26716
+ }
26717
+ }
26718
+ }
26719
+ if(destIdx < 0 || destIdx >= colCount) {
26720
+ destId = "";
26721
+ }
26722
+ }
26723
+
26724
+ var dirty = 0;
26725
+ for(i = srcLen; --i >= 0;) {
26726
+ srcId = srcIds[i]; // Only valid source columns are left at this point
26727
+ srcIdx = this.getColumnIndex(srcId);
26728
+ destIdx = this.getColumnIndex(destId);
26729
+ if(destIdx < 0) { // Insert to the back when id is not found
26730
+ destIdx = colCount;
26731
+ }
26732
+ dirty |= this._moveColumnByIndex(srcIdx, destIdx);
26733
+ destId = srcId;
26734
+ }
26735
+ return dirty ? true : false;
26736
+ } else {
26737
+ return this.moveColumnById(colRefs[0], destId);
26738
+ }
26739
+ }
26740
+
26741
+ if(colRefs != null) {
26742
+ // colRefs will be a number or string
26743
+ return this.moveColumnById(colRefs, destId);
26744
+ }
26745
+ return false;
26746
+ };
26747
+
26575
26748
  /** @public
26576
26749
  * @ignore
26577
26750
  * @return {!TrackLayout}
@@ -26623,9 +26796,14 @@ Core_Core.prototype._deserializeColumn = function (index, jsonObj) {
26623
26796
  var colId = jsonObj["id"];
26624
26797
  if(colId && typeof colId === "string") {
26625
26798
  colDef["id"] = colId; // WARNING: We do not guarantee uniqueness of user id
26799
+ colDef["userId"] = colId;
26800
+ }
26801
+ var field = jsonObj["field"];
26802
+ if(field && typeof field === "string") {
26803
+ colDef["field"] = field;
26626
26804
  }
26627
26805
 
26628
- var value = jsonObj["dataColumnName"];
26806
+ var value = jsonObj["dataColumnName"]; // Deprecated
26629
26807
  if (value != null) {
26630
26808
  colDef["dataColumnName"] = value;
26631
26809
  }
@@ -28068,24 +28246,6 @@ Core_Core.prototype.getRelativePosition = function (obj, context) {
28068
28246
  return ret_obj;
28069
28247
  };
28070
28248
 
28071
- /** Find column index by column id or data column name
28072
- * @public
28073
- * @param {string} str Column id or data column name
28074
- * @return {number} Return negative value if there is no match
28075
- */
28076
- Core_Core.prototype.getColumnIndex = function (str) {
28077
- if(str) {
28078
- var colCount = this.getColumnCount();
28079
- for(var c = 0; c < colCount; ++c) {
28080
- var colDef = this._getColumnDef(c);
28081
- if(str === colDef["id"] || str === colDef["dataColumnName"]) {
28082
- return c;
28083
- }
28084
- }
28085
- }
28086
- return -1;
28087
- };
28088
-
28089
28249
  /** @public
28090
28250
  * @return {!ElementWrapper}
28091
28251
  */
@@ -29684,6 +29844,99 @@ Core_Core.prototype.getColumnIds = function () {
29684
29844
  return ary;
29685
29845
  };
29686
29846
 
29847
+ /** @public
29848
+ * @param {number} colIndex
29849
+ * @param {string} field
29850
+ */
29851
+ Core_Core.prototype.setColumnField = function (colIndex, field) {
29852
+ this._getColumnDef(colIndex)["field"] = field || "";
29853
+ };
29854
+ /** @public
29855
+ * @param {number} colIndex
29856
+ * @return {string} Return empty string if the specified column does not exist
29857
+ */
29858
+ Core_Core.prototype.getColumnField = function (colIndex) {
29859
+ if(colIndex >= 0 && colIndex < this.getColumnCount()) {
29860
+ return this._getColumnDef(colIndex)["field"] || "";
29861
+ }
29862
+ return "";
29863
+ };
29864
+ /** @public
29865
+ * @return {!Array.<string>} Return all column ids from existing column
29866
+ */
29867
+ Core_Core.prototype.getColumnFields = function () {
29868
+ var colCount = this.getColumnCount();
29869
+ var ary = new Array(colCount);
29870
+ for(var c = 0; c < colCount; ++c) {
29871
+ ary[c] = this._getColumnDef(c)["field"] || "";
29872
+ }
29873
+ return ary;
29874
+ };
29875
+
29876
+ /** Get column index by column id or column field
29877
+ * @public
29878
+ * @param {string|number} colRef Column id or data column name
29879
+ * @return {number} Return negative value if there is no match
29880
+ */
29881
+ Core_Core.prototype.getColumnIndex = function (colRef) {
29882
+ if(typeof colRef === "number") {
29883
+ return colRef;
29884
+ } else if(colRef) {
29885
+ var str = colRef;
29886
+ var colCount = this.getColumnCount();
29887
+ for(var c = 0; c < colCount; ++c) {
29888
+ var colDef = this._getColumnDef(c);
29889
+ if(str === colDef["id"] || str === colDef["field"]) {
29890
+ return c;
29891
+ }
29892
+ }
29893
+ }
29894
+ return -1;
29895
+ };
29896
+ /** Any invalid column reference will be excluded from the output array
29897
+ * @public
29898
+ * @param {Array.<number|string>} colRefs
29899
+ * @return {!Array.<number>} Return negative value if there is no match
29900
+ */
29901
+ Core_Core.prototype.getColumnIndices = function (colRefs) {
29902
+ var ary = [];
29903
+ var colCount = this.getColumnCount();
29904
+ var inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
29905
+ var len = inputAry.length;
29906
+ // Verify user input
29907
+ for(var i = 0; i < len; ++i) {
29908
+ var colIndex = this.getColumnIndex(inputAry[i]);
29909
+ if(colIndex >= 0 && colIndex < colCount) {
29910
+ ary.push(colIndex); // WARNING: We have not check for duplication
29911
+ }
29912
+ }
29913
+ return ary;
29914
+ };
29915
+
29916
+ /** Get a map from column id and field to column index. This should be useful when finding multiple column indices.
29917
+ * @public
29918
+ * @return {!Object.<string, number>}
29919
+ */
29920
+ Core_Core.prototype.getColumnIndexMap = function () {
29921
+ var colCount = this.getColumnCount();
29922
+ var obj = {};
29923
+ var str = "";
29924
+ for(var c = 0; c < colCount; ++c) {
29925
+ var colDef = this._getColumnDef(c);
29926
+
29927
+ str = colDef["field"];
29928
+ if(str) {
29929
+ obj[str] = c;
29930
+ }
29931
+
29932
+ str = colDef["id"];
29933
+ if(str) {
29934
+ obj[str] = c;
29935
+ }
29936
+ }
29937
+ return obj;
29938
+ };
29939
+
29687
29940
 
29688
29941
  /** @private */
29689
29942
  Core_Core.prototype._onWindowResize = function() {