@refinitiv-ui/efx-grid 6.0.27 → 6.0.29
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +248 -29
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.d.ts +1 -1
- package/lib/core/es6/data/DataTable.js +3 -2
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +3 -2
- package/lib/core/es6/data/Segment.d.ts +1 -1
- package/lib/core/es6/data/Segment.js +12 -3
- package/lib/core/es6/data/SegmentCollection.d.ts +1 -1
- package/lib/core/es6/data/SegmentCollection.js +3 -2
- package/lib/core/es6/grid/Core.d.ts +17 -3
- package/lib/core/es6/grid/Core.js +226 -20
- package/lib/core/es6/grid/LayoutGrid.js +1 -0
- package/lib/grid/index.js +1 -1
- package/lib/row-segmenting/es6/RowSegmenting.js +21 -2
- package/lib/rt-grid/dist/rt-grid.js +418 -238
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +2 -2
- package/lib/rt-grid/es6/ColumnDefinition.js +71 -70
- package/lib/rt-grid/es6/Grid.d.ts +9 -2
- package/lib/rt-grid/es6/Grid.js +55 -132
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -3
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +9 -27
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +6 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +68 -9
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +30 -23
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +78 -3
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +24 -10
- package/lib/tr-grid-util/es6/CellPainter.d.ts +2 -1
- package/lib/tr-grid-util/es6/CellPainter.js +53 -15
- package/lib/tr-grid-util/es6/GridPlugin.d.ts +6 -0
- package/lib/tr-grid-util/es6/GridPlugin.js +67 -0
- package/lib/types/es6/ColumnGrouping.d.ts +3 -3
- package/lib/types/es6/ColumnStack.d.ts +6 -0
- package/lib/types/es6/Core/data/DataTable.d.ts +1 -1
- package/lib/types/es6/Core/data/DataView.d.ts +1 -1
- package/lib/types/es6/Core/data/Segment.d.ts +1 -1
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -1
- package/lib/types/es6/Core/grid/Core.d.ts +17 -3
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +2 -2
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +9 -2
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +3 -0
- package/lib/versions.json +6 -6
- package/package.json +6 -2
package/lib/core/dist/core.js
CHANGED
@@ -10198,6 +10198,7 @@ LayoutGrid.prototype.setRowOffset = function (index) {
|
|
10198
10198
|
LayoutGrid.prototype.updateLayout = function () {
|
10199
10199
|
this._calculateViewSize(true); // Column bounds will be updated by trigger from Core
|
10200
10200
|
|
10201
|
+
this._stretchedCells.updateCells();
|
10201
10202
|
this._updateRightSpaceStyle();
|
10202
10203
|
};
|
10203
10204
|
|
@@ -13389,14 +13390,23 @@ Segment.prototype.addChild = function(rid, dataId) {
|
|
13389
13390
|
};
|
13390
13391
|
/** @public
|
13391
13392
|
* @param {Array.<string>} rids
|
13393
|
+
* @param {Array.<string>=} dataIds Row ids for retrieving data
|
13392
13394
|
* @return {boolean}
|
13393
13395
|
*/
|
13394
|
-
Segment.prototype.addChildren = function(rids) {
|
13396
|
+
Segment.prototype.addChildren = function(rids, dataIds) {
|
13395
13397
|
var rowIds = Array.isArray(rids) ? rids : [rids];
|
13396
13398
|
var rowCount = rowIds.length;
|
13397
13399
|
var dirty = 0;
|
13398
|
-
|
13399
|
-
|
13400
|
+
var i;
|
13401
|
+
if(dataIds != null) {
|
13402
|
+
dataIds = Array.isArray(dataIds) ? dataIds : [dataIds];
|
13403
|
+
for(i = 0; i < rowCount; ++i) {
|
13404
|
+
dirty |= this.addChild(rowIds[i], dataIds[i]);
|
13405
|
+
}
|
13406
|
+
} else {
|
13407
|
+
for(i = 0; i < rowCount; ++i) {
|
13408
|
+
dirty |= this.addChild(rowIds[i]);
|
13409
|
+
}
|
13400
13410
|
}
|
13401
13411
|
return dirty ? true : false;
|
13402
13412
|
};
|
@@ -14222,12 +14232,13 @@ SegmentCollection.prototype.addSegmentChild = function(segmentId, rid, dataId) {
|
|
14222
14232
|
/** @public
|
14223
14233
|
* @param {string} segmentId
|
14224
14234
|
* @param {Array.<string>} rids
|
14235
|
+
* @param {Array.<string>=} dataIds Row ids for retrieving data
|
14225
14236
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
14226
14237
|
*/
|
14227
|
-
SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids) {
|
14238
|
+
SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
|
14228
14239
|
var segment = this._segments[segmentId];
|
14229
14240
|
if(segment && !segment.isSubSegment()) {
|
14230
|
-
return segment.addChildren(rids);
|
14241
|
+
return segment.addChildren(rids, dataIds);
|
14231
14242
|
}
|
14232
14243
|
return false;
|
14233
14244
|
};
|
@@ -15691,11 +15702,12 @@ DataTable.prototype.addSegmentChild = function(segmentId, rid, dataId) {
|
|
15691
15702
|
/** @public
|
15692
15703
|
* @param {string} segmentId Row id
|
15693
15704
|
* @param {Array.<string>} rids Row id
|
15705
|
+
* @param {Array.<string>=} dataIds Row ids for retrieving data
|
15694
15706
|
* @return {boolean} Return true if there is any change
|
15695
15707
|
*/
|
15696
|
-
DataTable.prototype.addSegmentChildren = function(segmentId, rids) {
|
15708
|
+
DataTable.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
|
15697
15709
|
if(this._segments) {
|
15698
|
-
var dirty = this._segments.addSegmentChildren(segmentId, rids);
|
15710
|
+
var dirty = this._segments.addSegmentChildren(segmentId, rids, dataIds);
|
15699
15711
|
if(dirty) {
|
15700
15712
|
if(this._sort(null)) {
|
15701
15713
|
this._dispatchPositionChange();
|
@@ -20864,13 +20876,14 @@ DataView.prototype.addSegmentChild = function(segmentRef, rowRef, dataId) {
|
|
20864
20876
|
/** @public
|
20865
20877
|
* @param {string|number} segmentRef Row id or row index
|
20866
20878
|
* @param {Array.<string|number>} rowRefs Array of row ids or row indices
|
20879
|
+
* @param {Array.<string>=} dataIds Row ids for retrieving data
|
20867
20880
|
* @return {boolean} Return true if there is any change
|
20868
20881
|
*/
|
20869
|
-
DataView.prototype.addSegmentChildren = function(segmentRef, rowRefs) {
|
20882
|
+
DataView.prototype.addSegmentChildren = function(segmentRef, rowRefs, dataIds) {
|
20870
20883
|
if(this._dt._getSegmentSeparators()) {
|
20871
20884
|
var segmentId = this._toRowId(segmentRef);
|
20872
20885
|
var rowIds = this._toRowIds(rowRefs);
|
20873
|
-
return this._dt.addSegmentChildren(segmentId, rowIds);
|
20886
|
+
return this._dt.addSegmentChildren(segmentId, rowIds, dataIds);
|
20874
20887
|
}
|
20875
20888
|
return false;
|
20876
20889
|
};
|
@@ -25407,7 +25420,7 @@ Core_Core.prototype._groupDefs = null;
|
|
25407
25420
|
* @return {string}
|
25408
25421
|
*/
|
25409
25422
|
Core_Core.getVersion = function () {
|
25410
|
-
return "5.1.
|
25423
|
+
return "5.1.39";
|
25411
25424
|
};
|
25412
25425
|
/** {@link ElementWrapper#dispose}
|
25413
25426
|
* @override
|
@@ -25523,6 +25536,12 @@ Core_Core.prototype.getConfigObject = function (gridOptions) {
|
|
25523
25536
|
}
|
25524
25537
|
|
25525
25538
|
var columnDef = this._getColumnDef(colIndex);
|
25539
|
+
if(columnDef["userId"]) {
|
25540
|
+
column["id"] = columnDef["userId"];
|
25541
|
+
}
|
25542
|
+
if(columnDef["field"]) {
|
25543
|
+
column["field"] = columnDef["field"];
|
25544
|
+
}
|
25526
25545
|
if (columnDef["styles"]) {
|
25527
25546
|
column["styles"] = columnDef["styles"];
|
25528
25547
|
}
|
@@ -26607,6 +26626,126 @@ Core_Core.prototype._moveColumn = function (fromCol, destCol) {
|
|
26607
26626
|
return true;
|
26608
26627
|
};
|
26609
26628
|
|
26629
|
+
/** 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>
|
26630
|
+
* 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.
|
26631
|
+
* @public
|
26632
|
+
* @param {number|string} srcCol Column Id or index
|
26633
|
+
* @param {(number|string)=} destCol Column Id or index of the destination
|
26634
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
26635
|
+
* @see {@link Core#moveColumn}
|
26636
|
+
* @example
|
26637
|
+
* grid.moveColumnById(3, 1); // Move column 3 to position before column 1
|
26638
|
+
* grid.moveColumnById(0, 2); // Move column 0 to position before column 2 (column index 1)
|
26639
|
+
* grid.moveColumnById(0, 1); // Nothing is moved
|
26640
|
+
* grid.moveColumnById("sourceColumnId", "anotherId");
|
26641
|
+
* grid.moveColumnById("sourceColumnId", ""); // move to the last position
|
26642
|
+
*/
|
26643
|
+
Core_Core.prototype.moveColumnById = function (srcCol, destCol) {
|
26644
|
+
var colCount = this.getColumnCount();
|
26645
|
+
var srcIndex = this.getColumnIndex(srcCol);
|
26646
|
+
if(srcIndex < 0 || srcIndex >= colCount) {
|
26647
|
+
return false;
|
26648
|
+
}
|
26649
|
+
var destIndex = destCol != null ? this.getColumnIndex(destCol) : -1;
|
26650
|
+
if(destIndex < 0) {
|
26651
|
+
destIndex = colCount;
|
26652
|
+
}
|
26653
|
+
return this._moveColumnByIndex(srcIndex, destIndex);
|
26654
|
+
};
|
26655
|
+
/** Move column without verification for better performance
|
26656
|
+
* @private
|
26657
|
+
* @param {number} srcIndex Column index
|
26658
|
+
* @param {number} destIndex Column index of the destination
|
26659
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
26660
|
+
*/
|
26661
|
+
Core_Core.prototype._moveColumnByIndex = function (srcIndex, destIndex) {
|
26662
|
+
if(srcIndex < destIndex) { // Ensure that the source column is put in front of the destination index
|
26663
|
+
--destIndex;
|
26664
|
+
}
|
26665
|
+
if(srcIndex === destIndex) {
|
26666
|
+
return false;
|
26667
|
+
}
|
26668
|
+
return this.moveColumn(srcIndex, destIndex);
|
26669
|
+
};
|
26670
|
+
/** @public
|
26671
|
+
* @param {number|string|Array.<number|string>} colRefs List of column index or column id to be moved
|
26672
|
+
* @param {(number|string)=} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
|
26673
|
+
* @return {boolean} Return true if there is any change, and false otherwise
|
26674
|
+
*/
|
26675
|
+
Core_Core.prototype.reorderColumns = function (colRefs, destCol) {
|
26676
|
+
var destId = "";
|
26677
|
+
if(typeof destCol === "number") {
|
26678
|
+
destId = this.getColumnId(destCol);
|
26679
|
+
} else if(destCol) {
|
26680
|
+
destId = destCol;
|
26681
|
+
}
|
26682
|
+
|
26683
|
+
if(Array.isArray(colRefs)) {
|
26684
|
+
var srcLen = colRefs.length;
|
26685
|
+
if(srcLen > 1) {
|
26686
|
+
var colIds = this.getColumnIds();
|
26687
|
+
var colCount = colIds.length;
|
26688
|
+
var srcIds = [];
|
26689
|
+
var invalidDest = false;
|
26690
|
+
var i, srcId, srcIdx;
|
26691
|
+
for(i = 0; i < srcLen; ++i) {
|
26692
|
+
var colRef = colRefs[i];
|
26693
|
+
if(typeof colRef === "number") {
|
26694
|
+
srcIdx = colRef;
|
26695
|
+
srcId = colIds[colRef] || "";
|
26696
|
+
} else {
|
26697
|
+
srcId = colRef;
|
26698
|
+
srcIdx = colIds.indexOf(srcId);
|
26699
|
+
}
|
26700
|
+
if(srcId && srcIdx >= 0) {
|
26701
|
+
srcIds.push(srcId);
|
26702
|
+
if(destId === srcId) {
|
26703
|
+
invalidDest = true; // Destination must not exist in source columns
|
26704
|
+
}
|
26705
|
+
}
|
26706
|
+
}
|
26707
|
+
|
26708
|
+
var destIdx;
|
26709
|
+
srcLen = srcIds.length;
|
26710
|
+
if(invalidDest) { // Find the next valid destination where it is not contained in the source columns
|
26711
|
+
destIdx = this.getColumnIndex(destId);
|
26712
|
+
if(destIdx >= 0) {
|
26713
|
+
while(++destIdx < colCount) {
|
26714
|
+
destId = colIds[destIdx];
|
26715
|
+
if(srcIds.indexOf(destId) < 0) {
|
26716
|
+
break;
|
26717
|
+
}
|
26718
|
+
}
|
26719
|
+
}
|
26720
|
+
if(destIdx < 0 || destIdx >= colCount) {
|
26721
|
+
destId = "";
|
26722
|
+
}
|
26723
|
+
}
|
26724
|
+
|
26725
|
+
var dirty = 0;
|
26726
|
+
for(i = srcLen; --i >= 0;) {
|
26727
|
+
srcId = srcIds[i]; // Only valid source columns are left at this point
|
26728
|
+
srcIdx = this.getColumnIndex(srcId);
|
26729
|
+
destIdx = this.getColumnIndex(destId);
|
26730
|
+
if(destIdx < 0) { // Insert to the back when id is not found
|
26731
|
+
destIdx = colCount;
|
26732
|
+
}
|
26733
|
+
dirty |= this._moveColumnByIndex(srcIdx, destIdx);
|
26734
|
+
destId = srcId;
|
26735
|
+
}
|
26736
|
+
return dirty ? true : false;
|
26737
|
+
} else {
|
26738
|
+
return this.moveColumnById(colRefs[0], destId);
|
26739
|
+
}
|
26740
|
+
}
|
26741
|
+
|
26742
|
+
if(colRefs != null) {
|
26743
|
+
// colRefs will be a number or string
|
26744
|
+
return this.moveColumnById(colRefs, destId);
|
26745
|
+
}
|
26746
|
+
return false;
|
26747
|
+
};
|
26748
|
+
|
26610
26749
|
/** @public
|
26611
26750
|
* @ignore
|
26612
26751
|
* @return {!TrackLayout}
|
@@ -26658,9 +26797,14 @@ Core_Core.prototype._deserializeColumn = function (index, jsonObj) {
|
|
26658
26797
|
var colId = jsonObj["id"];
|
26659
26798
|
if(colId && typeof colId === "string") {
|
26660
26799
|
colDef["id"] = colId; // WARNING: We do not guarantee uniqueness of user id
|
26800
|
+
colDef["userId"] = colId;
|
26801
|
+
}
|
26802
|
+
var field = jsonObj["field"];
|
26803
|
+
if(field && typeof field === "string") {
|
26804
|
+
colDef["field"] = field;
|
26661
26805
|
}
|
26662
26806
|
|
26663
|
-
var value = jsonObj["dataColumnName"];
|
26807
|
+
var value = jsonObj["dataColumnName"]; // Deprecated
|
26664
26808
|
if (value != null) {
|
26665
26809
|
colDef["dataColumnName"] = value;
|
26666
26810
|
}
|
@@ -28103,24 +28247,6 @@ Core_Core.prototype.getRelativePosition = function (obj, context) {
|
|
28103
28247
|
return ret_obj;
|
28104
28248
|
};
|
28105
28249
|
|
28106
|
-
/** Find column index by column id or data column name
|
28107
|
-
* @public
|
28108
|
-
* @param {string} str Column id or data column name
|
28109
|
-
* @return {number} Return negative value if there is no match
|
28110
|
-
*/
|
28111
|
-
Core_Core.prototype.getColumnIndex = function (str) {
|
28112
|
-
if(str) {
|
28113
|
-
var colCount = this.getColumnCount();
|
28114
|
-
for(var c = 0; c < colCount; ++c) {
|
28115
|
-
var colDef = this._getColumnDef(c);
|
28116
|
-
if(str === colDef["id"] || str === colDef["dataColumnName"]) {
|
28117
|
-
return c;
|
28118
|
-
}
|
28119
|
-
}
|
28120
|
-
}
|
28121
|
-
return -1;
|
28122
|
-
};
|
28123
|
-
|
28124
28250
|
/** @public
|
28125
28251
|
* @return {!ElementWrapper}
|
28126
28252
|
*/
|
@@ -29719,6 +29845,99 @@ Core_Core.prototype.getColumnIds = function () {
|
|
29719
29845
|
return ary;
|
29720
29846
|
};
|
29721
29847
|
|
29848
|
+
/** @public
|
29849
|
+
* @param {number} colIndex
|
29850
|
+
* @param {string} field
|
29851
|
+
*/
|
29852
|
+
Core_Core.prototype.setColumnField = function (colIndex, field) {
|
29853
|
+
this._getColumnDef(colIndex)["field"] = field || "";
|
29854
|
+
};
|
29855
|
+
/** @public
|
29856
|
+
* @param {number} colIndex
|
29857
|
+
* @return {string} Return empty string if the specified column does not exist
|
29858
|
+
*/
|
29859
|
+
Core_Core.prototype.getColumnField = function (colIndex) {
|
29860
|
+
if(colIndex >= 0 && colIndex < this.getColumnCount()) {
|
29861
|
+
return this._getColumnDef(colIndex)["field"] || "";
|
29862
|
+
}
|
29863
|
+
return "";
|
29864
|
+
};
|
29865
|
+
/** @public
|
29866
|
+
* @return {!Array.<string>} Return all column fields from existing columns
|
29867
|
+
*/
|
29868
|
+
Core_Core.prototype.getColumnFields = function () {
|
29869
|
+
var colCount = this.getColumnCount();
|
29870
|
+
var ary = new Array(colCount);
|
29871
|
+
for(var c = 0; c < colCount; ++c) {
|
29872
|
+
ary[c] = this._getColumnDef(c)["field"] || "";
|
29873
|
+
}
|
29874
|
+
return ary;
|
29875
|
+
};
|
29876
|
+
|
29877
|
+
/** Get column index by column id or column field
|
29878
|
+
* @public
|
29879
|
+
* @param {string|number} colRef Column id or data column name
|
29880
|
+
* @return {number} Return negative value if there is no match
|
29881
|
+
*/
|
29882
|
+
Core_Core.prototype.getColumnIndex = function (colRef) {
|
29883
|
+
if(typeof colRef === "number") {
|
29884
|
+
return colRef;
|
29885
|
+
} else if(colRef) {
|
29886
|
+
var str = colRef;
|
29887
|
+
var colCount = this.getColumnCount();
|
29888
|
+
for(var c = 0; c < colCount; ++c) {
|
29889
|
+
var colDef = this._getColumnDef(c);
|
29890
|
+
if(str === colDef["id"] || str === colDef["field"]) {
|
29891
|
+
return c;
|
29892
|
+
}
|
29893
|
+
}
|
29894
|
+
}
|
29895
|
+
return -1;
|
29896
|
+
};
|
29897
|
+
/** Any invalid column reference will be excluded from the output array
|
29898
|
+
* @public
|
29899
|
+
* @param {Array.<number|string>} colRefs
|
29900
|
+
* @return {!Array.<number>} Return negative value if there is no match
|
29901
|
+
*/
|
29902
|
+
Core_Core.prototype.getColumnIndices = function (colRefs) {
|
29903
|
+
var ary = [];
|
29904
|
+
var colCount = this.getColumnCount();
|
29905
|
+
var inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
|
29906
|
+
var len = inputAry.length;
|
29907
|
+
// Verify user input
|
29908
|
+
for(var i = 0; i < len; ++i) {
|
29909
|
+
var colIndex = this.getColumnIndex(inputAry[i]);
|
29910
|
+
if(colIndex >= 0 && colIndex < colCount) {
|
29911
|
+
ary.push(colIndex); // WARNING: We have not check for duplication
|
29912
|
+
}
|
29913
|
+
}
|
29914
|
+
return ary;
|
29915
|
+
};
|
29916
|
+
|
29917
|
+
/** Get a map from column id and field to column index. This should be useful when finding multiple column indices.
|
29918
|
+
* @public
|
29919
|
+
* @return {!Object.<string, number>}
|
29920
|
+
*/
|
29921
|
+
Core_Core.prototype.getColumnIndexMap = function () {
|
29922
|
+
var colCount = this.getColumnCount();
|
29923
|
+
var obj = {};
|
29924
|
+
var str = "";
|
29925
|
+
for(var c = 0; c < colCount; ++c) {
|
29926
|
+
var colDef = this._getColumnDef(c);
|
29927
|
+
|
29928
|
+
str = colDef["field"];
|
29929
|
+
if(str) {
|
29930
|
+
obj[str] = c;
|
29931
|
+
}
|
29932
|
+
|
29933
|
+
str = colDef["id"];
|
29934
|
+
if(str) {
|
29935
|
+
obj[str] = c;
|
29936
|
+
}
|
29937
|
+
}
|
29938
|
+
return obj;
|
29939
|
+
};
|
29940
|
+
|
29722
29941
|
|
29723
29942
|
/** @private */
|
29724
29943
|
Core_Core.prototype._onWindowResize = function() {
|