@refinitiv-ui/efx-grid 6.0.115 → 6.0.117
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +219 -47
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +14 -7
- package/lib/grid/index.js +1 -1
- package/lib/row-segmenting/es6/RowSegmenting.js +72 -29
- package/lib/rt-grid/dist/rt-grid.js +324 -141
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +5 -2
- package/lib/rt-grid/es6/DataConnector.d.ts +2 -0
- package/lib/rt-grid/es6/DataConnector.js +8 -0
- package/lib/rt-grid/es6/Grid.d.ts +4 -0
- package/lib/rt-grid/es6/Grid.js +39 -1
- package/lib/rt-grid/es6/ReferenceCounter.d.ts +2 -0
- package/lib/rt-grid/es6/ReferenceCounter.js +10 -0
- package/lib/rt-grid/es6/RowDefinition.js +28 -34
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.d.ts +1 -1
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.js +13 -8
- package/lib/tr-grid-contextmenu/es6/MenuItem.js +49 -9
- package/lib/tr-grid-contextmenu/es6/PopupMenu.js +24 -21
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +3 -0
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +115 -28
- package/lib/types/es6/InCellEditing.d.ts +3 -0
- package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +4 -0
- package/lib/types/es6/RealtimeGrid/ReferenceCounter.d.ts +2 -0
- package/lib/versions.json +3 -3
- package/package.json +1 -1
@@ -621,7 +621,7 @@ Core.prototype._hasPendingRowChange = false;
|
|
621
621
|
* @return {string}
|
622
622
|
*/
|
623
623
|
Core.getVersion = function () {
|
624
|
-
return "5.1.
|
624
|
+
return "5.1.117";
|
625
625
|
};
|
626
626
|
/** {@link ElementWrapper#dispose}
|
627
627
|
* @override
|
@@ -3692,21 +3692,21 @@ Core.prototype.getYScrollVal = function (sectionRef, rowIndex, topOfView) {
|
|
3692
3692
|
else if (rowIndex >= rowCount) { rowIndex = rowCount - 1; }
|
3693
3693
|
|
3694
3694
|
let viewInfo = this.getVerticalViewInfo();
|
3695
|
-
let
|
3695
|
+
let firstFullRow = viewInfo.firstFullRow; // TODO: Make it work in zooming mode
|
3696
3696
|
|
3697
3697
|
let scrollIndex = -1;
|
3698
3698
|
if (topOfView) {
|
3699
3699
|
scrollIndex = rowIndex;
|
3700
3700
|
} else {
|
3701
|
-
if(rowIndex <
|
3701
|
+
if(rowIndex < firstFullRow) { // Scroll up
|
3702
3702
|
scrollIndex = rowIndex - 3; // Have some spaces at the top for more appealing visual
|
3703
3703
|
if(scrollIndex < 0) {
|
3704
3704
|
scrollIndex = 0;
|
3705
3705
|
}
|
3706
3706
|
} else { // Scroll down
|
3707
|
-
let
|
3708
|
-
if (rowIndex >
|
3709
|
-
let viewIndexSize =
|
3707
|
+
let lastFullRow = viewInfo.lastFullRow;
|
3708
|
+
if (rowIndex > lastFullRow) {
|
3709
|
+
let viewIndexSize = lastFullRow - firstFullRow;
|
3710
3710
|
scrollIndex = rowIndex - viewIndexSize + 3;
|
3711
3711
|
if(scrollIndex < 0) {
|
3712
3712
|
scrollIndex = 0;
|
@@ -5428,13 +5428,20 @@ Core.prototype.getColumnIndex = function (colRef) {
|
|
5428
5428
|
return colRef;
|
5429
5429
|
} else if(colRef) {
|
5430
5430
|
let str = colRef;
|
5431
|
+
let indexByField = -1;
|
5431
5432
|
let colCount = this.getColumnCount();
|
5432
5433
|
for(let c = 0; c < colCount; ++c) {
|
5433
5434
|
let colDef = this._getColumnDef(c);
|
5434
|
-
if(str === colDef["id"]
|
5435
|
+
if(str === colDef["id"]){
|
5435
5436
|
return c;
|
5436
5437
|
}
|
5438
|
+
if(str === colDef["field"]) { // In case colId and field are the same, use colId first and field as a fallback
|
5439
|
+
if(indexByField < 0) {
|
5440
|
+
indexByField = c;
|
5441
|
+
}
|
5442
|
+
}
|
5437
5443
|
}
|
5444
|
+
return indexByField;
|
5438
5445
|
}
|
5439
5446
|
return -1;
|
5440
5447
|
};
|
package/lib/grid/index.js
CHANGED
@@ -106,7 +106,10 @@ RowSegmentingPlugin.prototype._predefinedColors = null;
|
|
106
106
|
* @private
|
107
107
|
*/
|
108
108
|
RowSegmentingPlugin._controlClass = "predefined-color-tag";
|
109
|
-
|
109
|
+
/** @type {Object}
|
110
|
+
* @private
|
111
|
+
*/
|
112
|
+
RowSegmentingPlugin.prototype._collapsingMap = null;
|
110
113
|
|
111
114
|
/** @public
|
112
115
|
* @return {string}
|
@@ -171,45 +174,58 @@ RowSegmentingPlugin.prototype.requestSeparatorRefresh = function () {
|
|
171
174
|
* @private
|
172
175
|
*/
|
173
176
|
RowSegmentingPlugin.prototype._refreshSegmentSeparator = function () {
|
174
|
-
var
|
177
|
+
var dv = this._getDataView();
|
178
|
+
if (!dv) { return; }
|
179
|
+
|
180
|
+
var collapsingMap = {};
|
181
|
+
if (this._collapsingMap) {
|
182
|
+
collapsingMap = this._collapsingMap;
|
183
|
+
this._collapsingMap = null;
|
184
|
+
}
|
185
|
+
|
186
|
+
var rowId, rowData, segmentId;
|
187
|
+
var dt = dv.getDataSource();
|
175
188
|
var segmentRowIds = this.getSegmentIds() || [];
|
176
189
|
var segmentCount = segmentRowIds.length;
|
177
|
-
if(segmentCount){
|
178
|
-
for(var
|
179
|
-
|
180
|
-
|
190
|
+
if (segmentCount){
|
191
|
+
for(var s = 0; s < segmentCount; s++) {
|
192
|
+
rowId = segmentRowIds[s];
|
193
|
+
rowData = this._rowGetter(dt.getRowData(rowId));
|
194
|
+
segmentId = rowData[this._segmentIdField];
|
195
|
+
if (segmentId) {
|
196
|
+
if (collapsingMap[segmentId] == null) {
|
197
|
+
collapsingMap[segmentId] = this.isSegmentCollapsed(rowId);
|
198
|
+
}
|
199
|
+
}
|
181
200
|
}
|
182
201
|
}
|
183
202
|
|
184
|
-
if(this._prevSegmentBySegmentId) { // Check only the segmentation set by the segment ID field and exclude the segment separator set by the runtime API using the setSegmentSeparator method
|
203
|
+
if (this._prevSegmentBySegmentId) { // Check only the segmentation set by the segment ID field and exclude the segment separator set by the runtime API using the setSegmentSeparator method
|
185
204
|
this._prevSegmentBySegmentId = false;
|
186
205
|
this.unsetAllSegmentSeparators();
|
206
|
+
// Note: if there are chains, their segmenting will be lost here and they cannot be restored
|
207
|
+
// because their children has no segment-id.
|
187
208
|
}
|
188
|
-
var dv = this._getDataView();
|
189
|
-
if(dv) {
|
190
|
-
var dt = dv.getDataSource();
|
191
|
-
var rowIds = dt.getAllRowIds();
|
192
|
-
var rowCount = rowIds.length;
|
193
|
-
var separatorMapping = {};
|
194
|
-
for (var i = 0; i < rowCount; i++) {
|
195
|
-
var rowId = rowIds[i];
|
196
|
-
var rowData = this._rowGetter(dt.getRowData(rowId));
|
197
|
-
var segmentId = rowData[this._segmentIdField];
|
198
|
-
// TODO: supports collapsed and expanded for save/restore
|
199
|
-
|
200
|
-
if(segmentId != null) {
|
201
|
-
if(separatorMapping[segmentId] != null ) {
|
202
|
-
this.addSegmentChild(separatorMapping[segmentId], rowId);
|
203
|
-
} else {
|
204
|
-
separatorMapping[segmentId] = rowId;
|
205
|
-
this.setSegmentSeparator(rowId);
|
206
|
-
}
|
207
|
-
this._prevSegmentBySegmentId = true;
|
208
209
|
|
209
|
-
|
210
|
-
|
210
|
+
var rowIds = dt.getAllRowIds();
|
211
|
+
var rowCount = rowIds.length;
|
212
|
+
var separatorMap = {};
|
213
|
+
for(var i = 0; i < rowCount; i++) {
|
214
|
+
rowId = rowIds[i];
|
215
|
+
rowData = this._rowGetter(dt.getRowData(rowId));
|
216
|
+
segmentId = rowData[this._segmentIdField];
|
217
|
+
|
218
|
+
if (segmentId != null) {
|
219
|
+
if (separatorMap[segmentId] != null ) {
|
220
|
+
this.addSegmentChild(separatorMap[segmentId], rowId);
|
221
|
+
} else {
|
222
|
+
separatorMap[segmentId] = rowId;
|
223
|
+
this.setSegmentSeparator(rowId);
|
224
|
+
if (collapsingMap[segmentId] != null) {
|
225
|
+
this.collapseSegment(rowId, collapsingMap[segmentId]);
|
211
226
|
}
|
212
227
|
}
|
228
|
+
this._prevSegmentBySegmentId = true;
|
213
229
|
}
|
214
230
|
}
|
215
231
|
};
|
@@ -275,6 +291,29 @@ RowSegmentingPlugin.prototype.config = function (options) {
|
|
275
291
|
this.addListener(option, "clicked");
|
276
292
|
this.addListener(option, "segmentSeparatorBinding");
|
277
293
|
this.addListener(option, "nonSegmentSeparatorBinding");
|
294
|
+
|
295
|
+
// Collect collapsing states from configuration
|
296
|
+
var collapsingMap = {};
|
297
|
+
var dirty = false;
|
298
|
+
var rows = options.rows;
|
299
|
+
if (rows && rows.length) {
|
300
|
+
var len = rows.length;
|
301
|
+
for (var i = 0; i < len; i++) {
|
302
|
+
var row = rows[i];
|
303
|
+
var segmentId = row.values ? row.values[this._segmentIdField] : null;
|
304
|
+
if (segmentId && collapsingMap[segmentId] == null) {
|
305
|
+
if(row["collapsed"] != null) {
|
306
|
+
dirty = true;
|
307
|
+
collapsingMap[segmentId] = row["collapsed"] ? true : false;
|
308
|
+
}
|
309
|
+
}
|
310
|
+
}
|
311
|
+
}
|
312
|
+
|
313
|
+
if (dirty) {
|
314
|
+
this._collapsingMap = collapsingMap;
|
315
|
+
}
|
316
|
+
|
278
317
|
this.requestSeparatorRefresh();
|
279
318
|
};
|
280
319
|
|
@@ -335,6 +374,10 @@ RowSegmentingPlugin.prototype.getRowConfigObject = function (rowData, rowId) {
|
|
335
374
|
}
|
336
375
|
|
337
376
|
if(this.isSegmentSeparator(rowId)) {
|
377
|
+
if(obj["collapsed"] == null) { // Avoid overriding value from real-time grid
|
378
|
+
obj["collapsed"] = this.isSegmentCollapsed(rowId);
|
379
|
+
}
|
380
|
+
|
338
381
|
if(!obj.values) {
|
339
382
|
obj.values = {};
|
340
383
|
}
|