@refinitiv-ui/efx-grid 6.0.34 → 6.0.35

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.
Files changed (35) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.js +50 -40
  2. package/lib/core/dist/core.js +99 -3
  3. package/lib/core/dist/core.min.js +1 -1
  4. package/lib/core/es6/data/DataTable.d.ts +2 -0
  5. package/lib/core/es6/data/DataTable.js +18 -1
  6. package/lib/core/es6/data/DataView.d.ts +2 -0
  7. package/lib/core/es6/data/DataView.js +11 -0
  8. package/lib/core/es6/grid/Core.d.ts +12 -0
  9. package/lib/core/es6/grid/Core.js +64 -2
  10. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +6 -0
  11. package/lib/grid/index.js +1 -1
  12. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  13. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  14. package/lib/grid/themes/halo/efx-grid.less +1 -1
  15. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  16. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  17. package/lib/rt-grid/dist/rt-grid.js +343 -142
  18. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  19. package/lib/rt-grid/es6/Grid.js +33 -26
  20. package/lib/rt-grid/es6/RowDefSorter.d.ts +5 -5
  21. package/lib/rt-grid/es6/RowDefSorter.js +165 -71
  22. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +66 -0
  23. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +2 -0
  24. package/lib/tr-grid-column-stack/es6/ColumnStack.js +17 -3
  25. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +1 -1
  26. package/lib/tr-grid-row-dragging/es6/RowDragging.js +14 -3
  27. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +3 -2
  28. package/lib/tr-grid-util/es6/DragUI.js +7 -3
  29. package/lib/tr-grid-util/es6/jet/DataGenerator.js +36 -33
  30. package/lib/types/es6/ColumnStack.d.ts +2 -0
  31. package/lib/types/es6/Core/data/DataTable.d.ts +3 -1
  32. package/lib/types/es6/Core/data/DataView.d.ts +2 -0
  33. package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +5 -5
  34. package/lib/versions.json +7 -7
  35. package/package.json +1 -1
@@ -75,11 +75,17 @@ var ColumnDraggingPlugin = function (options) {
75
75
  t._hosts = [];
76
76
 
77
77
  t._guideline = document.createElement("div");
78
- t._guideline.className = "guideline";
79
78
  t._dragBox = document.createElement("div");
80
- t._dragBox.className = "drag-box-disabled"; // defualt disable dragbox
79
+ t._dragBox.classList.add("drag-box-disabled"); // defualt disable dragbox
81
80
  t._dragBoxIcon = document.createElement("ef-icon");
82
- t._dragBoxIcon.className = "drag-box-icon";
81
+ t._dragBoxIcon.classList.add("drag-box-icon");
82
+
83
+ if(ElfUtil.getElfVersion() < 4) {
84
+ t._dragBox.classList.add("tr-dragbox");
85
+ t._guideline.classList.add("tr-guideline");
86
+ } else {
87
+ t._guideline.classList.add("guideline");
88
+ }
83
89
 
84
90
  if(options) {
85
91
  this.config({ "columnDragging": options });
@@ -284,7 +290,8 @@ ColumnDraggingPlugin.prototype.config = function (options) {
284
290
 
285
291
  if (typeof extOptions["dragBoxRenderer"] === "function") {
286
292
  this._dragBoxRenderer = extOptions["dragBoxRenderer"];
287
- this._dragBox.className = "drag-box";
293
+ this._dragBox.classList.add("drag-box");
294
+ this._dragBox.classList.remove("drag-box-disabled");
288
295
  }
289
296
  this.addListener(extOptions, "dragStart");
290
297
  this.addListener(extOptions, "drag");
@@ -607,47 +614,38 @@ ColumnDraggingPlugin.prototype._onDragEnd = function (e) {
607
614
  if (!operationCancelled) {
608
615
  if (!this._noColumnMoving) {
609
616
  var cgp = this._getPlugin("ColumnGroupingPlugin");
617
+ var csp = this._getPlugin("ColumnStackPlugin");
618
+ var destIndex = this._destColumn;
619
+ var groupId, stackId;
620
+
621
+ // Move operation always move to the left of destination column
622
+ // When moving forward, destnation need to added by 1 to move correctly
623
+ if (this._startColumn < this._destColumn) {
624
+ destIndex = this._destColumn + 1;
625
+ }
626
+
627
+ // TODO: support multi column dragging
628
+ if(csp) {
629
+ stackId = csp.getStackId(this._startColumn);
630
+ }
610
631
  if(cgp){
611
632
  var cellInfo = cgp.getCellInfo(this._startPos);
612
- var srcId = cellInfo["groupId"] || cellInfo["columnId"];
613
- var destIndex = this._destColumn;
633
+ groupId = cellInfo["groupId"] || cellInfo["columnId"];
634
+ }
614
635
 
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
- }
636
+ if(stackId && this._startColumn === this._endColumn){
637
+ csp.moveStack(stackId, destIndex);
638
+ } else if(groupId) {
639
+ cgp.moveGroup(groupId, destIndex);
623
640
  } 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
641
+ var colList = [];
642
+ var i;
643
+ for(i = this._startColumn; i <= this._endColumn; i++){
644
+ colList.push(i);
636
645
  }
637
-
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
- }
650
- }
646
+ for(i = this._hosts.length; --i >= 0;) {
647
+ var host = this._hosts[i];
648
+ host.reorderColumns(colList, destIndex);
651
649
  }
652
650
  }
653
651
  }
@@ -756,6 +754,18 @@ ColumnDraggingPlugin.prototype._renderGuideline = function() {
756
754
  var rightHand = this._pos["x"] > colLeft + colWidth / 2;
757
755
  var destColumn = (rightHand) ? colEnd + 1 : colStart;
758
756
 
757
+ var csp = this._getPlugin("ColumnStackPlugin");
758
+ if(csp){
759
+ var stackId = csp.getStackId(destColumn);
760
+ if(stackId){
761
+ var members = csp.getStackMemberIndices(stackId);
762
+ var memberCount = members.length;
763
+ if(members && memberCount){
764
+ destColumn = rightHand ? members[memberCount - 1] + 1 : members[0];
765
+ }
766
+ }
767
+ }
768
+
759
769
  colLeft = this._clickedGrid.getColumnLeft(this._destColumn);
760
770
  // If destination exceeds the specified bounds
761
771
  if (destColumn < this._leftMovableBorder) {
@@ -15676,7 +15676,24 @@ DataTable.prototype.setSortingLogic = function(func) {
15676
15676
  * @param {DataTable.SortLogic} func Use null to remove current sorting logic
15677
15677
  */
15678
15678
  DataTable.prototype.setColumnSortingLogic = function(cid, func) {
15679
- this._compMap[cid] = func;
15679
+ if(cid) {
15680
+ this._compMap[cid] = func;
15681
+ }
15682
+ };
15683
+ /** Get sorting logic for the specified field. Default logic is returned, if no logic is specified for the column
15684
+ * @public
15685
+ * @param {string=} cid
15686
+ * @return {DataTable.SortLogic}
15687
+ */
15688
+ DataTable.prototype.getColumnSortingLogic = function(cid) {
15689
+ if(cid) {
15690
+ var logic = this._compMap[cid];
15691
+ if(logic) {
15692
+ return logic;
15693
+ }
15694
+ }
15695
+
15696
+ return this._compMap["_default"] || null;
15680
15697
  };
15681
15698
 
15682
15699
  /** Freeze data table so that no event is fired for data processing until executing {@link DataTable#unfreeze} method
@@ -19423,6 +19440,17 @@ DataView.prototype.setColumnSortingLogic = function(cid, func) {
19423
19440
  this._dt.setColumnSortingLogic(cid, func);
19424
19441
  }
19425
19442
  };
19443
+ /** Get sorting logic for the specified field. Default logic is returned, if no logic is specified for the column
19444
+ * @public
19445
+ * @param {string=} cid
19446
+ * @return {DataTable.SortLogic}
19447
+ */
19448
+ DataView.prototype.getColumnSortingLogic = function(cid) {
19449
+ if(this._dt) {
19450
+ return this._dt.getColumnSortingLogic(cid);
19451
+ }
19452
+ return null;
19453
+ };
19426
19454
  /** Check if this view is in sorting mode
19427
19455
  * @public
19428
19456
  * @return {boolean}
@@ -25159,6 +25187,7 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
25159
25187
 
25160
25188
  // eslint-disable-line
25161
25189
 
25190
+
25162
25191
  // eslint-disable-line
25163
25192
 
25164
25193
 
@@ -25358,7 +25387,9 @@ var Core_Core = function (opt_initializer) {
25358
25387
  "rowRemoved",
25359
25388
  "columnPositionChanged",
25360
25389
  "rowPositionChanged",
25361
- "beforeColumnBoundUpdate"
25390
+ "beforeColumnBoundUpdate",
25391
+ "beforeBatchOperation",
25392
+ "afterBatchOperation"
25362
25393
  );
25363
25394
 
25364
25395
  // For debugging in advanced optimization mode
@@ -25433,6 +25464,15 @@ Core_Core.SectionReference;
25433
25464
  */
25434
25465
  Core_Core.MouseInfo;
25435
25466
 
25467
+ /** @typedef {Object} Core~BatchInfo
25468
+ * @private
25469
+ * @property {string=} reset //set columns
25470
+ * @property {string=} insertion //add cols
25471
+ * @property {string=} removal //remove cols
25472
+ * @property {string=} moving //reorder
25473
+ */
25474
+ Core_Core.BatchInfo;
25475
+
25436
25476
  /** @typedef {Core.MouseInfo|ElementWrapper|Element} Core~CellReference
25437
25477
  * @description A section in core grid can be refered by the following object <br>
25438
25478
  * `{Core.MouseInfo}` : Object with valid x, y coordinates and section index <br>
@@ -25687,6 +25727,10 @@ Core_Core.prototype._rowHeightTimerId = 0;
25687
25727
  * @private
25688
25728
  */
25689
25729
  Core_Core.prototype._groupDefs = null;
25730
+ /** @type {BatchInfo}
25731
+ * @private
25732
+ */
25733
+ Core_Core.prototype._batches = null;
25690
25734
  //#region Public Methods
25691
25735
 
25692
25736
  /**
@@ -25694,7 +25738,7 @@ Core_Core.prototype._groupDefs = null;
25694
25738
  * @return {string}
25695
25739
  */
25696
25740
  Core_Core.getVersion = function () {
25697
- return "5.1.45";
25741
+ return "5.1.48";
25698
25742
  };
25699
25743
  /** {@link ElementWrapper#dispose}
25700
25744
  * @override
@@ -26633,6 +26677,10 @@ Core_Core.prototype.removeColumnAt = function (index) {
26633
26677
 
26634
26678
  if (this._hasListener("columnRemoved")) {
26635
26679
  var e = {};
26680
+ var batches = this._batches;
26681
+ if(batches){
26682
+ e["batches"] = batches;
26683
+ }
26636
26684
  e["atTheMiddle"] = true;
26637
26685
  e["colIndex"] = index;
26638
26686
  e["columns"] = "deprecated";
@@ -29477,6 +29525,40 @@ Core_Core.prototype.getColumnGroupChildIds = function (groupId) {
29477
29525
  }
29478
29526
  return null;
29479
29527
  };
29528
+
29529
+ /** @public
29530
+ * @param {string} batchType
29531
+ * @return {boolean}
29532
+ * @fires Core#beforeBatchOperation
29533
+ */
29534
+ Core_Core.prototype.startBatch = function (batchType) {
29535
+ if(!batchType){
29536
+ return false;
29537
+ }
29538
+ if(!this._batches){
29539
+ this._batches = {};
29540
+ }
29541
+ this._batches[batchType] = batchType;
29542
+ this._dispatch("beforeBatchOperation", { batches: this._batches, batchType: batchType });
29543
+ return true;
29544
+ };
29545
+ /** @public
29546
+ * @param {string} batchType
29547
+ * @return {boolean}
29548
+ * @fires Core#afterBatchOperation
29549
+ */
29550
+ Core_Core.prototype.stopBatch = function (batchType) {
29551
+ if(!batchType){
29552
+ return false;
29553
+ }
29554
+ this._dispatch("afterBatchOperation", { batches: this._batches, batchType: batchType });
29555
+
29556
+ delete this._batches[batchType];
29557
+ if((0,es6_Util/* isEmptyObject */.Qr)(this._batches)){
29558
+ this._batches = null;
29559
+ }
29560
+ return true;
29561
+ };
29480
29562
  //#endregion Public Methods
29481
29563
 
29482
29564
  //#region Private Methods
@@ -29720,6 +29802,10 @@ Core_Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle
29720
29802
  if (this._hasListener("columnAdded")) {
29721
29803
  var e = {};
29722
29804
  e["atTheMiddle"] = atTheMiddle;
29805
+ var batches = this._batches;
29806
+ if(batches){
29807
+ e["batches"] = batches;
29808
+ }
29723
29809
  if(count === 1) {
29724
29810
  e["colIndex"] = at;
29725
29811
  e["context"] = ctx;
@@ -29871,6 +29957,10 @@ Core_Core.prototype._removeColumn = function (num) { // TODO: change the logic
29871
29957
 
29872
29958
  if (this._hasListener("columnRemoved")) {
29873
29959
  var e = {};
29960
+ var batches = this._batches;
29961
+ if(batches){
29962
+ e["batches"] = batches;
29963
+ }
29874
29964
  for (var c = colCount; --c >= newCount; ) {
29875
29965
  var colDef = removedCols[c - newCount];
29876
29966
  e["colIndex"] = c;
@@ -32395,6 +32485,9 @@ SortableTitlePlugin.prototype._sortDataView = function (opt_action) {
32395
32485
  if (!this._dataSorting) { return; }
32396
32486
 
32397
32487
  var sortCount = this._sortStates.length;
32488
+ if(this._userManagedLogic && sortCount > 1) { // The logic is managed by the user. There is no point in using multi-column sorting
32489
+ sortCount = 1;
32490
+ }
32398
32491
  var orders = null;
32399
32492
  var sortLogics = null;
32400
32493
  var c_ref = null;
@@ -32410,6 +32503,9 @@ SortableTitlePlugin.prototype._sortDataView = function (opt_action) {
32410
32503
  } else {
32411
32504
  c_ref = this.getColumnSortingFields();
32412
32505
  }
32506
+ if(this._userManagedLogic && c_ref.length > 1) {
32507
+ c_ref = c_ref.slice(0, 1);
32508
+ }
32413
32509
  }
32414
32510
 
32415
32511
  // Perform sorting even if there is no sort state