@refinitiv-ui/efx-grid 6.0.131 → 6.0.132

Sign up to get free protection for your applications and to get access to all the features.
package/lib/grid/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import {Grid} from "./lib/efx-grid.js";
2
2
  export {Grid}
3
- window.EFX_GRID = { version: "6.0.131" };
3
+ window.EFX_GRID = { version: "6.0.132" };
@@ -2,7 +2,10 @@ import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
2
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
3
3
  import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
4
4
 
5
- var isSafari = navigator.vendor &&
5
+ /** @private
6
+ * @type {boolean}
7
+ */
8
+ let isSafari = navigator.vendor &&
6
9
  navigator.vendor.indexOf('Apple') > -1 &&
7
10
  navigator.userAgent &&
8
11
  navigator.userAgent.indexOf('CriOS') == -1 &&
@@ -26,7 +29,7 @@ var isSafari = navigator.vendor &&
26
29
  * @param {AutoTooltipPlugin~Options=} options
27
30
  * @extends {GridPlugin}
28
31
  */
29
- var AutoTooltipPlugin = function (options) {
32
+ let AutoTooltipPlugin = function (options) {
30
33
  this.applyTooltipToAllColumns = this.applyTooltipToAllColumns.bind(this);
31
34
  this._onPreSectionDataBinding = this._onPreSectionDataBinding.bind(this);
32
35
  this._onPostSectionDataBinding = this._onPostSectionDataBinding.bind(this);
@@ -62,7 +65,7 @@ AutoTooltipPlugin._isColumnVisible = function(column) {
62
65
  return false;
63
66
  }
64
67
 
65
- var colElem = column.getElement();
68
+ let colElem = column.getElement();
66
69
  if(!colElem) {
67
70
  return false;
68
71
  }
@@ -75,7 +78,7 @@ AutoTooltipPlugin._isColumnVisible = function(column) {
75
78
  * @return {boolean}
76
79
  */
77
80
  AutoTooltipPlugin._isUpdateRequired = function(hosts) {
78
- var len = hosts.length;
81
+ let len = hosts.length;
79
82
  if(len <= 0 || isSafari) {
80
83
  return false;
81
84
  }
@@ -147,7 +150,7 @@ AutoTooltipPlugin.prototype.initialize = function (host, options) {
147
150
  * @param {Object} host core grid
148
151
  */
149
152
  AutoTooltipPlugin.prototype.unload = function (host) {
150
- var at = this._hosts.indexOf(host);
153
+ let at = this._hosts.indexOf(host);
151
154
  if (at < 0) { return; }
152
155
  this._hosts.splice(at, 1);
153
156
 
@@ -170,10 +173,10 @@ AutoTooltipPlugin.prototype.unload = function (host) {
170
173
  AutoTooltipPlugin.prototype.config = function (options) {
171
174
  if (!options) { return; }
172
175
 
173
- var extOptions = options.autoTooltip;
176
+ let extOptions = options.autoTooltip;
174
177
  if(extOptions) {
175
178
  // header is alias of title
176
- var val = extOptions["title"] || extOptions["header"];
179
+ let val = extOptions["title"] || extOptions["header"];
177
180
  if (val != null) {
178
181
  this._title = val ? true : false;
179
182
  }
@@ -189,10 +192,10 @@ AutoTooltipPlugin.prototype.config = function (options) {
189
192
  }
190
193
 
191
194
  // Retrive auto tooltip data from columns
192
- var columns = options["columns"];
195
+ let columns = options["columns"];
193
196
  if (columns) {
194
- var len = columns.length;
195
- for (var c = 0; c < len; ++c) {
197
+ let len = columns.length;
198
+ for (let c = 0; c < len; ++c) {
196
199
  this._configColumn(c, columns[c]);
197
200
  }
198
201
  }
@@ -203,27 +206,27 @@ AutoTooltipPlugin.prototype.config = function (options) {
203
206
  * @return {!Object}
204
207
  */
205
208
  AutoTooltipPlugin.prototype.getConfigObject = function (gridOptions) {
206
- var obj = gridOptions || {};
209
+ let obj = gridOptions || {};
207
210
 
208
- var columns = obj.columns;
211
+ let columns = obj.columns;
209
212
  if(!columns) {
210
213
  columns = obj.columns = [];
211
214
  }
212
215
 
213
- var len = this.getColumnCount();
214
- for(var i = 0; i < len; ++i) {
215
- var column = columns[i];
216
+ let len = this.getColumnCount();
217
+ for(let i = 0; i < len; ++i) {
218
+ let column = columns[i];
216
219
  if(!column) {
217
220
  column = columns[i] = {};
218
221
  }
219
222
 
220
- var colOptions = this._getColumnOption(i, "autoTooltip");
223
+ let colOptions = this._getColumnOption(i, "autoTooltip");
221
224
  if(colOptions === true) {
222
225
  column.autoTooltip = true;
223
226
  }
224
227
  }
225
228
 
226
- var extOptions = obj.autoTooltip;
229
+ let extOptions = obj.autoTooltip;
227
230
  if(!extOptions) {
228
231
  extOptions = obj.autoTooltip = {};
229
232
  }
@@ -249,7 +252,7 @@ AutoTooltipPlugin.prototype.getConfigObject = function (gridOptions) {
249
252
  */
250
253
  AutoTooltipPlugin.prototype._configColumn = function(colIndex, columnConfig) {
251
254
  if(columnConfig) {
252
- var val = columnConfig["autoTooltip"];
255
+ let val = columnConfig["autoTooltip"];
253
256
  if (val != null) {
254
257
  this._newColumnData(colIndex)["autoTooltip"] = val ? true : false;
255
258
  }
@@ -263,22 +266,22 @@ AutoTooltipPlugin.prototype._configColumn = function(colIndex, columnConfig) {
263
266
  * @param {number=} toR End row index
264
267
  */
265
268
  AutoTooltipPlugin.prototype.applyTooltip = function (colIndex, fromR, toR) {
266
- var hosts = this._hosts;
269
+ let hosts = this._hosts;
267
270
  if(!AutoTooltipPlugin._isUpdateRequired(hosts)) {
268
271
  return;
269
272
  }
270
273
 
271
- for (var i = 0; i < hosts.length; ++i) {
272
- var host = this._hosts[i];
274
+ for (let i = 0; i < hosts.length; ++i) {
275
+ let host = this._hosts[i];
273
276
  if (this._title) {
274
- var titles = host.getAllSections("title");
275
- for (var t = titles.length; --t >= 0;) {
277
+ let titles = host.getAllSections("title");
278
+ for (let t = titles.length; --t >= 0;) {
276
279
  this._updateNonContentSection(titles[t], colIndex);
277
280
  }
278
281
  }
279
282
  if (this._footer) {
280
- var footers = host.getAllSections("footer");
281
- for (var j = footers.length; --j >= 0;) {
283
+ let footers = host.getAllSections("footer");
284
+ for (let j = footers.length; --j >= 0;) {
282
285
  this._updateNonContentSection(footers[j], colIndex);
283
286
  }
284
287
  }
@@ -294,10 +297,10 @@ AutoTooltipPlugin.prototype.applyTooltip = function (colIndex, fromR, toR) {
294
297
  * @param {Array.<number>=} colIndices Column indices
295
298
  */
296
299
  AutoTooltipPlugin.prototype.applyTooltipToColumns = function (colIndices) {
297
- var host = this._hosts ? this._hosts[0] : null;
300
+ let host = this._hosts ? this._hosts[0] : null;
298
301
  if (host && host.getElement()) {
299
- var len = colIndices ? colIndices.length : 0;
300
- for (var i = 0; i < len; ++i) {
302
+ let len = colIndices ? colIndices.length : 0;
303
+ for (let i = 0; i < len; ++i) {
301
304
  this.applyTooltip(colIndices[i]);
302
305
  }
303
306
  }
@@ -308,8 +311,8 @@ AutoTooltipPlugin.prototype.applyTooltipToColumns = function (colIndices) {
308
311
  */
309
312
  AutoTooltipPlugin.prototype.applyTooltipToAllColumns = function () {
310
313
  this._applyTimer = 0;
311
- var colCount = this.getColumnCount();
312
- for (var c = 0; c < colCount; ++c) {
314
+ let colCount = this.getColumnCount();
315
+ for (let c = 0; c < colCount; ++c) {
313
316
  this.applyTooltip(c);
314
317
  }
315
318
  };
@@ -343,17 +346,17 @@ AutoTooltipPlugin.prototype._requestNonContentSectionUpdate = function () {
343
346
  return;
344
347
  }
345
348
 
346
- var hosts = this._hosts;
349
+ let hosts = this._hosts;
347
350
  if(!AutoTooltipPlugin._isUpdateRequired(hosts)) {
348
351
  return;
349
352
  }
350
353
 
351
354
  this._nonContentSectionUpdated = true;
352
355
 
353
- var colCount = this.getColumnCount();
354
- var sections, s, c;
355
- for(var i = 0; i < hosts.length; ++i) {
356
- var host = hosts[i];
356
+ let colCount = this.getColumnCount();
357
+ let sections, s, c;
358
+ for(let i = 0; i < hosts.length; ++i) {
359
+ let host = hosts[i];
357
360
 
358
361
  sections = host.getAllSections("title");
359
362
  for(s = 0; s < sections.length; s++) {
@@ -379,15 +382,15 @@ AutoTooltipPlugin.prototype._requestContentSectionUpdate = function () {
379
382
  return;
380
383
  }
381
384
 
382
- var hosts = this._hosts;
385
+ let hosts = this._hosts;
383
386
  if(!AutoTooltipPlugin._isUpdateRequired(hosts)) {
384
387
  return;
385
388
  }
386
389
 
387
- var colCount = this.getColumnCount();
388
- for(var i = 0; i < hosts.length; ++i) {
389
- var section = hosts[i].getSection("content");
390
- for(var c = 0; c < colCount; c++) {
390
+ let colCount = this.getColumnCount();
391
+ for(let i = 0; i < hosts.length; ++i) {
392
+ let section = hosts[i].getSection("content");
393
+ for(let c = 0; c < colCount; c++) {
391
394
  if(this._isTooltipCandidate(c)) {
392
395
  this._updateContentSection(section, c);
393
396
  }
@@ -404,20 +407,20 @@ AutoTooltipPlugin.prototype._requestContentSectionUpdate = function () {
404
407
  AutoTooltipPlugin.prototype._updateNonContentSection = function (section, colIndex) {
405
408
  if(!section) { return false; }
406
409
 
407
- var column = section.getColumn(colIndex);
410
+ let column = section.getColumn(colIndex);
408
411
  if(!AutoTooltipPlugin._isColumnVisible(column)) {
409
412
  return false;
410
413
  }
411
414
 
412
- var rowCount = section.getRowCount();
413
- for(var r = 0; r < rowCount; ++r) {
414
- var cell = section.getCell(colIndex, r, false); // Ignore cell span
415
+ let rowCount = section.getRowCount();
416
+ for(let r = 0; r < rowCount; ++r) {
417
+ let cell = section.getCell(colIndex, r, false); // Ignore cell span
415
418
  if(!cell || !cell.isVisible()) { return false; }
416
419
 
417
- var elem = cell.getContent();
420
+ let elem = cell.getContent();
418
421
  if(!elem) { return false; }
419
422
 
420
- var tooltipInfo = cell.getTooltipInfo();
423
+ let tooltipInfo = cell.getTooltipInfo();
421
424
  if(tooltipInfo) {
422
425
  if(tooltipInfo["userTooltip"] != null ||
423
426
  tooltipInfo["groupHeaderDefault"] != null ||
@@ -430,11 +433,11 @@ AutoTooltipPlugin.prototype._updateNonContentSection = function (section, colInd
430
433
  }
431
434
 
432
435
  // Set tooltip only if text's length is longer than column width.
433
- var sw = elem.scrollWidth;
436
+ let sw = elem.scrollWidth;
434
437
  if(sw && sw > elem.offsetWidth) {
435
438
  cell.setTooltipInfo("clippedText", true);
436
439
 
437
- var tooltip = cell.getTextContent();
440
+ let tooltip = cell.getTextContent();
438
441
  cell.setTooltipInfo("clippedTextTooltip", tooltip);
439
442
  cell.setAttribute("ef-title", tooltip);
440
443
  } else {
@@ -471,7 +474,7 @@ AutoTooltipPlugin.prototype._updateContentSection = function (section, colIndex,
471
474
  return false;
472
475
  }
473
476
 
474
- var columnObj = section.getColumn(colIndex);
477
+ let columnObj = section.getColumn(colIndex);
475
478
  if (!columnObj) {
476
479
  return false;
477
480
  }
@@ -480,24 +483,24 @@ AutoTooltipPlugin.prototype._updateContentSection = function (section, colIndex,
480
483
  return false;
481
484
  }
482
485
 
483
- var colElem = columnObj.getElement();
486
+ let colElem = columnObj.getElement();
484
487
  if (!colElem) {
485
488
  return false;
486
489
  }
487
490
 
488
- for (var r = fromR; r < toR; ++r) {
489
- var cell = section.getCell(colIndex, r, false); // Ignore cell span
491
+ for (let r = fromR; r < toR; ++r) {
492
+ let cell = section.getCell(colIndex, r, false); // Ignore cell span
490
493
  if (cell && cell.isVisible()) {
491
494
 
492
495
  if (cell._userDefinedTooltip == null) {
493
- var tooltipProp = cell.getTooltip() || cell.getAttribute('ef-title');
496
+ let tooltipProp = cell.getTooltip() || cell.getAttribute('ef-title');
494
497
  cell._userDefinedTooltip = tooltipProp || '';
495
498
  }
496
499
 
497
- var elem = cell.getContent();
498
- var tooltip = "";
500
+ let elem = cell.getContent();
501
+ let tooltip = "";
499
502
  if (elem) {
500
- var sw = elem.scrollWidth;
503
+ let sw = elem.scrollWidth;
501
504
 
502
505
  // Set tooltip only if text's length is longer than column width.
503
506
  if (sw && sw > elem.offsetWidth) {
@@ -533,8 +536,8 @@ AutoTooltipPlugin.prototype._clearTooltipCache = function (section, colIndex, fr
533
536
  return;
534
537
  }
535
538
 
536
- for (var rowIndex = fromRowIndex; rowIndex < toRowIndex; rowIndex++) {
537
- var cell = section.getCell(colIndex, rowIndex);
539
+ for (let rowIndex = fromRowIndex; rowIndex < toRowIndex; rowIndex++) {
540
+ let cell = section.getCell(colIndex, rowIndex);
538
541
  // if isDataChange = true
539
542
  if (isDataChange || (cell && cell._userDefinedTooltip != null)) {
540
543
  cell._userDefinedTooltip = null;
@@ -549,7 +552,7 @@ AutoTooltipPlugin.prototype._clearTooltipCache = function (section, colIndex, fr
549
552
  if (cell._previousPos === rowIndex + '-' + colIndex
550
553
  && !isDataChange // in case isDataChange be true then we need to clear all tooltip cache in else block
551
554
  ) {
552
- var tooltip = cell.getTooltip() || cell.getAttribute('ef-title');
555
+ let tooltip = cell.getTooltip() || cell.getAttribute('ef-title');
553
556
  if (tooltip) {
554
557
  cell.removeAttribute('ef-title');
555
558
  cell.setTooltip(tooltip);
@@ -565,27 +568,27 @@ AutoTooltipPlugin.prototype._clearTooltipCache = function (section, colIndex, fr
565
568
  };
566
569
 
567
570
  /** @private
568
- * @param {Event} e event from preSectionDataBinding
571
+ * @param {Object} e event from preSectionDataBinding
569
572
  */
570
573
  AutoTooltipPlugin.prototype._onPreSectionDataBinding = function (e) {
571
574
  if (e && e.sectionType === "content") {
572
- var colCount = this.getColumnCount();
573
- var isDataChange = e.actualUpdate === true;
574
- for (var c = 0; c < colCount; ++c) {
575
+ let colCount = this.getColumnCount();
576
+ let isDataChange = e.actualUpdate === true;
577
+ for (let c = 0; c < colCount; ++c) {
575
578
  this._clearTooltipCache(e.section, c, e.fromRowIndex, e.toRowIndex, isDataChange);
576
579
  }
577
580
  }
578
581
  };
579
582
 
580
583
  /** @private
581
- * @param {Event} e event from preSectionDataBinding
584
+ * @param {Object} e event from preSectionDataBinding
582
585
  */
583
586
  AutoTooltipPlugin.prototype._onPostSectionDataBinding = function (e) {
584
587
  this._requestAllSectionsUpdate();
585
588
  };
586
589
 
587
590
  /** @private
588
- * @param {Event|Element} e
591
+ * @param {Object} e
589
592
  */
590
593
  AutoTooltipPlugin.prototype._onColumnAdded = function(e) {
591
594
  if(e.context && e.colIndex != null) {
@@ -601,7 +604,7 @@ AutoTooltipPlugin.prototype._onColumnAdded = function(e) {
601
604
  * @return {boolean}
602
605
  */
603
606
  AutoTooltipPlugin.prototype._isTooltipCandidate = function (colIndex) {
604
- var bool = this._getColumnOption(colIndex, "autoTooltip");
607
+ let bool = this._getColumnOption(colIndex, "autoTooltip");
605
608
  if(bool != null) {
606
609
  return bool ? true : false;
607
610
  }
@@ -1,11 +1,14 @@
1
1
  import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
2
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
3
3
  import { GroupDefinitions } from "../../tr-grid-util/es6/GroupDefinitions.js";
4
- import { cloneObject, injectCss, prettifyCss, deepEqual } from "../../tr-grid-util/es6/Util.js";
4
+ import { cloneObject, injectCss, prettifyCss, deepEqual, isEmptyObject } from "../../tr-grid-util/es6/Util.js";
5
5
 
6
6
  declare namespace ColumnGroupingPlugin {
7
7
 
8
- type Options = (ColumnGroupingPlugin.GroupDefinition)[]|null;
8
+ type Options = {
9
+ groupDefinitions: ColumnGroupingPlugin.GroupDefinitions|null,
10
+ minChildCount?: number|null
11
+ };
9
12
 
10
13
  type GroupDefinitions = (ColumnGroupingPlugin.GroupDefinition)[]|null;
11
14
 
@@ -1,10 +1,12 @@
1
1
  import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
2
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
3
3
  import { GroupDefinitions } from "../../tr-grid-util/es6/GroupDefinitions.js";
4
- import { cloneObject, injectCss, prettifyCss, deepEqual } from "../../tr-grid-util/es6/Util.js";
4
+ import { cloneObject, injectCss, prettifyCss, deepEqual, isEmptyObject } from "../../tr-grid-util/es6/Util.js";
5
5
 
6
- /** @typedef {Array<ColumnGroupingPlugin~GroupDefinition>} ColumnGroupingPlugin~Options
6
+ /** @typedef {Object} ColumnGroupingPlugin~Options
7
7
  * @description This options can be specified by `columnGrouping` property of the main grid's options or extension options.
8
+ * @property {ColumnGroupingPlugin~GroupDefinitions} groupDefinitions A collection of group definition objects
9
+ * @property {number=} minChildCount=2 The minimum number of child columns required for group to be visible
8
10
  */
9
11
 
10
12
  /** @typedef {Array<ColumnGroupingPlugin~GroupDefinition>} ColumnGroupingPlugin~GroupDefinitions
@@ -89,6 +91,10 @@ ColumnGroupingPlugin.prototype._legacyColumnGroups = null;
89
91
  * @private
90
92
  */
91
93
  ColumnGroupingPlugin.prototype._selectedColMap;
94
+ /** @type {number}
95
+ * @private
96
+ */
97
+ ColumnGroupingPlugin.prototype._minChildCount = 2;
92
98
 
93
99
  /** @private
94
100
  * @param {number} a
@@ -334,7 +340,17 @@ ColumnGroupingPlugin.prototype.config = function (options) {
334
340
  let extOptions = options["columnGrouping"];
335
341
  let groupDefs = null;
336
342
  if(Array.isArray(extOptions)) {
337
- groupDefs = extOptions.filter(ColumnGroupingPlugin._hasGroupId);
343
+ groupDefs = extOptions;
344
+ } else if(typeof extOptions === "object") {
345
+ groupDefs = extOptions["groupDefinitions"];
346
+ let minChildCount = extOptions["minChildCount"];
347
+ if(typeof minChildCount === "number" && minChildCount > 0) {
348
+ this._minChildCount = minChildCount;
349
+ }
350
+ }
351
+
352
+ if(groupDefs) {
353
+ groupDefs = groupDefs.filter(ColumnGroupingPlugin._hasGroupId);
338
354
  groupDefs = groupDefs.map(ColumnGroupingPlugin._cloneObject);
339
355
  }
340
356
 
@@ -355,11 +371,26 @@ ColumnGroupingPlugin.prototype.config = function (options) {
355
371
  ColumnGroupingPlugin.prototype.getConfigObject = function (gridOptions) {
356
372
  let obj = gridOptions || {};
357
373
 
374
+ let extOptions = {};
375
+
358
376
  // TODO: Handle legacyRender method that has been migrated
359
377
  let groupDefs = this.getGroupDefinitions();
360
378
  groupDefs = groupDefs.filter(ColumnGroupingPlugin._isNotTimeSeriesGroup);
361
379
  if(groupDefs.length) {
362
- obj.columnGrouping = groupDefs;
380
+ extOptions.groupDefinitions = groupDefs;
381
+ }
382
+
383
+ if(this._minChildCount !== 2) {
384
+ extOptions.minChildCount = this._minChildCount;
385
+ }
386
+
387
+ if(!isEmptyObject(extOptions)) {
388
+ let extUserOptions = obj.columnGrouping;
389
+ if(extUserOptions != null && typeof extUserOptions === "object") {
390
+ Object.assign(extUserOptions, extOptions);
391
+ } else {
392
+ obj.columnGrouping = extOptions;
393
+ }
363
394
  }
364
395
 
365
396
  return obj;
@@ -669,6 +700,7 @@ ColumnGroupingPlugin.prototype._verifySingleChild = function(groupMap) {
669
700
  validIds[groupIds[i]] = 1;
670
701
  }
671
702
 
703
+ let minChildCount = this._minChildCount;
672
704
  let removable = true;
673
705
  while(removable){
674
706
  removable = false;
@@ -689,7 +721,7 @@ ColumnGroupingPlugin.prototype._verifySingleChild = function(groupMap) {
689
721
  }
690
722
  }
691
723
 
692
- if(validChildren.length < 2) {
724
+ if(validChildren.length < minChildCount) {
693
725
  delete groupMap[groupId];
694
726
  validIds[groupId] = 0;
695
727
  removable = true;
@@ -437,16 +437,15 @@ RowSelectionPlugin.prototype.getSelectedRows = function (sectRef) {
437
437
  * @private
438
438
  * @param {Object} dv
439
439
  * @param {Array<string>} rids
440
- * @param {boolean=} select
440
+ * @param {boolean=} selected
441
441
  */
442
- RowSelectionPlugin.prototype._setHeaderSelections = function(dv, rids, select) {
443
- if(select == null) {
444
- select = true;
442
+ RowSelectionPlugin.prototype._setHeaderSelections = function(dv, rids, selected) {
443
+ if(selected == null) {
444
+ selected = true;
445
445
  }
446
446
  let len = rids.length;
447
447
  for (let i = 0; i < len; i++) {
448
- let rid = rids[i];
449
- this._setHeaderSelection(dv, rid, select);
448
+ this._setHeaderSelection(dv, rids[i], selected);
450
449
  }
451
450
  };
452
451
 
@@ -454,14 +453,13 @@ RowSelectionPlugin.prototype._setHeaderSelections = function(dv, rids, select) {
454
453
  * @private
455
454
  * @param {Object} dv
456
455
  * @param {sting|number} rowRef
457
- * @param {boolean=} select
456
+ * @param {boolean=} selected
458
457
  */
459
- RowSelectionPlugin.prototype._setHeaderSelection = function(dv, rowRef, select) {
460
- if(select == null) {
461
- select = true;
462
- }
458
+ RowSelectionPlugin.prototype._setHeaderSelection = function(dv, rowRef, selected) {
463
459
  let rowId = this._getRowId(dv, rowRef);
464
- this._headerSelection[rowId] = select;
460
+ if(rowId) {
461
+ this._headerSelection[rowId] = (selected == null) ? true : selected;
462
+ }
465
463
  };
466
464
 
467
465
  /**
@@ -471,8 +469,7 @@ RowSelectionPlugin.prototype._setHeaderSelection = function(dv, rowRef, select)
471
469
  * @return {boolean}
472
470
  */
473
471
  RowSelectionPlugin.prototype._isHeaderSelection = function(dv, rowRef) {
474
- let rowId = this._getRowId(dv, rowRef);
475
- return this._headerSelection[rowId];
472
+ return this._headerSelection[this._getRowId(dv, rowRef)] ? true : false;
476
473
  };
477
474
 
478
475
  /**
@@ -592,27 +589,25 @@ RowSelectionPlugin.prototype.setSelectedRow = function (rowIndex, opt_select, se
592
589
  RowSelectionPlugin.prototype.selectSingleRow = function (rowIndex, sectRef, activeGrid) {
593
590
  if(!(rowIndex >= 0)) { return false; }
594
591
 
595
- // 1. first of all let's clear selectedRows of prevGrid
596
- let prevGrid = activeGrid ? this._activeGrid : null;
597
- if(prevGrid) {
598
- this._clearSelectedRows();
599
-
600
- // 2. after clear selection let switch active grid
601
- this._activeGrid = activeGrid; // HACK
592
+ let prevGrid = null;
593
+ if(activeGrid) {
594
+ prevGrid = this._activeGrid;
595
+ if(prevGrid) { // In case of multi-table, clear selection on the previous active grid
596
+ this._clearSelectedRows();
597
+ }
598
+ this._activeGrid = activeGrid;
602
599
  }
603
600
 
604
- // 3. now active grid is switch let's normally select row
605
- let section = this._getSection(sectRef); // TODO: Check if the given section is in the active grid
606
- if(this._selectSingleRow(section, rowIndex)) {
601
+ // WANRING: this._getSection will modify activeGrid, if it does not exist
602
+ let section = this._getSection(sectRef);
603
+ if(this._selectSingleRow(section, rowIndex)) { // This will also clear existing selection in the active grid
607
604
  this._scrollToRow(rowIndex);
608
605
  return true;
609
606
  }
610
- // 4. in case fail to perform _selectSingleRow
611
- // we will turn back _activeGrid to prevGrid
612
- else if(prevGrid) {
613
- this._activeGrid = prevGrid;
614
- }
615
607
 
608
+ if(prevGrid) {
609
+ this._activeGrid = prevGrid; // If the selection is unsuccessful, restore previous active grid
610
+ }
616
611
  return false;
617
612
  };
618
613
  /** @public
@@ -896,9 +891,7 @@ RowSelectionPlugin.prototype._onReselection = function (e) {
896
891
  * @param {Object} e postSectionDataBinding event context
897
892
  */
898
893
  RowSelectionPlugin.prototype._onPostSectionDataBinding = function (e) {
899
- if(!this._basedOnContent
900
- || "content" !== e.sectionType
901
- || !this._activeGrid) {
894
+ if(!this._basedOnContent || e.sectionType !== "content") {
902
895
  return;
903
896
  }
904
897
  let section = e.section;
@@ -1436,6 +1429,18 @@ RowSelectionPlugin.prototype._dispatchSelectionChanged = function (e, rowIndex,
1436
1429
  }
1437
1430
  };
1438
1431
 
1432
+ /** @public
1433
+ * @ignore
1434
+ * @return {!Object}
1435
+ */
1436
+ RowSelectionPlugin.prototype._getEventHandlers = function() {
1437
+ return {
1438
+ "mousedown": this._onMouseDown,
1439
+ "click": this._onClick,
1440
+ "keydown": this._onKeyDown
1441
+ };
1442
+ };
1443
+
1439
1444
 
1440
1445
 
1441
1446
  export default RowSelectionPlugin;
package/lib/versions.json CHANGED
@@ -5,12 +5,12 @@
5
5
  "@grid/row-segmenting": "1.0.35",
6
6
  "@grid/statistics-row": "1.0.17",
7
7
  "@grid/zoom": "1.0.11",
8
- "tr-grid-auto-tooltip": "1.1.8",
8
+ "tr-grid-auto-tooltip": "1.1.9",
9
9
  "tr-grid-cell-selection": "1.0.39",
10
10
  "tr-grid-checkbox": "1.0.70",
11
11
  "tr-grid-column-fitter": "1.0.41",
12
12
  "tr-grid-column-formatting": "0.9.36",
13
- "tr-grid-column-grouping": "1.0.64",
13
+ "tr-grid-column-grouping": "2.0.0",
14
14
  "tr-grid-column-resizing": "1.0.29",
15
15
  "tr-grid-column-selection": "1.0.33",
16
16
  "tr-grid-column-stack": "1.0.76",
@@ -26,7 +26,7 @@
26
26
  "tr-grid-row-dragging": "1.0.38",
27
27
  "tr-grid-row-filtering": "1.0.84",
28
28
  "tr-grid-row-grouping": "1.0.88",
29
- "tr-grid-row-selection": "1.0.32",
29
+ "tr-grid-row-selection": "1.0.33",
30
30
  "tr-grid-rowcoloring": "1.0.26",
31
31
  "tr-grid-textformatting": "1.0.48",
32
32
  "tr-grid-titlewrap": "1.0.22",
package/package.json CHANGED
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "version": "6.0.131"
72
+ "version": "6.0.132"
73
73
  }