@refinitiv-ui/efx-grid 6.0.119 → 6.0.121

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/README.md +1 -1
  2. package/lib/column-dragging/es6/ColumnDragging.js +7 -4
  3. package/lib/core/dist/core.js +104 -10
  4. package/lib/core/dist/core.min.js +1 -1
  5. package/lib/core/es6/data/DataView.js +7 -5
  6. package/lib/core/es6/grid/Core.js +3 -3
  7. package/lib/core/es6/grid/components/Cell.d.ts +2 -0
  8. package/lib/core/es6/grid/components/Cell.js +89 -0
  9. package/lib/core/es6/grid/components/HScrollbar.d.ts +1 -1
  10. package/lib/core/es6/grid/components/HScrollbar.js +5 -2
  11. package/lib/filter-dialog/themes/base-checkbox.less +1 -1
  12. package/lib/filter-dialog/themes/base.less +8 -3
  13. package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
  14. package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
  15. package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
  16. package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
  17. package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +2 -2
  18. package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
  19. package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
  20. package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +2 -2
  21. package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
  22. package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
  23. package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +2 -2
  24. package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
  25. package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
  26. package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +2 -2
  27. package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
  28. package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
  29. package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +2 -2
  30. package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
  31. package/lib/grid/index.js +1 -1
  32. package/lib/rt-grid/dist/rt-grid.js +240 -104
  33. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  34. package/lib/rt-grid/es6/ColumnDefinition.js +7 -0
  35. package/lib/rt-grid/es6/Grid.js +108 -81
  36. package/lib/rt-grid/es6/RowDefinition.d.ts +1 -1
  37. package/lib/rt-grid/es6/RowDefinition.js +28 -17
  38. package/lib/tr-grid-auto-tooltip/es6/AutoTooltip.js +18 -15
  39. package/lib/tr-grid-checkbox/es6/Checkbox.js +4 -0
  40. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +6 -1
  41. package/lib/tr-grid-filter-input/es6/FilterInput.js +1 -0
  42. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +0 -2
  43. package/lib/tr-grid-row-dragging/es6/RowDragging.js +82 -77
  44. package/lib/tr-grid-row-selection/es6/RowSelection.js +155 -35
  45. package/lib/types/es6/Core/grid/components/Cell.d.ts +2 -0
  46. package/lib/types/es6/Core/grid/components/HScrollbar.d.ts +1 -1
  47. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +1 -1
  48. package/lib/types/es6/RowDragging.d.ts +0 -2
  49. package/lib/utils/index.d.ts +1 -1
  50. package/lib/utils/index.js +1 -1
  51. package/lib/versions.json +8 -8
  52. package/package.json +1 -1
@@ -15,7 +15,7 @@ import { cloneObject, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util
15
15
  * @property {Function=} dragBoxRenderer Allow user to customize dragBox
16
16
  * @property {Function=} dragStart=null Function handler for dragStart event
17
17
  * @property {Function=} drag=null Function handler for drag event
18
- * @property {Function=} dragEnd=null Function handler for dragEnd event
18
+ * @property {Function=} dragEnd=null Function handler for dragEnd event. This event is for clearing any resource hold during the drag operation
19
19
  * @property {Function=} dataMoved=null Function handler for dataMoved event
20
20
  * @property {Function=} beforeDataMoved=null Function handler for beforeDataMoved event
21
21
  */
@@ -34,34 +34,39 @@ import { cloneObject, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util
34
34
  * }, // ..
35
35
  */
36
36
  /** @event RowDraggingPlugin#dragEnd
37
- * @description The event will always be fired at the end of the drag operation. This is to allow clearing of any resource used. You can cancel the data moving operation by setting cancel property to true.
37
+ * @description The event will always be fired at the end of the drag operation. This is to allow clearing of any resource used during the drag operation
38
38
  * @type {Object}
39
+ * @property {number} rowIndex The current or final position of the first dragged row after the move. Negative row index is returned when there is no moved row
40
+
39
41
  */
40
42
  /** @event RowDraggingPlugin#dragInterval
41
43
  * @description Fired at an interval during drag
42
44
  * @type {Object}
43
45
  */
44
46
  /** @event RowDraggingPlugin#dataMoved
45
- * @description Fired when rows or data are moved by the drag operation.
47
+ * @description Fired when rows or data are moved by the drag operation. This happens before dragEnd event
46
48
  * @type {Object}
47
- * @property {Array.<number>} srcRowIndices row indices of the selected rows
48
- * @property {Array.<string>} srcRowIds row ids of the selected rows
49
- * @property {Array.<string>} srcRowTypes row types of the selected rows
49
+ * @property {number} rowIndex The current or final position of the first dragged row after the move. Use srcRowIds to determine the row positions in case of dragging multiple rows.
50
+ * @property {Array.<number>} srcRowIndices Row indices of the selected rows. The values represent the indices before the move and cannot be used for referencing
51
+ * @property {Array.<string>} srcRowIds Row ids of the selected rows
52
+ * @property {Array.<string>} srcRowTypes Row types of the selected rows
50
53
  * @property {string} consolidatedSrcRowType "MIXED" type is set if there are two or more row types in the srcRowTypes
51
- * @property {number} destRowIndex row index of the drop area
52
- * @property {string} destRowId row id of the drop area. This will be empty string for the end of grid
53
- * @property {number} destRowType row type of the drop area. This will be empty string for the end of grid
54
+ * @property {number} destRowIndex Row index of the drop area. The value represents row index before the move and cannot be used for referencing
55
+ * @property {string} destRowId Row id of the drop area. This will be empty string for the end of grid
56
+ * @property {number} destRowType Row type of the drop area. This will be empty string for the end of grid
54
57
  */
55
58
  /** @event RowDraggingPlugin#beforeDataMoved
56
- * @description Fired after mouseup and before the data/row is about to be moved. You can check the current drag and drop states, cancel operation or apply custom tasks in this event.
59
+ * @description Fired after mouseup and before the data/row is about to be moved. You can check the current drag and drop states, cancel operation, or apply custom tasks in this event.
57
60
  * @type {Object}
58
- * @property {Array.<number>} srcRowIndices row indices of the selected rows
59
- * @property {Array.<string>} srcRowIds row ids of the selected rows
60
- * @property {Array.<string>} srcRowTypes row types of the selected rows
61
+ * @property {number} rowIndex Row index of the first row to be dragged
62
+ * @property {Array.<number>} srcRowIndices Row indices of the selected rows
63
+ * @property {Array.<string>} srcRowIds Row ids of the selected rows
64
+ * @property {Array.<string>} srcRowTypes Row types of the selected rows
61
65
  * @property {string} consolidatedSrcRowType "MIXED" type is set if there are two or more row types in the srcRowTypes
62
- * @property {number} destRowIndex row index of the drop area
63
- * @property {string} destRowId row id of the drop area. This will be empty string for the end of grid
64
- * @property {number} destRowType row type of the drop area. This will be empty string for the end of grid
66
+ * @property {number} destRowIndex Row index of the drop area
67
+ * @property {string} destRowId Row id of the drop area. This will be empty string for the end of grid
68
+ * @property {number} destRowType Row type of the drop area. This will be empty string for the end of grid
69
+ * @property {boolean=} cancel Set this property to true to cancel the default operation (data moving)
65
70
  * @example
66
71
  * beforeDataMoved: function(e) {
67
72
  * let srcRowType = e.srcRowTypes[0];
@@ -365,6 +370,12 @@ RowDraggingPlugin.prototype.unload = function (host) {
365
370
 
366
371
  this._hosts.splice(at, 1);
367
372
  if (!this._hosts.length) {
373
+ window.removeEventListener("mousemove", this._onMouseMove, false);
374
+ window.removeEventListener("touchmove", this._onMouseMove, false);
375
+ window.removeEventListener("mouseup", this._onDragEnd, false);
376
+ window.removeEventListener("touchend", this._onDragEnd, false);
377
+ window.removeEventListener("touchcancel", this._onDragEnd, false);
378
+
368
379
  this._clearCache();
369
380
  }
370
381
  this._dispose();
@@ -509,14 +520,18 @@ RowDraggingPlugin.prototype.dragStart = function (rowIndex, mouseEvt) {
509
520
  * @param {*=} mouseEvt
510
521
  */
511
522
  RowDraggingPlugin.prototype.dragMove = function (rowIndex, mouseEvt) {
523
+ let core = this._hosts[0];
524
+ if(!core) {
525
+ return; // Extension has been disposed
526
+ }
527
+
512
528
  // mousemove, touchmove event
513
529
  if(!mouseEvt) {
514
530
  mouseEvt = {};
515
531
  }
516
532
  mouseEvt["type"] = "mousemove";
517
533
  mouseEvt["which"] = 1; // Simulation of mouse down and move
518
- let core = this._hosts[0];
519
- let cell = core ? core.getCell("content", 0, rowIndex) : null;
534
+ let cell = core.getCell("content", 0, rowIndex);
520
535
  let cellRelativePosition = core.getRelativePosition(cell); // get relative position of cell only when dragging for calculate dragBox
521
536
 
522
537
  mouseEvt.clientX = cellRelativePosition.x;
@@ -525,7 +540,6 @@ RowDraggingPlugin.prototype.dragMove = function (rowIndex, mouseEvt) {
525
540
  mouseEvt.stopPropagation = function() {};
526
541
  mouseEvt.preventDefault = function() {};
527
542
  this._onMouseMove(mouseEvt);
528
-
529
543
  };
530
544
 
531
545
  /** Mouse up to end of drag for testing purpose
@@ -858,7 +872,15 @@ RowDraggingPlugin.prototype._onMouseMove = function (e) {
858
872
  Dom.preventDefault(e);
859
873
  }
860
874
 
875
+ var prevPos = this._pos;
861
876
  this._pos = this._hitTest(e); // A new object is created
877
+
878
+ if(this._pos["grid"] && prevPos) { // mouse is in grid area
879
+ if(this._pos["sectionType"] !== "content") { // mouse is in title or footer section, or grid has no row
880
+ this._pos = prevPos;
881
+ }
882
+ }
883
+
862
884
  this._pos["dragBox"] = this._dragBox; // assign dragBox for user determine valid target
863
885
 
864
886
  // need to check grid properties because row can be move outside the grid
@@ -919,15 +941,16 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
919
941
  srcGridElem.classList.remove("mouse-dragging");
920
942
  srcGridElem.classList.remove("row-dragging");
921
943
 
922
- let destPos = this._pos; // This can be null
944
+ let evtArg = {
945
+ rowIndex: -1
946
+ };
923
947
  if(!this._isDragCancelled()) {
924
- destPos["srcGrid"] = srcGrid; // destPos is always valid at this point
925
- // WARNING: dropTarget is not correct for element in a shadow root
926
- destPos["dropTarget"] = e ? e.target : null;
948
+ evtArg["srcGrid"] = srcGrid;
949
+ evtArg["dropTarget"] = e ? e.target : null; // WARNING: dropTarget is not correct for element in a shadow root
927
950
 
928
951
  if (!this._jetDnD && this._dataTransfer && _isInContentSection(this._pos)) {
929
- let destGrid = destPos["grid"] || srcGrid;
930
- let destRowIndex = destPos["rowIndex"];
952
+ let destGrid = this._pos["grid"] || srcGrid; // this._pos is always valid at this point
953
+ let destRowIndex = this._pos["rowIndex"];
931
954
 
932
955
  let rowSelection = srcGrid.getPlugin("RowSelectionPlugin");
933
956
  let srcRowIndices = rowSelection && rowSelection.getSelectedRows();
@@ -936,26 +959,17 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
936
959
  srcRowIndices = this._startingRid; // Str Type
937
960
  }
938
961
 
939
- this._moveRows(srcRowIndices, destRowIndex, srcGrid, destGrid, destPos);
940
- }
941
-
942
- // Extend event property
943
- let cellElement = destPos["cellElement"];
944
- let isRight = 0;
945
-
946
- if (e && cellElement) {
947
- let rect = cellElement.getBoundingClientRect();
948
- let offsetX = (e["clientX"] - rect["left"]) / destPos["zoomFactor"];
949
- isRight = Math.round(offsetX / cellElement.offsetWidth);
962
+ // evtArg["destGrid"] is filled in _moveRows
963
+ this._moveRows(srcRowIndices, destRowIndex, srcGrid, destGrid, evtArg);
950
964
  }
951
965
 
952
- destPos["colIndex"] += isRight;
953
- destPos["currentPosition"] = destPos; // To support JET requirement
954
- destPos["data"] = this._jetDragContent;
955
- destPos["dropTarget"] = e.target;
966
+ evtArg["currentPosition"] = this._pos; // To support JET requirement
967
+ evtArg["data"] = this._jetDragContent;
968
+ } else {
969
+ evtArg["cancel"] = true;
956
970
  }
957
971
 
958
- this._dispatch("dragEnd", destPos || {}); // Always fire drag end for client to clean up its resource
972
+ this._dispatch("dragEnd", evtArg); // Always fire drag end for client to clean up its resource
959
973
  this._clearCache();
960
974
  this._jetDragContent = null;
961
975
  };
@@ -964,7 +978,7 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
964
978
  * @param {number} destRowIndex
965
979
  * @param {Object} srcGrid core grid instance
966
980
  * @param {Object} destGrid core grid instance
967
- * @param {Object} evtArg
981
+ * @param {!Object} evtArg
968
982
  * @return {number}
969
983
  */
970
984
  RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGrid, destGrid, evtArg) {
@@ -977,7 +991,9 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
977
991
  srcRowIndices = [srcRowIndex];
978
992
  }
979
993
  } else if(Array.isArray(srcRowRef)) {
980
- srcRowIndices = srcRowRef;
994
+ if(srcRowRef.length) {
995
+ srcRowIndices = srcRowRef;
996
+ }
981
997
  }
982
998
 
983
999
  if(!srcRowIndices) {
@@ -1014,18 +1030,17 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
1014
1030
  let destRowId = destDv.getRowId(destRowIndex);
1015
1031
  let parentRowId, childRowIds;
1016
1032
 
1017
- if(this.hasListener("beforeDataMoved")) {
1018
- evtArg["srcRowIndices"] = srcRowIndices;
1019
- evtArg["srcRowIds"] = srcRowIds;
1020
- evtArg["srcRowTypes"] = srcRowTypes;
1021
- evtArg["consolidatedSrcRowType"] = conRowType;
1022
- evtArg["destRowIndex"] = destRowIndex;
1023
- evtArg["destRowId"] = destRowId;
1024
- evtArg["destRowType"] = destRowType;
1025
- this._dispatch("beforeDataMoved", evtArg);
1026
- if(evtArg["cancel"]) {
1027
- return 0;
1028
- }
1033
+ evtArg["rowIndex"] = srcRowIndices[0];
1034
+ evtArg["srcRowIndices"] = srcRowIndices;
1035
+ evtArg["srcRowIds"] = srcRowIds;
1036
+ evtArg["srcRowTypes"] = srcRowTypes;
1037
+ evtArg["consolidatedSrcRowType"] = conRowType;
1038
+ evtArg["destRowIndex"] = destRowIndex;
1039
+ evtArg["destRowId"] = destRowId;
1040
+ evtArg["destRowType"] = destRowType;
1041
+ this._dispatch("beforeDataMoved", evtArg);
1042
+ if(evtArg["cancel"]) {
1043
+ return 0;
1029
1044
  }
1030
1045
 
1031
1046
  let rsp = srcGrid.getPlugin("RowSegmentingPlugin");
@@ -1111,10 +1126,21 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
1111
1126
  }
1112
1127
  }
1113
1128
 
1114
- let moveCount = movedRowIds ? movedRowIds.length : 0;
1129
+ let moveCount = 0;
1130
+ if(movedRowIds) {
1131
+ if(Array.isArray(movedRowIds)) {
1132
+ moveCount = movedRowIds.length;
1133
+ } else { // Single row is moved
1134
+ movedRowIds = [movedRowIds];
1135
+ moveCount = 1;
1136
+ }
1137
+ }
1138
+
1115
1139
  if(moveCount) {
1116
1140
  destGrid.focus();
1117
1141
 
1142
+ evtArg["rowIndex"] = destDv.getRowIndex(srcRowIds[0]);
1143
+ // For backward compatibility and should not be used anymore
1118
1144
  evtArg["originRowId"] = movedRowIds[0];
1119
1145
  evtArg["originRowIds"] = movedRowIds;
1120
1146
  evtArg["destinationRowId"] = destRowId; // Return empty string for the last row
@@ -1285,27 +1311,6 @@ RowDraggingPlugin.prototype._onDragPulse = function () {
1285
1311
  }
1286
1312
  };
1287
1313
 
1288
- /** @public
1289
- * @param {Object} content
1290
- */
1291
- RowDraggingPlugin.prototype.setJETDragContent = function (content) {
1292
- this._jetDragContent = content;
1293
-
1294
- let t = window["tr"];
1295
- let g = (t) ? t["grid"] : null;
1296
- let jdc = (g) ? g["JetDragContent"] : null;
1297
- if (content && jdc) {
1298
- let jetDragContentMgr = new jdc(content);
1299
- let rics = jetDragContentMgr["getRicsToDrop"]();
1300
- let fields = jetDragContentMgr["getFieldsToDrop"]();
1301
-
1302
- this._jetContentHasRic = (rics && rics.length > 0) ? true : false;
1303
- this._jetContentHasField = (fields && fields.length > 0) ? true : false;
1304
- } else {
1305
- this._jetContentHasRic = false;
1306
- this._jetContentHasField = false;
1307
- }
1308
- };
1309
1314
  /** @private
1310
1315
  * @param {string} str
1311
1316
  */
@@ -51,6 +51,7 @@ let RowSelectionPlugin = function (options) {
51
51
 
52
52
  t._hosts = [];
53
53
  t._textRange = document.createRange();
54
+ t._headerSelection = {};
54
55
 
55
56
  if(options) {
56
57
  t.config({ "rowSelection": options });
@@ -125,6 +126,10 @@ RowSelectionPlugin.prototype._timerMenuId = 0;
125
126
  * @private
126
127
  */
127
128
  RowSelectionPlugin.prototype._pendingSelection = null;
129
+ /** @type {Object}
130
+ * @private
131
+ */
132
+ RowSelectionPlugin.prototype._headerSelection = null;
128
133
 
129
134
  /** @private
130
135
  * @return {string}
@@ -364,10 +369,8 @@ RowSelectionPlugin.prototype.getFirstSelectedIndex = function (sectRef) {
364
369
  let rids = dv.getVisibleRowIds(true);
365
370
  let rows = dv.getMultipleRowData(rids);
366
371
  let count = rows.length;
367
- let dataRow;
368
372
  for(let rowIndex = 0; rowIndex < count; rowIndex++) {
369
- dataRow = this._rowGetter(rows[rowIndex]);
370
- if(dataRow && dataRow[this._selectionField]) {
373
+ if(this._isContentRowSelected(dv, rows[rowIndex], rowIndex)) {
371
374
  return rowIndex;
372
375
  }
373
376
  }
@@ -392,10 +395,8 @@ RowSelectionPlugin.prototype.getLastSelectedIndex = function (sectRef) {
392
395
  let rids = dv.getVisibleRowIds(true);
393
396
  let rows = dv.getMultipleRowData(rids);
394
397
  let count = rows.length;
395
- let dataRow;
396
398
  for(let rowIndex = count - 1; rowIndex >= 0; rowIndex--) {
397
- dataRow = this._rowGetter(rows[rowIndex]);
398
- if(dataRow && dataRow[this._selectionField]) {
399
+ if(this._isContentRowSelected(dv, rows[rowIndex], rowIndex)) {
399
400
  return rowIndex;
400
401
  }
401
402
  }
@@ -422,10 +423,8 @@ RowSelectionPlugin.prototype.getSelectedRows = function (sectRef) {
422
423
  let rows = dv.getMultipleRowData(rids);
423
424
  let count = rows.length;
424
425
  let selectedRows = [];
425
- let dataRow;
426
426
  for(let rowIndex = 0; rowIndex < count; rowIndex++) {
427
- dataRow = this._rowGetter(rows[rowIndex]);
428
- if(dataRow && dataRow[this._selectionField]) {
427
+ if(this._isContentRowSelected(dv, rows[rowIndex], rowIndex)) {
429
428
  selectedRows.push(rowIndex);
430
429
  }
431
430
  }
@@ -434,6 +433,108 @@ RowSelectionPlugin.prototype.getSelectedRows = function (sectRef) {
434
433
  return section.getSelectedRows();
435
434
  }
436
435
  };
436
+ /**
437
+ * @private
438
+ * @param {Object} dv
439
+ * @param {Array<string>} rids
440
+ * @param {boolean=} select
441
+ */
442
+ RowSelectionPlugin.prototype._setHeaderSelections = function(dv, rids, select) {
443
+ if(select == null) {
444
+ select = true;
445
+ }
446
+ let len = rids.length;
447
+ for (let i = 0; i < len; i++) {
448
+ let rid = rids[i];
449
+ this._setHeaderSelection(dv, rid, select);
450
+ }
451
+ };
452
+
453
+ /**
454
+ * @private
455
+ * @param {Object} dv
456
+ * @param {sting|number} rowRef
457
+ * @param {boolean=} select
458
+ */
459
+ RowSelectionPlugin.prototype._setHeaderSelection = function(dv, rowRef, select) {
460
+ if(select == null) {
461
+ select = true;
462
+ }
463
+ let rowId = this._getRowId(dv, rowRef);
464
+ this._headerSelection[rowId] = select;
465
+ };
466
+
467
+ /**
468
+ * @private
469
+ * @param {Object} dv
470
+ * @param {sting|number} rowRef
471
+ * @return {boolean}
472
+ */
473
+ RowSelectionPlugin.prototype._isHeaderSelection = function(dv, rowRef) {
474
+ let rowId = this._getRowId(dv, rowRef);
475
+ return this._headerSelection[rowId];
476
+ };
477
+
478
+ /**
479
+ * @private
480
+ */
481
+ RowSelectionPlugin.prototype._clearHeaderSelection = function() {
482
+ this._headerSelection = {};
483
+ };
484
+
485
+ /**
486
+ * @private
487
+ * @param {Object} dv
488
+ * @param {Object} rowData
489
+ * @param {string|number} rowRef
490
+ * @return {boolean}
491
+ */
492
+ RowSelectionPlugin.prototype._isContentRowSelected = function(dv, rowData, rowRef) {
493
+ let dataRow = this._rowGetter(rowData);
494
+ if((dataRow && dataRow[this._selectionField]) || this._isHeaderSelection(dv, rowRef)) {
495
+ return true;
496
+ }
497
+ return false;
498
+ };
499
+
500
+ /**
501
+ * @private
502
+ * @param {number} rowIndex
503
+ * @param {boolean=} select
504
+ * @return {string|null} rowId of rowIndex
505
+ */
506
+ RowSelectionPlugin.prototype._addSelectionField = function(rowIndex, select) {
507
+ if(select == null) {
508
+ select = true;
509
+ }
510
+ let dv = (this._activeGrid) ? this._activeGrid.getDataSource() : null;
511
+ if(!dv) {
512
+ return null;
513
+ }
514
+ let dataRow = this._getRow(dv, rowIndex);
515
+ if(dataRow) {
516
+ this._setData(dv, rowIndex, this._selectionField, select);
517
+ } else {
518
+ this._setHeaderSelection(dv, rowIndex, select);
519
+ }
520
+ let rowId = dv.getRowId(rowIndex) || null;
521
+ return rowId;
522
+ };
523
+
524
+ /**
525
+ * @private
526
+ * @param {Object} dv
527
+ * @param {string|number} rowRef
528
+ * @return {string}
529
+ */
530
+ RowSelectionPlugin.prototype._getRowId = function(dv, rowRef) {
531
+ let rowId = rowRef;
532
+ if(typeof rowRef === "number") {
533
+ rowId = dv.getRowId(rowRef);
534
+ }
535
+ return rowId;
536
+ };
537
+
437
538
  /** Returns null if there is no selection
438
539
  * @public
439
540
  * @param {Object=} sectRef Grid SectionReference
@@ -479,6 +580,7 @@ RowSelectionPlugin.prototype.setSelectedRow = function (rowIndex, opt_select, se
479
580
  let section = this._getSection(sectRef);
480
581
  if(!section) { return; }
481
582
  this._sectionSetSelectedRow(section, rowIndex, opt_select);
583
+ this._updateContentRowSelectionUI(section, rowIndex, 1, opt_select); // Force update header without data changed
482
584
  };
483
585
  /**
484
586
  * @public
@@ -547,7 +649,7 @@ RowSelectionPlugin.prototype.selectRowRange = function (rowIndex, length, sectRe
547
649
  if(opt_scrollToRow) {
548
650
  this._scrollToRow(rowIndex);
549
651
  }
550
- this._updateMenuIcon();
652
+ this._updateContentRowSelectionUI(sectRef, rowIndex, length, true); // This method can't de-select
551
653
  };
552
654
 
553
655
  /** @public
@@ -664,15 +766,7 @@ RowSelectionPlugin.prototype._onMouseDown = function (e) {
664
766
  }
665
767
  }
666
768
  }
667
- let dv = ctx["dataSource"];
668
769
  let rowIndex = ctx["rowIndex"];
669
- if(this._basedOnContent) {
670
- // ignore group header row
671
- let dataRow = this._getRow(dv, rowIndex);
672
- if(!dataRow) {
673
- return;
674
- }
675
- }
676
770
 
677
771
  if(this._dispatchBeforeSelection(e, ctx)) {
678
772
  return;
@@ -810,19 +904,44 @@ RowSelectionPlugin.prototype._onPostSectionDataBinding = function (e) {
810
904
  let section = e.section;
811
905
  let dv = e.dataSource;
812
906
 
813
- let field = this._selectionField;
814
907
  section.clearSelectedRows();
815
908
 
816
909
  let fromR = section.getFirstIndexInView();
817
910
  let toR = section.getLastIndexInView();
818
911
  for(let r = fromR; r <= toR; ++r) {
819
- let dataRow = this._rowGetter(dv.getRowDataAt(r));
820
- if(dataRow) {
821
- if(dataRow[field]) {
822
- section.setSelectedRow(r, true);
823
- }
912
+ if(this._isContentRowSelected(dv, dv.getRowDataAt(r), r)) {
913
+ section.setSelectedRow(r, true);
914
+ }
915
+ }
916
+ this._updateMenuIcon();
917
+ };
918
+
919
+
920
+ /** @private
921
+ * @param {Object} section ILayoutGrid
922
+ * @param {number} startRowIndex
923
+ * @param {number} length
924
+ * @param {boolean} select
925
+ */
926
+ RowSelectionPlugin.prototype._updateContentRowSelectionUI = function (section, startRowIndex, length, select) {
927
+ if(!this._basedOnContent) {
928
+ return;
929
+ }
930
+ let dv = (this._activeGrid) ? this._activeGrid.getDataSource() : null;
931
+ if(!dv) {
932
+ return;
933
+ }
934
+ if(section == null) {
935
+ section = this._getSection();
936
+ }
937
+
938
+ let len = startRowIndex + length;
939
+ for (let r = startRowIndex; r <= len; r++) {
940
+ if(this._isContentRowSelected(dv, dv.getRowDataAt(r), r)) {
941
+ section.setSelectedRow(r, select);
824
942
  }
825
943
  }
944
+
826
945
  this._updateMenuIcon();
827
946
  };
828
947
 
@@ -912,6 +1031,7 @@ RowSelectionPlugin.prototype._clearSelectedRows = function (preserveAnchor) { //
912
1031
  if(dv) {
913
1032
  let dt = dv.getDataSource();
914
1033
  this._setColumnData(dt, this._selectionField, false);
1034
+ this._clearHeaderSelection();
915
1035
  }
916
1036
  } else {
917
1037
  let sections = this._activeGrid.getAllSections("content");
@@ -996,22 +1116,17 @@ RowSelectionPlugin.prototype._selectByKey = function (direction, e, pageKey) {
996
1116
  /** @private
997
1117
  * @param {Object} section ILayoutGrid
998
1118
  * @param {number} rowIndex
999
- * @param {boolean} isSelect
1119
+ * @param {boolean} select
1000
1120
  */
1001
- RowSelectionPlugin.prototype._sectionSetSelectedRow = function (section, rowIndex, isSelect) {
1121
+ RowSelectionPlugin.prototype._sectionSetSelectedRow = function (section, rowIndex, select) {
1002
1122
  // set selection state to rowData when _basedOnContent === true
1003
1123
  if(this._basedOnContent) {
1004
- let dv = (this._activeGrid) ? this._activeGrid.getDataSource() : null;
1005
-
1006
- if(dv) {
1007
- let dataRow = this._getRow(dv, rowIndex);
1008
- if(dataRow) {
1009
- this._setData(dv, rowIndex, this._selectionField, isSelect);
1010
- if(isSelect) this._anchorRowId = dv.getRowId(rowIndex);
1011
- }
1124
+ let rowId = this._addSelectionField(rowIndex, select);
1125
+ if(select && rowId != null) {
1126
+ this._anchorRowId = rowId;
1012
1127
  }
1013
1128
  } else {
1014
- section.setSelectedRow(rowIndex, isSelect);
1129
+ section.setSelectedRow(rowIndex, select);
1015
1130
  }
1016
1131
  this._pendingSelection = null; // New selection happens before resolving the pending selection
1017
1132
  };
@@ -1039,15 +1154,19 @@ RowSelectionPlugin.prototype._selectRangeOnSection = function (section, rowIndex
1039
1154
  }
1040
1155
  let ridList = [];
1041
1156
  let valueList = [];
1157
+ let ridHeaders = [];
1042
1158
  for(let r = rowIndex; r < toRowIndex; r++) {
1043
1159
  let dataRow = this._getRow(dv, r);
1044
1160
  if(dataRow) {
1045
1161
  ridList.push(rids[r]);
1046
1162
  valueList.push(true);
1163
+ } else {
1164
+ ridHeaders.push(r);
1047
1165
  }
1048
1166
  }
1049
1167
 
1050
1168
  this._setColumnData(dv, this._selectionField, valueList, ridList);
1169
+ this._setHeaderSelections(dv, ridHeaders);
1051
1170
  }
1052
1171
  } else {
1053
1172
  if(length == null) {
@@ -1073,6 +1192,7 @@ RowSelectionPlugin.prototype._sectionClearSelectedRows = function (section, pres
1073
1192
  valueList[i] = false;
1074
1193
  }
1075
1194
  this._setColumnData(dv, this._selectionField, valueList, selectedRowIds);
1195
+ this._setHeaderSelections(dv, selectedRowIds, false);
1076
1196
  }
1077
1197
  }
1078
1198
  if(!preserveAnchor) {
@@ -42,6 +42,8 @@ declare class Cell extends ElementWrapper {
42
42
 
43
43
  public updatePadding(): void;
44
44
 
45
+ public setTooltip(str: string|null|null): void;
46
+
45
47
  }
46
48
 
47
49
  declare function fc(str: string): void;
@@ -20,7 +20,7 @@ declare class HScrollbar extends Scrollbar {
20
20
 
21
21
  }
22
22
 
23
- declare function columns(): void;
23
+ declare function scrollHost(): void;
24
24
 
25
25
  declare function elem(): number;
26
26
 
@@ -108,7 +108,7 @@ declare class RowDefinition {
108
108
 
109
109
  public resetUpdates(): void;
110
110
 
111
- public registerToView(view: DataView|null, rowId?: string|null): void;
111
+ public registerToView(view: DataView|null, destRowId?: string|null): void;
112
112
 
113
113
  public static deregisterFromView(rowIds: (string)[]|null, rowDef: RowDefinition|null): (string)[]|null;
114
114
 
@@ -73,8 +73,6 @@ declare class RowDraggingPlugin extends GridPlugin {
73
73
 
74
74
  public setJETDragContent(content: any): void;
75
75
 
76
- public setJETDragContent(content: any): void;
77
-
78
76
  }
79
77
 
80
78
  export default RowDraggingPlugin;
@@ -4,4 +4,4 @@ import { MultiTableManager } from "../tr-grid-util/es6/MultiTableManager.js";
4
4
  import { FilterOperators, OperatorFunctions } from "../tr-grid-util/es6/FilterOperators.js";
5
5
  import { DataGenerator } from "../tr-grid-util/es6/jet/DataGenerator.js";
6
6
  import { MockRTK } from "../tr-grid-util/es6/jet/MockRTK.js";
7
- export { GridPrinter, Table, MultiTableManager, DataGenerator, MockRTK, FilterOperators, OperatorFunctions };
7
+ export { GridPrinter, Table, MultiTableManager, FilterOperators, OperatorFunctions, DataGenerator, MockRTK };
@@ -4,4 +4,4 @@ import { MultiTableManager } from "../tr-grid-util/es6/MultiTableManager.js";
4
4
  import { FilterOperators, OperatorFunctions } from "../tr-grid-util/es6/FilterOperators.js";
5
5
  import { DataGenerator } from "../tr-grid-util/es6/jet/DataGenerator.js";
6
6
  import { MockRTK } from "../tr-grid-util/es6/jet/MockRTK.js";
7
- export { GridPrinter, Table, MultiTableManager, DataGenerator, MockRTK, FilterOperators, OperatorFunctions };
7
+ export { GridPrinter, Table, MultiTableManager, FilterOperators, OperatorFunctions, DataGenerator, MockRTK };