@refinitiv-ui/efx-grid 6.0.20 → 6.0.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.js +46 -24
  2. package/lib/core/dist/core.js +61 -14
  3. package/lib/core/dist/core.min.js +1 -1
  4. package/lib/core/es6/grid/Core.js +11 -1
  5. package/lib/core/es6/grid/LayoutGrid.js +1 -0
  6. package/lib/core/es6/grid/components/CellSpans.d.ts +2 -0
  7. package/lib/core/es6/grid/components/CellSpans.js +35 -10
  8. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +2 -0
  9. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +14 -3
  10. package/lib/grid/index.js +1 -1
  11. package/lib/rt-grid/dist/rt-grid.js +362 -41
  12. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  13. package/lib/rt-grid/es6/Grid.d.ts +10 -1
  14. package/lib/rt-grid/es6/Grid.js +196 -17
  15. package/lib/rt-grid/es6/ReferenceCounter.js +13 -2
  16. package/lib/rt-grid/es6/RowDefinition.d.ts +2 -0
  17. package/lib/rt-grid/es6/RowDefinition.js +74 -8
  18. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +9 -5
  19. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +365 -133
  20. package/lib/tr-grid-column-resizing/es6/ColumnResizing.js +11 -37
  21. package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +15 -15
  22. package/lib/tr-grid-row-selection/es6/RowSelection.js +9 -1
  23. package/lib/types/es6/ColumnGrouping.d.ts +9 -5
  24. package/lib/types/es6/Core/grid/components/CellSpans.d.ts +2 -0
  25. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +2 -0
  26. package/lib/types/es6/RealtimeGrid/Grid.d.ts +10 -1
  27. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -0
  28. package/lib/types/es6/RowSelection.d.ts +15 -15
  29. package/lib/versions.json +4 -4
  30. package/package.json +6 -2
@@ -128,6 +128,10 @@ ColumnDraggingPlugin.prototype._dragPulseId = 0;
128
128
  */
129
129
  ColumnDraggingPlugin.prototype._pos = null; // Cache of current mouse position
130
130
  /** @private
131
+ * @type {Object}
132
+ */
133
+ ColumnDraggingPlugin.prototype._startPos = null; // Cache of start column position
134
+ /** @private
131
135
  * @type {number}
132
136
  */
133
137
  ColumnDraggingPlugin.prototype._cacheLeft = 0;
@@ -413,6 +417,7 @@ ColumnDraggingPlugin.prototype._onMouseDown = function (e) {
413
417
  this._clickedSection = section;
414
418
  this._clickedRow = rowIndex;
415
419
 
420
+ this._startPos = this._pos;
416
421
  this._startColumn = movingColumns["left"];
417
422
  this._endColumn = movingColumns["right"];
418
423
  this._leftMovableBorder = movableBorder["left"];
@@ -601,31 +606,47 @@ ColumnDraggingPlugin.prototype._onDragEnd = function (e) {
601
606
 
602
607
  if (!operationCancelled) {
603
608
  if (!this._noColumnMoving) {
604
- var shiftStart = -1;
605
- var shiftEnd = -1;
606
- var moveSize = -1;
607
- if (this._startColumn > this._destColumn) { //Move backward
608
- shiftStart = this._destColumn;
609
- shiftEnd = this._startColumn - 1;
610
- moveSize = -1 * (this._startColumn - this._destColumn); //Move to the left
611
- } else
612
- if (this._startColumn < this._destColumn) { //Move foward
613
- shiftStart = this._endColumn + 1;
614
- shiftEnd = this._destColumn;
615
- moveSize = ((shiftEnd - shiftStart) + 1); //Move to the right
616
- }
609
+ var cgp = this._getPlugin("ColumnGroupingPlugin");
610
+ if(cgp){
611
+ var cellInfo = cgp.getCellInfo(this._startPos);
612
+ var srcId = cellInfo["groupId"] || cellInfo["columnId"];
613
+ var destIndex = this._destColumn;
614
+
615
+ // Move group always move to the left of destination
616
+ // When moving forward, destnation need to added by 1 to move correctly
617
+ if (this._startColumn < this._destColumn) {
618
+ destIndex = this._destColumn + 1;
619
+ }
620
+ if(srcId){
621
+ cgp.moveGroup(srcId, destIndex);
622
+ }
623
+ } else {
624
+ var shiftStart = -1;
625
+ var shiftEnd = -1;
626
+ var moveSize = -1;
627
+ if (this._startColumn > this._destColumn) { //Move backward
628
+ shiftStart = this._destColumn;
629
+ shiftEnd = this._startColumn - 1;
630
+ moveSize = -1 * (this._startColumn - this._destColumn); //Move to the left
631
+ } else
632
+ if (this._startColumn < this._destColumn) { //Move foward
633
+ shiftStart = this._endColumn + 1;
634
+ shiftEnd = this._destColumn;
635
+ moveSize = ((shiftEnd - shiftStart) + 1); //Move to the right
636
+ }
617
637
 
618
- //Perform moving all columns in the range
619
- for(var j = this._hosts.length; --j >= 0;) {
620
- var host = this._hosts[j];
621
- var i;
622
- if (moveSize > 0) { //Move forward
623
- for (i = this._startColumn; i <= this._endColumn; i++) {
624
- host.moveColumn(this._startColumn, this._destColumn);
625
- }
626
- } else { //Move backward
627
- for (i = this._startColumn; i <= this._endColumn; i++) {
628
- host.moveColumn(this._startColumn + (i - this._startColumn), this._destColumn + (i - this._startColumn));
638
+ //Perform moving all columns in the range
639
+ for(var j = this._hosts.length; --j >= 0;) {
640
+ var host = this._hosts[j];
641
+ var i;
642
+ if (moveSize > 0) { //Move forward
643
+ for (i = this._startColumn; i <= this._endColumn; i++) {
644
+ host.moveColumn(this._startColumn, this._destColumn);
645
+ }
646
+ } else { //Move backward
647
+ for (i = this._startColumn; i <= this._endColumn; i++) {
648
+ host.moveColumn(this._startColumn + (i - this._startColumn), this._destColumn + (i - this._startColumn));
649
+ }
629
650
  }
630
651
  }
631
652
  }
@@ -673,6 +694,7 @@ ColumnDraggingPlugin.prototype._onDragPulse = function() {
673
694
  */
674
695
  ColumnDraggingPlugin.prototype._clearCache = function() {
675
696
  this._startColumn = this._endColumn = this._destColumn = -1;
697
+ this._startPos = null;
676
698
 
677
699
  this._leftMovableBorder = this._rightMovableBorder = -1;
678
700
 
@@ -5272,6 +5272,33 @@ CellSpans.prototype.removeColumn = function (at) { // Use when a column is remov
5272
5272
  }
5273
5273
  return dirty;
5274
5274
  };
5275
+ /** @public
5276
+ * @param {boolean=} bool
5277
+ */
5278
+ CellSpans.prototype.freezeMapping = function (bool) {
5279
+ this._frozenMapping = bool !== false;
5280
+ if(!this._frozenMapping) {
5281
+ this._mapCellSpans();
5282
+ }
5283
+ };
5284
+
5285
+
5286
+ /** @private
5287
+ */
5288
+ CellSpans.prototype._mapCellSpans = function () {
5289
+ var cellSpans = this._spans;
5290
+ this._spans = [];
5291
+ this._occupiedMap = {};
5292
+ var i, cellSpan;
5293
+ for(i = cellSpans.length; --i >= 0;) {
5294
+ cellSpan = cellSpans[i];
5295
+ if(cellSpan.indexX >= 0) {
5296
+ cellSpan.register(this._spans, this._occupiedMap);
5297
+ }
5298
+ }
5299
+ };
5300
+
5301
+
5275
5302
  /** @public
5276
5303
  * @param {number} from
5277
5304
  * @param {number} amount This can be negative number
@@ -5288,18 +5315,10 @@ CellSpans.prototype.shiftColumn = function (from, amount) { // Use when a column
5288
5315
  cellSpan.indexX += amount;
5289
5316
  }
5290
5317
  }
5291
- if(!dirty) { return false; }
5318
+ if(!dirty || this._frozenMapping) { return false; }
5292
5319
 
5293
5320
  // Re-registers all cellspans. Some of the cellspans may be lost due to shifting
5294
- var cellSpans = this._spans;
5295
- this._spans = [];
5296
- this._occupiedMap = {};
5297
- for(i = cellSpans.length; --i >= 0;) {
5298
- cellSpan = cellSpans[i];
5299
- if(cellSpan.indexX >= 0) {
5300
- cellSpan.register(this._spans, this._occupiedMap);
5301
- }
5302
- }
5321
+ this._mapCellSpans();
5303
5322
  return true;
5304
5323
  };
5305
5324
  /** @public
@@ -5588,6 +5607,12 @@ CellSpans.prototype._spans;
5588
5607
  */
5589
5608
  CellSpans.prototype._occupiedMap;
5590
5609
 
5610
+ /**
5611
+ * @private
5612
+ * @type {boolean}
5613
+ */
5614
+ CellSpans.prototype._frozenMapping = false;
5615
+
5591
5616
  /* harmony default export */ const components_CellSpans = (CellSpans);
5592
5617
 
5593
5618
 
@@ -9341,6 +9366,7 @@ LayoutGrid.prototype.setFrozenLayout = function (bool) {
9341
9366
  if (this._frozenLayout !== bool) {
9342
9367
  this._frozenLayout = bool;
9343
9368
 
9369
+ this._cellSpans.freezeMapping(this._frozenLayout);
9344
9370
  if (!this._frozenLayout) {
9345
9371
  this._syncLayoutToColumns(0);
9346
9372
  this._syncLayoutToRows(0, this._rowCount);
@@ -24225,7 +24251,7 @@ Core_Core.prototype._rowHeightTimerId = 0;
24225
24251
  * @return {string}
24226
24252
  */
24227
24253
  Core_Core.getVersion = function () {
24228
- return "5.1.31";
24254
+ return "5.1.32";
24229
24255
  };
24230
24256
  /** {@link ElementWrapper#dispose}
24231
24257
  * @override
@@ -26577,6 +26603,13 @@ Core_Core.prototype.freezeLayout = function (opt_bool) {
26577
26603
  if (prevState !== opt_bool) {
26578
26604
  this._frozenLayout = opt_bool;
26579
26605
 
26606
+ var stp = this.getPlugin("SortableTitlePlugin");
26607
+ if(this._frozenLayout) {
26608
+ if(stp) {
26609
+ stp.freezeIndicator(true);
26610
+ }
26611
+ }
26612
+
26580
26613
  if (!this._frozenLayout) {
26581
26614
  // Width has not yet changed so we need to disable it first
26582
26615
  this._disableEvent("widthChanged");
@@ -26605,6 +26638,9 @@ Core_Core.prototype.freezeLayout = function (opt_bool) {
26605
26638
  if(!viewChanged) { // Always update virtualizer
26606
26639
  this._rowVirtualizer.update(true); // Force section activation
26607
26640
  }
26641
+ if(stp) {
26642
+ stp.freezeIndicator(false);
26643
+ }
26608
26644
  }
26609
26645
  this._rowHeightSync = true;
26610
26646
  }
@@ -29252,6 +29288,10 @@ SortableTitlePlugin.prototype._userManagedLogic = false;
29252
29288
  * @type {boolean}
29253
29289
  */
29254
29290
  SortableTitlePlugin.prototype._disabled = false;
29291
+ /** @private
29292
+ * @type {boolean}
29293
+ */
29294
+ SortableTitlePlugin.prototype._frozenIndicator = false;
29255
29295
  /** Since DataView in real-time grid has only one ROW_DEF column, we need to re-map sorting field to sort correctly.
29256
29296
  * @private
29257
29297
  * @type {boolean}
@@ -29810,8 +29850,9 @@ SortableTitlePlugin.prototype.sortColumns = function (sortOptions, opt_arg) {
29810
29850
  * @param {Object=} opt_arg Event argument to be sent with preDataSorting event
29811
29851
  */
29812
29852
  SortableTitlePlugin.prototype.clearSortState = function (opt_arg) {
29813
- this._popSortState(0, opt_arg);
29814
- this.updateSortSymbols();
29853
+ if(this._popSortState(0, opt_arg)) {
29854
+ this.updateSortSymbols();
29855
+ }
29815
29856
  };
29816
29857
  /** @description Perform sorting with the same parameter.
29817
29858
  * @public
@@ -30016,6 +30057,12 @@ SortableTitlePlugin.prototype.disableTwoStateSorting = function (disabled) {
30016
30057
 
30017
30058
  };
30018
30059
  /** @public
30060
+ * @param {boolean=} bool=true, if set to false it will be unfreeze indicator
30061
+ */
30062
+ SortableTitlePlugin.prototype.freezeIndicator = function (bool) {
30063
+ this._frozenIndicator = bool !== false;
30064
+ };
30065
+ /** @public
30019
30066
  * @param {boolean=} disabled
30020
30067
  */
30021
30068
  SortableTitlePlugin.prototype.disableSortSymbols = function (disabled) {
@@ -30628,7 +30675,7 @@ SortableTitlePlugin.prototype._clearSortSymbols = function (state) {
30628
30675
  SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
30629
30676
  var t = this;
30630
30677
  var host = t._hosts[hostIndex];
30631
- if (!host) { return; }
30678
+ if (!host || this._frozenIndicator) { return; }
30632
30679
 
30633
30680
  var section = host.getSection("title");
30634
30681
  if (section == null) { return; }