@refinitiv-ui/efx-grid 6.0.31 → 6.0.32

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.
@@ -4693,11 +4693,11 @@ ILayoutGrid.prototype.getHorizontalLayout = function () {};
4693
4693
  ILayoutGrid.prototype.calculateColumnBounds = function (lftIdx, rgtIdx, outPositions, outNoBorders) {};
4694
4694
  /** @public
4695
4695
  * @ignore
4696
- * @param {!Array.<number>} positions Left and right bound positions in pixel
4697
- * @param {!Array.<boolean>} noBorders Boolean values indicating existence of left and right CSS borders
4696
+ * @param {!Array.<Array>} posAry Left and right bound positions in pixel
4697
+ * @param {!Array.<Array>} noBorderAry Boolean values indicating existence of left and right CSS borders
4698
4698
  * @param {number=} topPx Top position of bound
4699
4699
  */
4700
- ILayoutGrid.prototype.updateColumnBounds = function (positions, noBorders, topPx) {};
4700
+ ILayoutGrid.prototype.updateColumnBounds = function (posAry, noBorderAry, topPx) {};
4701
4701
 
4702
4702
  /* harmony default export */ const grid_ILayoutGrid = (ILayoutGrid);
4703
4703
 
@@ -6263,6 +6263,34 @@ SelectionList.prototype.deselect = function (at) {
6263
6263
  }
6264
6264
  return false;
6265
6265
  };
6266
+ /** Deselect all selections starting from the specified index
6267
+ * @public
6268
+ * @param {number} at
6269
+ * @return {boolean}
6270
+ */
6271
+ SelectionList.prototype.deselectFrom = function (at) {
6272
+ if(this._lastIndex < at) {
6273
+ return false;
6274
+ }
6275
+ if(this._firstIndex >= at) {
6276
+ this.clearAllSelections();
6277
+ return true;
6278
+ }
6279
+
6280
+ var lastIndex = this._lastIndex;
6281
+ var sels = this._selections;
6282
+ for(var i = at; i <= lastIndex; ++i) {
6283
+ if (sels[i]) {
6284
+ sels[at] = false;
6285
+ --this._count;
6286
+ }
6287
+ }
6288
+ if (this._anchor >= at) {
6289
+ this._anchor = -1; // No anchor
6290
+ }
6291
+ this._lastIndex = this._findPrevSelection(at);
6292
+ return true;
6293
+ };
6266
6294
  /** @public
6267
6295
  * @param {number} at
6268
6296
  */
@@ -6459,14 +6487,16 @@ SelectionList.prototype.getLastSelectedIndex = function() {
6459
6487
 
6460
6488
  /** WARNING: It will creates a new(EXPENSIVE) defragmented array of selected Index. The selected indices will always be sorted in ascending order
6461
6489
  * @public
6462
- * @return {Array.<number>}
6490
+ * @return {!Array.<number>}
6463
6491
  */
6464
6492
  SelectionList.prototype.getAllSelections = function() {
6465
6493
  if(this._count > 0) {
6466
6494
  var ary = new Array(this._count); // Fastest way to create an array
6467
6495
  var count = 0;
6468
- for(var i = this._firstIndex; i <= this._lastIndex; ++i) {
6469
- if(this._selections[i]) {
6496
+ var sels = this._selections;
6497
+ var lastIdx = this._lastIndex;
6498
+ for(var i = this._firstIndex; i <= lastIdx; ++i) {
6499
+ if(sels[i]) {
6470
6500
  ary[count++] = i;
6471
6501
  }
6472
6502
  }
@@ -6474,6 +6504,45 @@ SelectionList.prototype.getAllSelections = function() {
6474
6504
  }
6475
6505
  return [];
6476
6506
  };
6507
+ /** Get array of connected selection ranges. For intances, if indices 1, 2, 5, and 5 are selected, array of [1, 2] and [5, 5] are returned.
6508
+ * @public
6509
+ * @param {number=} from
6510
+ * @param {number=} to EXCLUSIVE
6511
+ * @return {!Array.<Array.<number>>}
6512
+ */
6513
+ SelectionList.prototype.getConnectedRanges = function(from, to) {
6514
+ if(this._count > 0) {
6515
+ var ary = [];
6516
+ if(from == null || from < this._firstIndex) {
6517
+ from = this._firstIndex;
6518
+ }
6519
+ if(to == null || to > this._lastIndex) {
6520
+ to = this._lastIndex + 1;
6521
+ }
6522
+
6523
+ var pair = null;
6524
+ for(var i = from; i < to; ++i) {
6525
+ if(this._selections[i]) {
6526
+ if(!pair) {
6527
+ pair = [i, -1];
6528
+ }
6529
+ } else if(pair) {
6530
+ pair[1] = i - 1;
6531
+ ary.push(pair);
6532
+ pair = null;
6533
+ }
6534
+ }
6535
+
6536
+ if(pair) {
6537
+ pair[1] = this._lastIndex;
6538
+ ary.push(pair);
6539
+ pair = null;
6540
+ }
6541
+ return ary;
6542
+ }
6543
+ return [];
6544
+ };
6545
+
6477
6546
  /**
6478
6547
  * @public
6479
6548
  * @return {Array.<boolean>}
@@ -6501,13 +6570,13 @@ SelectionList.prototype.clearAllSelections = function() {
6501
6570
  * @public
6502
6571
  * @param {SelectionList} srcSelections
6503
6572
  * @param {number} fromSrcIndex
6504
- * @param {number} offsetIndex
6573
+ * @param {number} offset Offset from the source index to map to destination index of this SelectionList. Use 0 if there is no shifting.
6505
6574
  * @param {number} forLength Positive value only. negative valie is not allowed
6506
6575
  */
6507
- SelectionList.prototype.copyFrom = function (srcSelections, fromSrcIndex, offsetIndex, forLength) {
6576
+ SelectionList.prototype.copyFrom = function (srcSelections, fromSrcIndex, offset, forLength) {
6508
6577
  if (forLength <= 0) { return; }
6509
6578
 
6510
- var toThisIndex = fromSrcIndex + offsetIndex;
6579
+ var toThisIndex = fromSrcIndex + offset;
6511
6580
  if (srcSelections == null) {
6512
6581
  this.deselectRange(toThisIndex, forLength);
6513
6582
  return;
@@ -6528,7 +6597,7 @@ SelectionList.prototype.copyFrom = function (srcSelections, fromSrcIndex, offset
6528
6597
  this._anchor = -1;
6529
6598
  if (srcSelections._anchor >= 0) {
6530
6599
  if (srcSelections._anchor >= fromSrcIndex && srcSelections._anchor < (fromSrcIndex + forLength)) {
6531
- this._anchor = srcSelections._anchor + offsetIndex;
6600
+ this._anchor = srcSelections._anchor + offset;
6532
6601
  }
6533
6602
  }
6534
6603
  };
@@ -8602,10 +8671,18 @@ LayoutGrid.prototype._ctxRows;
8602
8671
  * @private
8603
8672
  */
8604
8673
  LayoutGrid.prototype._boundLayer = null;
8605
- /** @type {Element}
8674
+ /** @type {Array.<Element>}
8606
8675
  * @private
8607
8676
  */
8608
- LayoutGrid.prototype._columnBound = null;
8677
+ LayoutGrid.prototype._colBounds = null;
8678
+ /** @type {Array.<Element>}
8679
+ * @private
8680
+ */
8681
+ LayoutGrid.prototype._colBoundCache = null;
8682
+ /** @type {boolean}
8683
+ * @private
8684
+ */
8685
+ LayoutGrid.prototype._colSelDirty = false;
8609
8686
  /** @type {HScrollbar}
8610
8687
  * @private
8611
8688
  */
@@ -8629,6 +8706,8 @@ LayoutGrid.prototype.dispose = function () {
8629
8706
  }
8630
8707
 
8631
8708
  this._colCount = this._rowCount = this._activeRowEnd = this._availableRowCount = 0;
8709
+ this._colBounds = this._colBoundCache = null;
8710
+ this._colSelDirty = false;
8632
8711
 
8633
8712
  this._highlightedCells.length = 0;
8634
8713
  this._ctx = null;
@@ -10570,16 +10649,15 @@ LayoutGrid.prototype.getContextRow = function (rowIndex) {
10570
10649
  LayoutGrid.prototype.selectColumn = function (colIndex, selected) {
10571
10650
  this.enableColumnClass(colIndex, "selected-column", selected);
10572
10651
 
10573
- var columnBound = this._columnBound;
10574
- if(!columnBound) {
10575
- columnBound = this._columnBound = document.createElement("div");
10576
- columnBound.className = "selection-bound column-bound";
10577
- }
10578
- var boundLayer = this._boundLayer;
10579
- if(!boundLayer) {
10580
- boundLayer = this._boundLayer = document.createElement("div");
10581
- boundLayer.className = "cover-layer";
10582
- this._updateLayers();
10652
+ if(selected) {
10653
+ this._colSelDirty = true;
10654
+
10655
+ var boundLayer = this._boundLayer;
10656
+ if(!boundLayer) {
10657
+ boundLayer = this._boundLayer = document.createElement("div");
10658
+ boundLayer.className = "cover-layer";
10659
+ this._updateLayers();
10660
+ }
10583
10661
  }
10584
10662
  };
10585
10663
  /** @public
@@ -10682,24 +10760,56 @@ LayoutGrid.prototype.calculateColumnBounds = function (lftIdx, rgtIdx, outPositi
10682
10760
  };
10683
10761
  /** @public
10684
10762
  * @ignore
10685
- * @param {!Array.<number>} positions Left and right bound positions in pixel
10686
- * @param {!Array.<boolean>} noBorders Boolean values indicating existence of left and right CSS borders
10763
+ * @param {!Array.<Array>} posAry Left and right bound positions in pixel
10764
+ * @param {!Array.<Array>} noBorderAry Boolean values indicating existence of left and right CSS borders
10687
10765
  * @param {number=} topPx Top position of bound
10688
10766
  */
10689
- LayoutGrid.prototype.updateColumnBounds = function (positions, noBorders, topPx) {
10690
- var columnBound = this._columnBound;
10691
- if(!columnBound) {
10767
+ LayoutGrid.prototype.updateColumnBounds = function (posAry, noBorderAry, topPx) {
10768
+ if(!this._colSelDirty) {
10692
10769
  return;
10693
10770
  }
10694
10771
 
10695
- var lftPx = positions[0];
10696
- var rgtPx = positions[1];
10697
- if(lftPx >= rgtPx) {
10698
- var pn = columnBound.parentNode;
10772
+ var cbs = this._colBounds;
10773
+ var cbc = this._colBoundCache;
10774
+ if(!cbs) {
10775
+ cbs = this._colBounds = [];
10776
+ }
10777
+ if(!cbc) {
10778
+ cbc = this._colBoundCache = [];
10779
+ }
10780
+
10781
+ var rangeCount = posAry.length;
10782
+ var i;
10783
+ var pn = null; // parentNode
10784
+ var columnBound = null;
10785
+
10786
+ // Remove unused bounds from document
10787
+ var activeCount = cbs.length;
10788
+ for(i = rangeCount; i < activeCount; ++i) {
10789
+ columnBound = cbs[i];
10790
+ pn = columnBound.parentNode;
10699
10791
  if(pn) {
10700
10792
  pn.removeChild(columnBound);
10701
10793
  }
10702
- } else {
10794
+ }
10795
+ cbs.length = activeCount = rangeCount;
10796
+
10797
+ if(!rangeCount) {
10798
+ this._colSelDirty = false;
10799
+ return;
10800
+ }
10801
+
10802
+ for(i = 0; i < rangeCount; ++i) {
10803
+ var positions = posAry[i];
10804
+ var noBorders = noBorderAry[i];
10805
+ var lftPx = /** @type{number} */(positions[0]);
10806
+ var rgtPx = /** @type{number} */(positions[1]);
10807
+
10808
+ columnBound = cbc[i];
10809
+ if(!columnBound) {
10810
+ columnBound = cbc[i] = document.createElement("div");
10811
+ columnBound.className = "selection-bound column-bound";
10812
+ }
10703
10813
  columnBound.style.left = lftPx + "px";
10704
10814
  columnBound.style.width = (rgtPx - lftPx) + "px";
10705
10815
 
@@ -10709,7 +10819,10 @@ LayoutGrid.prototype.updateColumnBounds = function (positions, noBorders, topPx)
10709
10819
  columnBound.classList.toggle("no-left-bound", noBorders[0]);
10710
10820
  columnBound.classList.toggle("no-right-bound", noBorders[1]);
10711
10821
  if(this._boundLayer) {
10712
- this._boundLayer.appendChild(columnBound);
10822
+ if(!cbs[i]) {
10823
+ cbs[i] = columnBound;
10824
+ this._boundLayer.appendChild(columnBound);
10825
+ }
10713
10826
  }
10714
10827
  }
10715
10828
  };
@@ -23721,10 +23834,18 @@ VirtualizedLayoutGrid.prototype._selectionList = null;
23721
23834
  * @private
23722
23835
  */
23723
23836
  VirtualizedLayoutGrid.prototype._reverter = null;
23724
- /** @type {Element}
23837
+ /** @type {Array.<Element>}
23725
23838
  * @private
23726
23839
  */
23727
- VirtualizedLayoutGrid.prototype._rowBound = null;
23840
+ VirtualizedLayoutGrid.prototype._rowBounds = null;
23841
+ /** @type {Array.<Element>}
23842
+ * @private
23843
+ */
23844
+ VirtualizedLayoutGrid.prototype._rowBoundCache = null;
23845
+ /** @type {boolean}
23846
+ * @private
23847
+ */
23848
+ VirtualizedLayoutGrid.prototype._rowSelDirty = false;
23728
23849
  /** @type {Element}
23729
23850
  * @private
23730
23851
  */
@@ -23790,6 +23911,9 @@ VirtualizedLayoutGrid.prototype.dispose = function () {
23790
23911
  this._grid.dispose();
23791
23912
  this._dispose();
23792
23913
  this._reverter.dispose();
23914
+
23915
+ this._rowBounds = this._rowBoundCache = null;
23916
+ this._rowSelDirty = false;
23793
23917
  if(this._rowBoundTimer) {
23794
23918
  clearTimeout(this._rowBoundTimer);
23795
23919
  this._rowBoundTimer = 0;
@@ -24241,9 +24365,10 @@ VirtualizedLayoutGrid.prototype.setSelectedRow = function (rowIndex, opt_selecte
24241
24365
  this._grid.setSelectedRow(rowIndex - this._firstIndex, selected);
24242
24366
 
24243
24367
  if(selected) {
24244
- this._initRowBounds();
24368
+ this._rowSelDirty = true;
24369
+ this._initBoundLayer();
24245
24370
  }
24246
- this._updateRowBounds();
24371
+ this._requestUpdatingRowBounds();
24247
24372
  };
24248
24373
 
24249
24374
  /** @inheritDoc */
@@ -24256,14 +24381,15 @@ VirtualizedLayoutGrid.prototype.selectSingleRow = function (rowIndex) {
24256
24381
  VirtualizedLayoutGrid.prototype.selectRowRange = function (rowIndex, length) {
24257
24382
  this._selectionList.selectRange(rowIndex, length);
24258
24383
  this._updateRowSelection();
24259
- this._initRowBounds();
24260
- this._updateRowBounds();
24384
+ this._rowSelDirty = true;
24385
+ this._initBoundLayer();
24386
+ this._requestUpdatingRowBounds();
24261
24387
  };
24262
24388
  /** @inheritDoc */
24263
24389
  VirtualizedLayoutGrid.prototype.clearSelectedRows = function () {
24264
24390
  var count = this._selectionList.clearAllSelections();
24265
24391
  this._grid.clearSelectedRows();
24266
- this._updateRowBounds();
24392
+ this._requestUpdatingRowBounds(); // WARNING: Row bounds are not removed from the document immediately
24267
24393
  return count;
24268
24394
  };
24269
24395
  /** @inheritDoc */
@@ -24705,12 +24831,12 @@ VirtualizedLayoutGrid.prototype._updateCellBounds = function () {
24705
24831
  };
24706
24832
  /** @public
24707
24833
  * @ignore
24708
- * @param {!Array.<number>} positions Left and right bound positions in pixel
24709
- * @param {!Array.<boolean>} noBorders Boolean values indicating existence of left and right CSS borders
24834
+ * @param {!Array.<Array>} posAry Left and right bound positions in pixel
24835
+ * @param {!Array.<Array>} noBorderAry Boolean values indicating existence of left and right CSS borders
24710
24836
  * @param {number=} topPx Top position of bound
24711
24837
  */
24712
- VirtualizedLayoutGrid.prototype.updateColumnBounds = function (positions, noBorders, topPx) {
24713
- this._grid.updateColumnBounds(positions, noBorders, topPx);
24838
+ VirtualizedLayoutGrid.prototype.updateColumnBounds = function (posAry, noBorderAry, topPx) {
24839
+ this._grid.updateColumnBounds(posAry, noBorderAry, topPx);
24714
24840
  this._updateRowBounds();
24715
24841
  };
24716
24842
  /** @private
@@ -24725,16 +24851,6 @@ VirtualizedLayoutGrid.prototype._initBoundLayer = function () {
24725
24851
  };
24726
24852
  /** @private
24727
24853
  */
24728
- VirtualizedLayoutGrid.prototype._initRowBounds = function () {
24729
- var rowBound = this._rowBound;
24730
- if(!rowBound) {
24731
- rowBound = this._rowBound = document.createElement("div");
24732
- rowBound.className = "selection-bound";
24733
- }
24734
- this._initBoundLayer();
24735
- };
24736
- /** @private
24737
- */
24738
24854
  VirtualizedLayoutGrid.prototype._requestUpdatingRowBounds = function () {
24739
24855
  if(!this._rowBoundTimer) {
24740
24856
  this._rowBoundTimer = setTimeout(this._updateRowBounds, 10);
@@ -24746,54 +24862,88 @@ VirtualizedLayoutGrid.prototype._updateRowBounds = function () {
24746
24862
  this._rowBoundTimer = 0;
24747
24863
  this._updateCellBounds();
24748
24864
 
24749
- var rowBound = this._rowBound;
24750
- if(!rowBound) {
24865
+ if(!this._rowSelDirty) {
24751
24866
  return;
24752
24867
  }
24753
- var topIdx = this.getFirstSelectedRow();
24754
- var btmIdx = -1; // Inclusive
24755
- var topPx = 0;
24756
- var btmPx = 0;
24757
- var rowCount = this._layoutY.getLaneCount();
24758
- if(topIdx >= rowCount) {
24759
- topIdx = rowCount - 1;
24868
+ var rbs = this._rowBounds;
24869
+ var rbc = this._rowBoundCache;
24870
+ if(!rbs) {
24871
+ rbs = this._rowBounds = [];
24760
24872
  }
24761
- if(topIdx >= 0) {
24762
- btmIdx = this.getLastSelectedRow();
24763
- if(btmIdx >= rowCount) {
24764
- btmIdx = rowCount - 1;
24765
- }
24766
- topPx = this._layoutY.getLaneStart(topIdx);
24767
- btmPx = this._layoutY.getLaneEnd(btmIdx);
24873
+ if(!rbc) {
24874
+ rbc = this._rowBoundCache = [];
24768
24875
  }
24769
24876
 
24770
- if(topPx >= btmPx) {
24771
- var pn = rowBound.parentNode;
24877
+ var selList = this._selectionList;
24878
+ var rowCount = this._layoutY.getLaneCount();
24879
+ selList.deselectFrom(rowCount); // TODO: move this to setRowCount
24880
+
24881
+ var selRanges = selList.getConnectedRanges();
24882
+ var rangeCount = selRanges.length;
24883
+ var i;
24884
+ var pn = null; // parentNode
24885
+ var rowBound = null;
24886
+
24887
+ // Remove unused bounds from document
24888
+ var activeCount = rbs.length;
24889
+ for(i = rangeCount; i < activeCount; ++i) {
24890
+ rowBound = rbs[i];
24891
+ pn = rowBound.parentNode;
24772
24892
  if(pn) {
24773
24893
  pn.removeChild(rowBound);
24774
24894
  }
24775
- } else {
24895
+ }
24896
+ rbs.length = activeCount = rangeCount;
24897
+
24898
+ if(!rangeCount) {
24899
+ var selCount = selList.getSelectionCount();
24900
+ if(!selCount) {
24901
+ this._rowSelDirty = false;
24902
+ }
24903
+ return;
24904
+ }
24905
+
24906
+ // Prepare shared parameters
24907
+ var scrollLeft = 0;
24908
+ var pinnedLftCount = 0;
24909
+ var pinnedRgtCount = 0;
24910
+ var endOfScroll = false;
24911
+ if(this._hscrollbar) {
24912
+ scrollLeft = this._hscrollbar.getScrollLeft();
24913
+ pinnedLftCount = this._hscrollbar.getPinnedLeftColumnCount();
24914
+ pinnedRgtCount = this._hscrollbar.getPinnedRightColumnCount();
24915
+ endOfScroll = this._hscrollbar.isEndOfHorizontalScroll();
24916
+ }
24917
+ var noLeftBound = !pinnedLftCount && scrollLeft > 0;
24918
+ var noRightBound = !pinnedRgtCount && !endOfScroll;
24919
+ var boundWidth = this._grid._getViewSize();
24920
+
24921
+ // Create row bound elements based on number of selection ranges
24922
+ for(i = 0; i < rangeCount; ++i) {
24923
+ var pair = selRanges[i];
24924
+ var topIdx = pair[0];
24925
+ var btmIdx = pair[1]; // Inclusive
24926
+ var topPx = this._layoutY.getLaneStart(topIdx);
24927
+ var btmPx = this._layoutY.getLaneEnd(btmIdx);
24928
+
24929
+ rowBound = rbc[i];
24930
+ if(!rowBound) {
24931
+ rowBound = rbc[i] = document.createElement("div");
24932
+ rowBound.className = "selection-bound";
24933
+ }
24934
+
24776
24935
  rowBound.style.top = topPx + "px";
24777
24936
  rowBound.style.height = (btmPx - topPx) + "px";
24778
-
24779
- var boundWidth = this._grid._getViewSize();
24780
24937
  rowBound.style.width = boundWidth + "px";
24781
24938
 
24782
- var scrollLeft = 0;
24783
- var pinnedLftCount = 0;
24784
- var pinnedRgtCount = 0;
24785
- var endOfScroll = false;
24786
- if(this._hscrollbar) {
24787
- scrollLeft = this._hscrollbar.getScrollLeft();
24788
- pinnedLftCount = this._hscrollbar.getPinnedLeftColumnCount();
24789
- pinnedRgtCount = this._hscrollbar.getPinnedRightColumnCount();
24790
- endOfScroll = this._hscrollbar.isEndOfHorizontalScroll();
24791
- }
24792
- rowBound.classList.toggle("no-left-bound", !pinnedLftCount && scrollLeft > 0);
24793
- rowBound.classList.toggle("no-right-bound", !pinnedRgtCount && !endOfScroll);
24939
+ rowBound.classList.toggle("no-left-bound", noLeftBound);
24940
+ rowBound.classList.toggle("no-right-bound", noRightBound);
24794
24941
 
24795
24942
  if(this._boundLayer) {
24796
- this._boundLayer.appendChild(rowBound);
24943
+ if(!rbs[i]) {
24944
+ rbs[i] = rowBound;
24945
+ this._boundLayer.appendChild(rowBound);
24946
+ }
24797
24947
  }
24798
24948
  }
24799
24949
  };
@@ -25438,7 +25588,7 @@ Core_Core.prototype._groupDefs = null;
25438
25588
  * @return {string}
25439
25589
  */
25440
25590
  Core_Core.getVersion = function () {
25441
- return "5.1.40";
25591
+ return "5.1.41";
25442
25592
  };
25443
25593
  /** {@link ElementWrapper#dispose}
25444
25594
  * @override
@@ -28964,47 +29114,72 @@ Core_Core.prototype._updateColumnBounds = function () {
28964
29114
  return;
28965
29115
  }
28966
29116
 
29117
+ var sectCount = this._settings.length;
29118
+ if(!sectCount) {
29119
+ return;
29120
+ }
29121
+
29122
+ // Collecting column selection and selection ranges
29123
+ var selRanges = [];
29124
+ var pair = null;
28967
29125
  var colCount = this.getColumnCount();
28968
- var colIndices = [];
29126
+ var selIndices = [];
28969
29127
  var i;
28970
29128
  for(i = 0; i < colCount; i++) {
28971
29129
  if(this.isSelectedColumn(i)) {
28972
- colIndices.push(i);
29130
+ selIndices.push(i);
29131
+ if(!pair) {
29132
+ pair = [i, -1];
29133
+ }
29134
+ } else if(pair) {
29135
+ pair[1] = i - 1;
29136
+ selRanges.push(pair);
29137
+ pair = null;
28973
29138
  }
28974
29139
  }
29140
+ if(pair) {
29141
+ pair[1] = colCount - 1;
29142
+ selRanges.push(pair);
29143
+ pair = null;
29144
+ }
29145
+
28975
29146
  var arg = {
28976
- selectedColumns: colIndices
29147
+ "selectedColumns": selIndices,
29148
+ "selectionRanges": selRanges
28977
29149
  };
28978
29150
  this._dispatch("beforeColumnBoundUpdate", arg);
28979
29151
 
28980
- var len = this.getColumnCount();
28981
- var lftIdx = -1;
28982
- var rgtIdx = -1;
28983
- for(i = 0; i < len; ++i) {
28984
- if(this.isSelectedColumn(i)) {
28985
- rgtIdx = i;
28986
- if(lftIdx < 0) {
28987
- lftIdx = i;
28988
- }
28989
- }
28990
- }
28991
- var sectCount = this._settings.length;
28992
- if(sectCount) {
28993
- var sectionSetting = this._settings[0];
28994
- var section = sectionSetting.getSection();
29152
+ // Calculate position from ranges
29153
+ var rangeCount = selRanges.length;
29154
+ var posAry = [];
29155
+ var noBorderAry = [];
29156
+ var topSectionSettings = this._settings[0];
29157
+ var section = topSectionSettings.getSection();
29158
+ for(i = 0; i < rangeCount; ++i) {
29159
+ pair = selRanges[i];
28995
29160
  var positions = [0, 0];
28996
29161
  var noBorders = [false, false];
28997
- section.calculateColumnBounds(lftIdx, rgtIdx, positions, noBorders);
28998
- var topPx = 0;
28999
- if(sectionSetting.getType() === "title" && arg.topBoundRowIndex != null) {
29000
- topPx = this._layoutY.getLaneStart(arg.topBoundRowIndex);
29001
- }
29002
- section.updateColumnBounds(positions, noBorders, topPx);
29003
- for(i = 1; i < sectCount; i++) {
29004
- section = this._settings[i].getSection();
29005
- section.updateColumnBounds(positions, noBorders);
29162
+ section.calculateColumnBounds(pair[0], pair[1], positions, noBorders);
29163
+ if(positions[0] < positions[1]) {
29164
+ posAry.push(positions);
29165
+ noBorderAry.push(noBorders);
29006
29166
  }
29007
29167
  }
29168
+
29169
+ // Render column bounds
29170
+ var topPx = 0;
29171
+ var topBoundIdx = -1;
29172
+ if(arg["topBoundRowIndex"] != null) {
29173
+ topBoundIdx = +arg["topBoundRowIndex"];
29174
+ }
29175
+ if(topBoundIdx >= 0 && topSectionSettings.getType() === "title") {
29176
+ topPx = this._layoutY.getLaneStart(topBoundIdx);
29177
+ }
29178
+ section.updateColumnBounds(posAry, noBorderAry, topPx);
29179
+ for(i = 1; i < sectCount; i++) {
29180
+ section = this._settings[i].getSection();
29181
+ section.updateColumnBounds(posAry, noBorderAry);
29182
+ }
29008
29183
  };
29009
29184
 
29010
29185
  /** @public