@refinitiv-ui/efx-grid 6.0.6 → 6.0.7
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/core/dist/core.js +85 -41
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.js +11 -1
- package/lib/core/es6/data/Segment.d.ts +4 -0
- package/lib/core/es6/data/Segment.js +16 -0
- package/lib/core/es6/data/SegmentCollection.d.ts +2 -0
- package/lib/core/es6/data/SegmentCollection.js +38 -36
- package/lib/core/es6/grid/Core.js +1 -1
- package/lib/core/es6/grid/components/Cell.js +3 -0
- package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +2 -0
- package/lib/core/es6/grid/components/CellFloatingPanel.js +7 -0
- package/lib/core/es6/grid/components/StretchedCells.js +7 -3
- package/lib/core/es6/index.d.ts +1 -0
- package/lib/core/es6/index.js +2 -0
- package/lib/formatters/es6/index.d.ts +1 -1
- package/lib/formatters/es6/index.js +1 -1
- package/lib/grid/index.js +1 -1
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +37 -26
- package/lib/types/es6/CellSelection.d.ts +11 -11
- package/lib/types/es6/Core/data/Segment.d.ts +4 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
- package/lib/types/es6/Core/index.d.ts +1 -0
- package/lib/versions.json +2 -2
- package/package.json +1 -1
package/lib/core/dist/core.js
CHANGED
@@ -1711,6 +1711,13 @@ CellFloatingPanel.prototype._items = [];
|
|
1711
1711
|
CellFloatingPanel.prototype.hasItem = function () {
|
1712
1712
|
return !!this._items.length;
|
1713
1713
|
};
|
1714
|
+
/** @public
|
1715
|
+
* @param {Element} icon Element of item
|
1716
|
+
* @returns {boolean}
|
1717
|
+
*/
|
1718
|
+
CellFloatingPanel.prototype.containItem = function (icon) {
|
1719
|
+
return this._items.indexOf(icon) > -1;
|
1720
|
+
};
|
1714
1721
|
/** @public
|
1715
1722
|
* @param {Element} item
|
1716
1723
|
* @param {number=} opt_order The greater the order, the farther the position to the right
|
@@ -2195,6 +2202,9 @@ Cell.prototype.updateIcon = function(icon) {
|
|
2195
2202
|
|
2196
2203
|
var fi = this._frontIcon;
|
2197
2204
|
if (fi) {
|
2205
|
+
if(fi.containItem(icon)) { // Check same icon which duplicate with insertItem in _frontIcon
|
2206
|
+
return;
|
2207
|
+
}
|
2198
2208
|
fi.clearItems();
|
2199
2209
|
}
|
2200
2210
|
this.insertFrontIcon(icon, 0);
|
@@ -4939,7 +4949,11 @@ StretchedCells.prototype.setCellCount = function (count) {
|
|
4939
4949
|
* @return {Cell}
|
4940
4950
|
*/
|
4941
4951
|
StretchedCells.prototype.getCell = function (rowIndex) {
|
4942
|
-
|
4952
|
+
var cell = this._cells[rowIndex];
|
4953
|
+
if(cell && cell["getParent"]()) {
|
4954
|
+
return cell;
|
4955
|
+
}
|
4956
|
+
return null;
|
4943
4957
|
};
|
4944
4958
|
/** @public
|
4945
4959
|
* @ignore
|
@@ -4986,13 +5000,13 @@ StretchedCells.prototype.getColumnIndex = function (cellRef) {
|
|
4986
5000
|
StretchedCells.prototype.getRowIndex = function (cellRef) {
|
4987
5001
|
if(cellRef) {
|
4988
5002
|
if(cellRef["getElement"]) {
|
4989
|
-
return this._cells.indexOf(cellRef);
|
5003
|
+
return cellRef["getParent"]() ? this._cells.indexOf(cellRef) : -1;
|
4990
5004
|
} else {
|
4991
5005
|
var cells = this._cells;
|
4992
5006
|
var rowCount = cells.length;
|
4993
5007
|
for(var r = 0; r < rowCount; ++r) {
|
4994
5008
|
var cell = cells[r];
|
4995
|
-
if(cell && cell["getElement"]() === cellRef) {
|
5009
|
+
if(cell && cell["getParent"]() && cell["getElement"]() === cellRef) {
|
4996
5010
|
return r;
|
4997
5011
|
}
|
4998
5012
|
}
|
@@ -11889,6 +11903,10 @@ Segment.prototype._collapsed = false;
|
|
11889
11903
|
* @private
|
11890
11904
|
*/
|
11891
11905
|
Segment.prototype._value = 0;
|
11906
|
+
/** @type {number}
|
11907
|
+
* @private
|
11908
|
+
*/
|
11909
|
+
Segment.prototype._order = 0;
|
11892
11910
|
|
11893
11911
|
|
11894
11912
|
/** @public
|
@@ -12056,6 +12074,18 @@ Segment.prototype.getValue = function() {
|
|
12056
12074
|
Segment.prototype.setValue = function(val) {
|
12057
12075
|
this._value = val;
|
12058
12076
|
};
|
12077
|
+
/** @public
|
12078
|
+
* @return {number}
|
12079
|
+
*/
|
12080
|
+
Segment.prototype.getOrder = function() {
|
12081
|
+
return this._order;
|
12082
|
+
};
|
12083
|
+
/** @public
|
12084
|
+
* @param {number} val
|
12085
|
+
*/
|
12086
|
+
Segment.prototype.setOrder = function(val) {
|
12087
|
+
this._order = val;
|
12088
|
+
};
|
12059
12089
|
|
12060
12090
|
|
12061
12091
|
/* harmony default export */ const data_Segment = (Segment);
|
@@ -12102,6 +12132,7 @@ SegmentCollection.prototype.addSegment = function(rid) {
|
|
12102
12132
|
if(rid && !this._segments[rid]) {
|
12103
12133
|
if(this._childToSegmentId[rid]) {
|
12104
12134
|
console.log("child of a segment cannot be set as a segment separator");
|
12135
|
+
return false;
|
12105
12136
|
}
|
12106
12137
|
this._segments[rid] = new data_Segment(rid);
|
12107
12138
|
++this._segmentCount;
|
@@ -12432,8 +12463,27 @@ SegmentCollection.prototype.fillSegments = function(rids) {
|
|
12432
12463
|
return change;
|
12433
12464
|
};
|
12434
12465
|
/** @public
|
12466
|
+
* @param {Array.<string>} rids
|
12467
|
+
*/
|
12468
|
+
SegmentCollection.prototype.calcSegmentOrder = function(rids) {
|
12469
|
+
var ridCount = rids ? rids.length : 0;
|
12470
|
+
var segmentSeparators = this._segments;
|
12471
|
+
var segmentCount = this._segmentCount;
|
12472
|
+
var order = 0;
|
12473
|
+
for(var i = 0; i < ridCount; ++i) {
|
12474
|
+
var rid = rids[i];
|
12475
|
+
var segment = segmentSeparators[rid];
|
12476
|
+
if(segment) {
|
12477
|
+
segment.setOrder(++order);
|
12478
|
+
if(order >= segmentCount) {
|
12479
|
+
break;
|
12480
|
+
}
|
12481
|
+
}
|
12482
|
+
}
|
12483
|
+
};
|
12484
|
+
/** @public
|
12435
12485
|
* @param {!Array.<string>} rids Array of row ids
|
12436
|
-
* @return {Array.<number>} Returns Array of segment values, if there are at least
|
12486
|
+
* @return {Array.<number>} Returns Array of segment values, if there are at least one segment, otherwise returns null
|
12437
12487
|
*/
|
12438
12488
|
SegmentCollection.prototype.getSegmentValues = function(rids) {
|
12439
12489
|
var rowCount = rids ? rids.length : 0;
|
@@ -12443,51 +12493,33 @@ SegmentCollection.prototype.getSegmentValues = function(rids) {
|
|
12443
12493
|
var segmentSeparators = this._segments;
|
12444
12494
|
var childToSegmentId = this._childToSegmentId;
|
12445
12495
|
var curSegment = null;
|
12496
|
+
var prevSegment = null;
|
12446
12497
|
var segmentValues = new Array(rowCount);
|
12447
|
-
var curSegmentCount = 0;
|
12448
12498
|
var segmentVal = 0;
|
12449
|
-
var
|
12450
|
-
var
|
12451
|
-
while(r < rowCount) {
|
12499
|
+
var offset = 0;
|
12500
|
+
for(var r = 0; r < rowCount; ++r) {
|
12452
12501
|
var rid = rids[r];
|
12453
|
-
|
12454
|
-
|
12455
|
-
|
12456
|
-
segmentVal += 100;
|
12457
|
-
segmentValues[r] = segmentVal;
|
12458
|
-
curSegment.setValue(segmentVal);
|
12459
|
-
if(curSegmentCount >= this._segmentCount) {
|
12460
|
-
++r;
|
12461
|
-
break;
|
12462
|
-
}
|
12502
|
+
curSegment = segmentSeparators[rid];
|
12503
|
+
if(curSegment) {
|
12504
|
+
offset = 0;
|
12463
12505
|
} else {
|
12464
|
-
|
12465
|
-
|
12506
|
+
var parentId = childToSegmentId[rid];
|
12507
|
+
if(parentId) {
|
12508
|
+
curSegment = segmentSeparators[parentId];
|
12509
|
+
offset = 1;
|
12466
12510
|
} else {
|
12467
|
-
|
12468
|
-
}
|
12469
|
-
if(childToSegmentId[rid]) {
|
12470
|
-
childToIndex[rid] = r;
|
12471
|
-
}
|
12472
|
-
}
|
12473
|
-
++r;
|
12474
|
-
}
|
12475
|
-
if(curSegmentCount) {
|
12476
|
-
while(r < rowCount) {
|
12477
|
-
rid = rids[r];
|
12478
|
-
segmentValues[r] = segmentVal + 10;
|
12479
|
-
if(childToSegmentId[rid]) {
|
12480
|
-
childToIndex[rid] = r;
|
12511
|
+
offset = prevSegment ? 10 : 0;
|
12481
12512
|
}
|
12482
|
-
++r;
|
12483
12513
|
}
|
12484
|
-
|
12485
|
-
|
12486
|
-
|
12514
|
+
|
12515
|
+
if(curSegment && prevSegment !== curSegment) {
|
12516
|
+
prevSegment = curSegment;
|
12517
|
+
segmentVal = curSegment.getOrder() * 100;
|
12487
12518
|
}
|
12519
|
+
segmentValues[r] = segmentVal + offset;
|
12488
12520
|
}
|
12489
12521
|
|
12490
|
-
return
|
12522
|
+
return prevSegment ? segmentValues : null;
|
12491
12523
|
};
|
12492
12524
|
|
12493
12525
|
|
@@ -13059,6 +13091,7 @@ DataTable.prototype.removeRows = function(refs) {
|
|
13059
13091
|
this._prevData[rid] = this._rows[rid];
|
13060
13092
|
this._removedRows[rid] = 1;
|
13061
13093
|
delete this._rows[rid];
|
13094
|
+
// TODO: remove segments
|
13062
13095
|
dirty = true;
|
13063
13096
|
}
|
13064
13097
|
}
|
@@ -13155,6 +13188,7 @@ DataTable.prototype.moveRow = function(fromIndex, toIndex, suppressEvent) {
|
|
13155
13188
|
|
13156
13189
|
if(output) {
|
13157
13190
|
if(this._segments) {
|
13191
|
+
this._segments.calcSegmentOrder(this._rids);
|
13158
13192
|
this._sort(null); // Reorder segment members
|
13159
13193
|
}
|
13160
13194
|
this._dispatchPositionChange(suppressEvent);
|
@@ -13384,12 +13418,19 @@ DataTable.prototype.isFrozen = function() {
|
|
13384
13418
|
DataTable.prototype.setSegmentSeparator = function(rid, enabled) {
|
13385
13419
|
var change = false;
|
13386
13420
|
var memberCount = 0;
|
13387
|
-
if(typeof rid === "string") {
|
13421
|
+
if(rid && typeof rid === "string") {
|
13388
13422
|
if(enabled !== false) {
|
13389
13423
|
if(!this._segments) {
|
13390
13424
|
this._segments = new data_SegmentCollection();
|
13391
13425
|
}
|
13426
|
+
if(this._autoSegmentFilling) {
|
13427
|
+
var parentId = this._segments.getParentRowId(rid);
|
13428
|
+
if(parentId) {
|
13429
|
+
this._segments.removeSegmentChild(parentId, rid);
|
13430
|
+
}
|
13431
|
+
}
|
13392
13432
|
if(this._segments.addSegment(rid)) {
|
13433
|
+
this._segments.calcSegmentOrder(this._rids);
|
13393
13434
|
change = true;
|
13394
13435
|
}
|
13395
13436
|
} else if(this._segments) {
|
@@ -13691,6 +13732,7 @@ DataTable.prototype.sortSegments = function (compare) {
|
|
13691
13732
|
}
|
13692
13733
|
|
13693
13734
|
if(dirty) {
|
13735
|
+
this._segments.calcSegmentOrder(rids);
|
13694
13736
|
this._sort(null);
|
13695
13737
|
this._dispatchPositionChange();
|
13696
13738
|
}
|
@@ -23107,7 +23149,7 @@ Core_Core.prototype._rowHeightTimerId = 0;
|
|
23107
23149
|
* @return {string}
|
23108
23150
|
*/
|
23109
23151
|
Core_Core.getVersion = function () {
|
23110
|
-
return "5.1.
|
23152
|
+
return "5.1.20";
|
23111
23153
|
};
|
23112
23154
|
/** {@link ElementWrapper#dispose}
|
23113
23155
|
* @override
|
@@ -29751,6 +29793,7 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
|
|
29751
29793
|
|
29752
29794
|
|
29753
29795
|
|
29796
|
+
|
29754
29797
|
// tsd-disable
|
29755
29798
|
var tr = window["tr"];
|
29756
29799
|
if(!tr) {
|
@@ -29774,6 +29817,7 @@ tr.ColumnStats = data_ColumnStats;
|
|
29774
29817
|
tr.DataCache = data_DataCache;
|
29775
29818
|
tr.DataTable = data_DataTable;
|
29776
29819
|
tr.DataView = data_DataView;
|
29820
|
+
tr.SegmentCollection = data_SegmentCollection;
|
29777
29821
|
|
29778
29822
|
// Components
|
29779
29823
|
grid.CellFloatingPanel = components_CellFloatingPanel;
|