@refinitiv-ui/efx-grid 6.0.67 → 6.0.69

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.
@@ -556,7 +556,7 @@ RowSelectionPlugin.prototype.selectAllRows = function (activeGrid) {
556
556
  if (this._activeGrid) {
557
557
  var sections = this._activeGrid.getAllSections("content");
558
558
  for (var i = sections.length; --i >= 0;) {
559
- this._selectRowRange(0, sections[i].getRowCount(), sections[i]);
559
+ this._selectRowRange(null, null, sections[i]);
560
560
  if (i == 0) {
561
561
  this._anchorSection = sections[i];
562
562
  }
@@ -626,6 +626,23 @@ RowSelectionPlugin.prototype._onClick = function (e) {
626
626
  }
627
627
  }
628
628
  };
629
+ /** @public
630
+ * @description Select a specified row as if it were clicked by a mouse. This is for testing purpose.
631
+ * @ignore
632
+ * @param {number} rowIndex
633
+ * @param {Object=} mouseEvt
634
+ */
635
+ RowSelectionPlugin.prototype.selectByMouse = function (rowIndex, mouseEvt) {
636
+ if(!mouseEvt) {
637
+ mouseEvt = {};
638
+ }
639
+ if(rowIndex >= 0) {
640
+ var grid = this._activeGrid || this._hosts[0];
641
+ var cell = grid ? grid.getCell("content", 0, rowIndex) : null;
642
+ mouseEvt.target = cell ? cell.getElement() : null;
643
+ }
644
+ this._onMouseDown(mouseEvt);
645
+ };
629
646
  /** @private
630
647
  * @description Left click will cause single row selection <br>
631
648
  * Shift + left click will cause range selection <br>
@@ -766,7 +783,29 @@ RowSelectionPlugin.prototype._clearPendingClickIndex = function (host) {
766
783
  host && host.unlisten("mousemove", this._onMouseMove);
767
784
  };
768
785
 
769
-
786
+ /** @public
787
+ * @description Select a specified row as if it were modified by a keyboard input. This is for testing purpose.
788
+ * @ignore
789
+ * @param {number} keyCode Use -1 for arrow up. Use 1 for arrow down
790
+ * @param {Object=} keyboardEvt
791
+ */
792
+ RowSelectionPlugin.prototype.selectByKey = function (keyCode, keyboardEvt) {
793
+ if(!keyboardEvt) {
794
+ keyboardEvt = {};
795
+ }
796
+ if(keyCode) {
797
+ if(keyCode === 1) {
798
+ keyboardEvt.keyCode = 40;
799
+ } else if(keyCode === -1) {
800
+ keyboardEvt.keyCode = 38;
801
+ } else if(typeof keyCode === "number"){
802
+ keyboardEvt.keyCode = keyCode;
803
+ }
804
+ }
805
+ keyboardEvt.preventDefault = function(){};
806
+ keyboardEvt.stopPropagation = function(){};
807
+ this._onKeyDown(keyboardEvt);
808
+ };
770
809
  /** @private
771
810
  * @param {KeyboardEvent} e
772
811
  */
@@ -1084,20 +1123,28 @@ RowSelectionPlugin.prototype._sectionSetSelectedRow = function (section, rowInde
1084
1123
 
1085
1124
  /** @private
1086
1125
  * @param {Object} section ILayoutGrid
1087
- * @param {number} rowIndex
1088
- * @param {number} length
1126
+ * @param {number|null} rowIndex
1127
+ * @param {number|null} length
1089
1128
  */
1090
- RowSelectionPlugin.prototype._sectionSelectRowRange = function (section, rowIndex, length) {
1091
- // set selection state to rowData when _basedOnContent === true
1092
- if (this._basedOnContent) {
1129
+ RowSelectionPlugin.prototype._selectRangeOnSection = function (section, rowIndex, length) {
1130
+ if(rowIndex == null) {
1131
+ rowIndex = 0;
1132
+ }
1133
+ if (this._basedOnContent) { // TODO: handle the case where section is not content section
1093
1134
  var dv = (this._activeGrid) ? this._activeGrid.getDataSource() : null;
1094
1135
 
1095
1136
  if (dv) {
1096
- var toRowIndex = rowIndex + length - 1;
1097
1137
  var rids = dv.getVisibleRowIds(true);
1138
+ if(length == null) {
1139
+ length = rids.length;
1140
+ }
1141
+ var toRowIndex = rowIndex + length;
1142
+ if(toRowIndex > rids.length) {
1143
+ toRowIndex = rids.length;
1144
+ }
1098
1145
  var ridList = [];
1099
1146
  var valueList = [];
1100
- for (var r = rowIndex; r <= toRowIndex; r++) {
1147
+ for (var r = rowIndex; r < toRowIndex; r++) {
1101
1148
  var dataRow = this._getRow(dv, r);
1102
1149
  if (dataRow) {
1103
1150
  ridList.push(rids[r]);
@@ -1108,6 +1155,9 @@ RowSelectionPlugin.prototype._sectionSelectRowRange = function (section, rowInde
1108
1155
  this._setColumnData(dv, this._selectionField, valueList, ridList);
1109
1156
  }
1110
1157
  } else {
1158
+ if(length == null) {
1159
+ length = section.getRowCount();
1160
+ }
1111
1161
  section.selectRowRange(rowIndex, length);
1112
1162
  }
1113
1163
  };
@@ -1222,14 +1272,15 @@ RowSelectionPlugin.prototype._clearMenuIcon = function () {
1222
1272
  }
1223
1273
  };
1224
1274
  /** @private
1225
- * @param {number} rowIndex
1226
- * @param {number} length
1275
+ * @param {number|null} rowIndex
1276
+ * @param {number|null} length
1227
1277
  * @param {Object=} sectRef Grid SectionReference
1228
1278
  */
1229
1279
  RowSelectionPlugin.prototype._selectRowRange = function (rowIndex, length, sectRef) {
1230
1280
  var section = this._getSection(sectRef);
1231
- if (!section) { return; }
1232
- this._sectionSelectRowRange(section, rowIndex, length);
1281
+ if (section) {
1282
+ this._selectRangeOnSection(section, rowIndex, length);
1283
+ }
1233
1284
  };
1234
1285
 
1235
1286
  /** @private
@@ -1251,7 +1302,7 @@ RowSelectionPlugin.prototype._selectFromAnchorToTarget = function (section, rowI
1251
1302
  startingRow = rowIndex;
1252
1303
  }
1253
1304
 
1254
- this._sectionSelectRowRange(section, startingRow, (selectionCount * direction) + 1);
1305
+ this._selectRangeOnSection(section, startingRow, (selectionCount * direction) + 1);
1255
1306
 
1256
1307
  if (!this._basedOnContent && this._anchorSection.setRowAnchor) {
1257
1308
  //Make sure that the anchor stays at the same position
@@ -1260,20 +1311,6 @@ RowSelectionPlugin.prototype._selectFromAnchorToTarget = function (section, rowI
1260
1311
  }
1261
1312
  }
1262
1313
  };
1263
- /** @private
1264
- * @param {number} fromIndex
1265
- * @param {number} toIndex
1266
- */
1267
- RowSelectionPlugin.prototype._selectSectionRange = function (fromIndex, toIndex) {
1268
- if (!this._activeGrid) { return; }
1269
- for (var i = fromIndex; i <= toIndex; i++) {
1270
- var settings = this._activeGrid.getSectionSettings(i);
1271
- if (settings.getType() === "content") {
1272
- var section = settings.getSection();
1273
- this._sectionSelectRowRange(section, 0, section.getRowCount());
1274
- }
1275
- }
1276
- };
1277
1314
 
1278
1315
  /** @private
1279
1316
  * @return {boolean}
@@ -8,8 +8,16 @@ declare class SnapshotFiller extends EventDispatcher {
8
8
 
9
9
  constructor();
10
10
 
11
+ public static readonly _mockAdc: any;
12
+
11
13
  public setRTK(rtk: any): void;
12
14
 
15
+ public static setMockAdc(str: string, value: any): void;
16
+
17
+ public static getMockAdc(str: string): any;
18
+
19
+ public static clearMockAdc(): void;
20
+
13
21
  public setADCOptions(adcOptions: Grid.ADCOptions|null): void;
14
22
 
15
23
  public addRic(ric: string): void;
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.131",
2
+ "tr-grid-util": "1.3.132",
3
3
  "tr-grid-printer": "1.0.16",
4
4
  "@grid/column-dragging": "1.0.14",
5
5
  "@grid/row-segmenting": "1.0.28",
@@ -10,11 +10,11 @@
10
10
  "tr-grid-checkbox": "1.0.60",
11
11
  "tr-grid-column-fitter": "1.0.39",
12
12
  "tr-grid-column-formatting": "0.9.35",
13
- "tr-grid-column-grouping": "1.0.55",
13
+ "tr-grid-column-grouping": "1.0.57",
14
14
  "tr-grid-column-resizing": "1.0.28",
15
- "tr-grid-column-selection": "1.0.29",
15
+ "tr-grid-column-selection": "1.0.30",
16
16
  "tr-grid-column-stack": "1.0.72",
17
- "tr-grid-conditional-coloring": "1.0.65",
17
+ "tr-grid-conditional-coloring": "1.0.66",
18
18
  "tr-grid-content-wrap": "1.0.20",
19
19
  "tr-grid-contextmenu": "1.0.40",
20
20
  "tr-grid-filter-input": "0.9.33",
@@ -26,7 +26,7 @@
26
26
  "tr-grid-row-dragging": "1.0.29",
27
27
  "tr-grid-row-filtering": "1.0.61",
28
28
  "tr-grid-row-grouping": "1.0.82",
29
- "tr-grid-row-selection": "1.0.23",
29
+ "tr-grid-row-selection": "1.0.24",
30
30
  "tr-grid-rowcoloring": "1.0.24",
31
31
  "tr-grid-textformatting": "1.0.46",
32
32
  "tr-grid-titlewrap": "1.0.19",
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.67"
69
+ "version": "6.0.69"
70
70
  }