@refinitiv-ui/efx-grid 6.0.91 → 6.0.93

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 (160) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.d.ts +1 -1
  2. package/lib/column-dragging/es6/ColumnDragging.js +144 -34
  3. package/lib/core/dist/core.js +2410 -2621
  4. package/lib/core/dist/core.min.js +1 -1
  5. package/lib/core/es6/data/ColumnStats.js +14 -14
  6. package/lib/core/es6/data/DataCache.js +118 -118
  7. package/lib/core/es6/data/DataTable.d.ts +3 -1
  8. package/lib/core/es6/data/DataTable.js +208 -190
  9. package/lib/core/es6/data/DataView.d.ts +1 -1
  10. package/lib/core/es6/data/DataView.js +291 -291
  11. package/lib/core/es6/data/Segment.js +79 -79
  12. package/lib/core/es6/data/SegmentCollection.js +81 -81
  13. package/lib/core/es6/data/WrappedView.js +41 -41
  14. package/lib/core/es6/grid/Core.js +635 -635
  15. package/lib/core/es6/grid/ILayoutGrid.js +1 -1
  16. package/lib/core/es6/grid/LayoutGrid.js +183 -183
  17. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +91 -91
  18. package/lib/core/es6/grid/components/Cell.js +29 -29
  19. package/lib/core/es6/grid/components/CellFloatingPanel.js +11 -11
  20. package/lib/core/es6/grid/components/CellSpan.js +7 -7
  21. package/lib/core/es6/grid/components/CellSpans.js +36 -34
  22. package/lib/core/es6/grid/components/Column.js +40 -40
  23. package/lib/core/es6/grid/components/ElementWrapper.js +17 -17
  24. package/lib/core/es6/grid/components/HScrollbar.js +31 -31
  25. package/lib/core/es6/grid/components/Scrollbar.js +77 -77
  26. package/lib/core/es6/grid/components/StretchedCells.js +49 -49
  27. package/lib/core/es6/grid/components/VScrollbar.js +11 -11
  28. package/lib/core/es6/grid/components/VirtualItems.js +3 -3
  29. package/lib/core/es6/grid/event/EventDispatcher.js +9 -9
  30. package/lib/core/es6/grid/event/EventListeners.js +4 -4
  31. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +186 -186
  32. package/lib/core/es6/grid/util/Conflator.js +4 -4
  33. package/lib/core/es6/grid/util/Reverter.js +1 -1
  34. package/lib/core/es6/grid/util/SectionSettings.js +20 -20
  35. package/lib/core/es6/grid/util/SelectionList.js +23 -23
  36. package/lib/core/es6/grid/util/TrackLayout.js +74 -74
  37. package/lib/core/es6/grid/util/Virtualizer.js +15 -15
  38. package/lib/core/es6/grid/util/util.js +20 -20
  39. package/lib/core/es6/index.d.ts +0 -2
  40. package/lib/core/es6/index.js +0 -3
  41. package/lib/filter-dialog/lib/filter-dialog.js +1 -0
  42. package/lib/grid/index.js +1 -1
  43. package/lib/rt-grid/dist/rt-grid.js +193 -70
  44. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  45. package/lib/rt-grid/es6/Grid.js +46 -30
  46. package/lib/rt-grid/es6/RowDefinition.d.ts +2 -1
  47. package/lib/rt-grid/es6/RowDefinition.js +74 -16
  48. package/lib/tr-grid-cell-selection/es6/CellSelection.js +56 -1
  49. package/lib/tr-grid-checkbox/es6/Checkbox.js +268 -268
  50. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
  51. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +60 -32
  52. package/lib/tr-grid-column-stack/es6/ColumnStack.js +279 -279
  53. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +227 -207
  54. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +11 -11
  55. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +1 -2
  56. package/lib/tr-grid-row-dragging/es6/RowDragging.js +120 -121
  57. package/lib/tr-grid-util/es6/CellPainter.js +94 -104
  58. package/lib/tr-grid-util/es6/Conflator.js +4 -4
  59. package/lib/tr-grid-util/es6/CoralItems.js +6 -6
  60. package/lib/tr-grid-util/es6/DateTime.js +41 -41
  61. package/lib/tr-grid-util/es6/Deferred.js +5 -5
  62. package/lib/tr-grid-util/es6/Delay.d.ts +3 -3
  63. package/lib/tr-grid-util/es6/Delay.js +14 -3
  64. package/lib/tr-grid-util/es6/Dom.js +26 -26
  65. package/lib/tr-grid-util/es6/DragUI.js +17 -17
  66. package/lib/tr-grid-util/es6/ElementObserver.js +12 -12
  67. package/lib/tr-grid-util/es6/ElementWrapper.js +2 -2
  68. package/lib/tr-grid-util/es6/ElfDate.js +4 -4
  69. package/lib/tr-grid-util/es6/ElfUtil.js +37 -37
  70. package/lib/tr-grid-util/es6/EventDispatcher.js +12 -12
  71. package/lib/tr-grid-util/es6/ExpanderIcon.js +6 -6
  72. package/lib/tr-grid-util/es6/ExpressionParser.js +43 -43
  73. package/lib/tr-grid-util/es6/Ext.js +6 -6
  74. package/lib/tr-grid-util/es6/FieldFormatter.js +17 -17
  75. package/lib/tr-grid-util/es6/FilterBuilder.js +57 -58
  76. package/lib/tr-grid-util/es6/FilterOperators.d.ts +12 -1
  77. package/lib/tr-grid-util/es6/FilterOperators.js +13 -2
  78. package/lib/tr-grid-util/es6/GridPlugin.js +86 -87
  79. package/lib/tr-grid-util/es6/GroupDefinitions.js +90 -90
  80. package/lib/tr-grid-util/es6/Icon.js +4 -4
  81. package/lib/tr-grid-util/es6/MouseDownTrait.js +6 -6
  82. package/lib/tr-grid-util/es6/MultiTableManager.js +71 -80
  83. package/lib/tr-grid-util/es6/NumberFormatter.js +23 -23
  84. package/lib/tr-grid-util/es6/PercentBar.js +17 -17
  85. package/lib/tr-grid-util/es6/Perf.js +5 -5
  86. package/lib/tr-grid-util/es6/Popup.js +42 -42
  87. package/lib/tr-grid-util/es6/RangeBar.js +5 -5
  88. package/lib/tr-grid-util/es6/RequestQueue.js +5 -5
  89. package/lib/tr-grid-util/es6/RowPainter.js +23 -23
  90. package/lib/tr-grid-util/es6/SubTable.js +94 -94
  91. package/lib/tr-grid-util/es6/Table.js +51 -51
  92. package/lib/tr-grid-util/es6/TextHighlighter.js +52 -52
  93. package/lib/tr-grid-util/es6/TickCodes.js +2 -2
  94. package/lib/tr-grid-util/es6/Timer.js +2 -2
  95. package/lib/tr-grid-util/es6/TouchProxy.js +7 -7
  96. package/lib/tr-grid-util/es6/Util.js +50 -50
  97. package/lib/tr-grid-util/es6/formula/ADCService.js +2 -2
  98. package/lib/tr-grid-util/es6/formula/ADCSubscription.js +19 -19
  99. package/lib/tr-grid-util/es6/formula/AdFinService.js +2 -2
  100. package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +19 -19
  101. package/lib/tr-grid-util/es6/formula/Engine.js +56 -56
  102. package/lib/tr-grid-util/es6/formula/Formula.js +62 -62
  103. package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +3 -3
  104. package/lib/tr-grid-util/es6/formula/Realtime.js +15 -15
  105. package/lib/tr-grid-util/es6/formula/RealtimeService.js +15 -15
  106. package/lib/tr-grid-util/es6/formula/TSIService.js +2 -2
  107. package/lib/tr-grid-util/es6/formula/TSISubscription.js +104 -104
  108. package/lib/tr-grid-util/es6/formula/VariableToken.js +20 -20
  109. package/lib/tr-grid-util/es6/formula/functions/AdFin.js +10 -10
  110. package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
  111. package/lib/tr-grid-util/es6/formula/functions/Info.js +2 -2
  112. package/lib/tr-grid-util/es6/formula/functions/Internal.js +5 -5
  113. package/lib/tr-grid-util/es6/formula/functions/Logic.js +5 -5
  114. package/lib/tr-grid-util/es6/formula/functions/Math.js +46 -46
  115. package/lib/tr-grid-util/es6/formula/functions/Statistics.js +27 -27
  116. package/lib/tr-grid-util/es6/formula/functions/Text.js +19 -19
  117. package/lib/tr-grid-util/es6/index.js +1 -1
  118. package/lib/tr-grid-util/es6/jet/Adc.js +36 -36
  119. package/lib/tr-grid-util/es6/jet/CollectionDict.js +11 -11
  120. package/lib/tr-grid-util/es6/jet/DataGenerator.js +95 -95
  121. package/lib/tr-grid-util/es6/jet/DataSet.js +1 -1
  122. package/lib/tr-grid-util/es6/jet/MockArchive.js +5 -5
  123. package/lib/tr-grid-util/es6/jet/MockJET.js +1 -1
  124. package/lib/tr-grid-util/es6/jet/MockQuotes.js +13 -13
  125. package/lib/tr-grid-util/es6/jet/MockQuotes2.js +100 -100
  126. package/lib/tr-grid-util/es6/jet/MockRTK.js +4 -4
  127. package/lib/tr-grid-util/es6/jet/MockUtil.js +2 -2
  128. package/lib/tr-grid-util/es6/jet/index.js +1 -1
  129. package/lib/tr-grid-util/es6/jet/mockDataAPI.js +15 -15
  130. package/lib/tr-grid-util/es6/locale/translation-de.js +1 -1
  131. package/lib/tr-grid-util/es6/locale/translation-en.js +1 -1
  132. package/lib/tr-grid-util/es6/locale/translation-ja.js +1 -1
  133. package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +1 -1
  134. package/lib/tr-grid-util/es6/locale/translation-zh.js +1 -1
  135. package/lib/tr-grid-util/es6/locale/translation.js +1 -1
  136. package/lib/types/es6/ColumnDragging.d.ts +1 -1
  137. package/lib/types/es6/ColumnGrouping.d.ts +3 -1
  138. package/lib/types/es6/Core/data/DataTable.d.ts +4 -0
  139. package/lib/types/es6/Core/data/DataView.d.ts +2 -0
  140. package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
  141. package/lib/types/es6/Core/index.d.ts +0 -2
  142. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -1
  143. package/lib/types/es6/RowDragging.d.ts +1 -2
  144. package/lib/versions.json +12 -12
  145. package/package.json +1 -1
  146. package/lib/core/es6/grid/util/ElementFrameWork.d.ts +0 -18
  147. package/lib/core/es6/grid/util/ElementFrameWork.js +0 -227
  148. package/lib/core/es6/grid/util/HttpRequest.d.ts +0 -53
  149. package/lib/core/es6/grid/util/HttpRequest.js +0 -371
  150. package/lib/core/es6/grid/util/PercentBar.d.ts +0 -43
  151. package/lib/core/es6/grid/util/PercentBar.js +0 -390
  152. package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +0 -41
  153. package/lib/core/es6/grid/util/PercentBarRenderer.js +0 -316
  154. package/lib/core/es6/grid/util/RangeBar.d.ts +0 -25
  155. package/lib/core/es6/grid/util/RangeBar.js +0 -255
  156. package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +0 -18
  157. package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +0 -53
  158. package/lib/types/es6/Core/grid/util/PercentBar.d.ts +0 -43
  159. package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +0 -41
  160. package/lib/types/es6/Core/grid/util/RangeBar.d.ts +0 -25
@@ -2,7 +2,7 @@ import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
2
  import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";
3
3
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
4
4
  import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
5
- import { cloneObject } from "../../tr-grid-util/es6/Util.js";
5
+ import { cloneObject, deepEqual, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
6
6
  import { DragUI } from "../../tr-grid-util/es6/DragUI.js";
7
7
 
8
8
  declare namespace ColumnDraggingPlugin {
@@ -2,7 +2,7 @@ import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
2
  import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";
3
3
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
4
4
  import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
5
- import { cloneObject } from "../../tr-grid-util/es6/Util.js";
5
+ import { cloneObject, deepEqual, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
6
6
  import { DragUI } from "../../tr-grid-util/es6/DragUI.js";
7
7
 
8
8
  /** @typedef {Object} ColumnDraggingPlugin~Options
@@ -264,10 +264,40 @@ ColumnDraggingPlugin.prototype.unload = function (host) {
264
264
  /** @private
265
265
  */
266
266
  ColumnDraggingPlugin.prototype._onThemeLoaded = function() {
267
- var colors = ElfUtil.getColors();
267
+ if(!ColumnDraggingPlugin._styles) {
268
+ let styles = [
269
+ ".multi-column-drag-indicator .section.title .cover-layer .column-bound.selection-bound ", [
270
+ "border-top: var(--grid-drag-indicator);",
271
+ "border-right: var(--grid-drag-indicator);",
272
+ "border-left: var(--grid-drag-indicator);"
273
+ ],
274
+ ".multi-column-drag-indicator .sections .cover-layer .column-bound.selection-bound ", [
275
+ "border-right: var(--grid-drag-indicator);",
276
+ "border-left: var(--grid-drag-indicator);",
277
+ "border-bottom: var(--grid-drag-indicator);"
278
+ ]
279
+ ];
280
+ ColumnDraggingPlugin._styles = prettifyCss(styles);
281
+ }
282
+
283
+ let colors = ElfUtil.getColors();
268
284
  this._dragUI.onThemeLoaded(colors); // TODO : onThemeLoaded should be static function like DragUI.applyThemeColor
269
- for(var i = this._hosts.length; --i >= 0;) {
270
- DragUI.applyThemeColor(this._hosts[i]);
285
+ for(let i = this._hosts.length; --i >= 0;) {
286
+ let host = this._hosts[i];
287
+ ColumnDraggingPlugin._applyThemeColor(host);
288
+ DragUI.applyThemeColor(host);
289
+ }
290
+ };
291
+ /** @private
292
+ * @param {Object} grid core grid instance
293
+ */
294
+ ColumnDraggingPlugin._applyThemeColor = function(grid) {
295
+ if(!grid || grid._columnDraggingStyles) {
296
+ return;
297
+ }
298
+ if(ColumnDraggingPlugin._styles) {
299
+ grid._columnDraggingStyles = true; // Prevent loading the same style twice
300
+ injectCss(ColumnDraggingPlugin._styles, grid.getParent());
271
301
  }
272
302
  };
273
303
 
@@ -500,6 +530,38 @@ ColumnDraggingPlugin.prototype._onMouseUp = function (e) {
500
530
  }
501
531
  };
502
532
 
533
+ /** @private
534
+ * @return {number} 0 does not allow dragging, 1 allows single dragging, and 2 allows multiple dragging.
535
+ */
536
+ ColumnDraggingPlugin.prototype._getDraggingStyle = function() {
537
+ let colSelExt = this._getPlugin("ColumnSelectionPlugin");
538
+ let cgp = this._getPlugin("ColumnGroupingPlugin");
539
+ if(!cgp) {
540
+ return 1;
541
+ }
542
+ let selectedCols = colSelExt.getSelectedColumns();
543
+ let dragOutSel = selectedCols.indexOf(this._startColumn) === -1;
544
+ if(dragOutSel) { // no column grouping, allow to drag
545
+ return 1;
546
+ }
547
+ let selectedColCount = selectedCols.length;
548
+ if(selectedColCount > 1) { // Multiple column drag
549
+ let currentGroup, prevGroup;
550
+ for (let i = 0; i < selectedColCount; i++) {
551
+ let colIndex = selectedCols[i];
552
+ currentGroup = cgp.getGroupIds(colIndex) || []; // empty array is root group
553
+ if(prevGroup && !deepEqual(currentGroup, prevGroup)) {
554
+ if(cgp.getMutualGroupId(selectedCols)) { // Dragging a group inside another group is permitted only when the group being dragged is the same parent group
555
+ return 2;
556
+ }
557
+ return 0; // Drag with difference group is not allowed
558
+ } // else {} // Drag with same group is allowed
559
+ prevGroup = currentGroup;
560
+ }
561
+ }
562
+ return 2;
563
+ };
564
+
503
565
  /** @private
504
566
  * @param {*} e
505
567
  */
@@ -509,7 +571,12 @@ ColumnDraggingPlugin.prototype._onDragStart = function (e) {
509
571
  this._dispatch("dragStart", this._pos);
510
572
  }
511
573
 
512
- if (this._pos["cancel"]) {
574
+ if (this._pos["cancel"]) { // user cancel drag start
575
+ return;
576
+ }
577
+
578
+ let dragStyles = this._getDraggingStyle();
579
+ if (!dragStyles) { // not allow to drag
513
580
  return;
514
581
  }
515
582
 
@@ -557,7 +624,11 @@ ColumnDraggingPlugin.prototype._onDragStart = function (e) {
557
624
  };
558
625
  this._dragBoxRenderer(arg);
559
626
  }
560
- this._dimCol(true);
627
+ if(dragStyles > 1 ) {
628
+ gridElem.parentNode.classList.add("multi-column-drag-indicator");
629
+ } else if(dragStyles === 1) {
630
+ this._dimCol(true); // Single drag
631
+ } // else {} // no need to handled drag 0 column
561
632
  this._renderGuideline();
562
633
 
563
634
  // For step scrolling // TODO: Merge this logic with DraggableContentPlugin
@@ -621,6 +692,7 @@ ColumnDraggingPlugin.prototype._onDragEnd = function (e) {
621
692
  pn.removeChild(this._dragBox);
622
693
  }
623
694
  this._clickedGrid.getElement().parentNode.classList.remove("mouse-dragging"); // retain mouse cursor
695
+ this._clickedGrid.getElement().parentNode.classList.remove("multi-column-drag-indicator");
624
696
 
625
697
  window.removeEventListener("mousemove", this._onDrag, false);
626
698
  window.removeEventListener("mouseup", this._onDragEnd, true);
@@ -668,41 +740,24 @@ ColumnDraggingPlugin.prototype._onDragEnd = function (e) {
668
740
 
669
741
  if (!operationCancelled) {
670
742
  if (!this._noColumnMoving) {
671
- var cgp = this._getPlugin("ColumnGroupingPlugin");
672
- var csp = this._getPlugin("ColumnStackPlugin");
673
- var destIndex = this._destColumn;
674
- var groupId, stackId;
675
-
743
+ let colSelExt = this._getPlugin("ColumnSelectionPlugin");
744
+ let selectedCols;
745
+ if(colSelExt) {
746
+ selectedCols = colSelExt.getSelectedColumns();
747
+ }
748
+ if(!colSelExt || !selectedCols.length || selectedCols.indexOf(this._startColumn) === -1) {
749
+ // No selected column or move column outside selected column, tried to move only _startColumn
750
+ selectedCols = [this._startColumn];
751
+ }
752
+ let destIndex = this._destColumn;
676
753
  // Move operation always move to the left of destination column
677
754
  // When moving forward, destnation need to added by 1 to move correctly
678
755
  if (this._startColumn < this._destColumn) {
679
756
  destIndex = this._destColumn + 1;
680
757
  }
681
758
 
682
- // TODO: support multi column dragging
683
- if(csp) {
684
- stackId = csp.getStackId(this._startColumn);
685
- }
686
- if(cgp){
687
- var cellInfo = cgp.getCellInfo(this._startPos);
688
- groupId = cellInfo["groupId"] || cellInfo["columnId"];
689
- }
759
+ this._moveColumns(selectedCols, destIndex);
690
760
 
691
- if(stackId && this._startColumn === this._endColumn){
692
- csp.moveStack(stackId, destIndex);
693
- } else if(groupId) {
694
- cgp.moveGroup(groupId, destIndex);
695
- } else {
696
- var colList = [];
697
- var i;
698
- for(i = this._startColumn; i <= this._endColumn; i++){
699
- colList.push(i);
700
- }
701
- for(i = this._hosts.length; --i >= 0;) {
702
- var host = this._hosts[i];
703
- host.reorderColumns(colList, destIndex);
704
- }
705
- }
706
761
  }
707
762
 
708
763
  if (this.hasListener("columnMoved")) {
@@ -719,6 +774,61 @@ ColumnDraggingPlugin.prototype._onDragEnd = function (e) {
719
774
  this._clearCache();
720
775
  };
721
776
 
777
+ /** @private
778
+ * @param {Array<number>} srcColIndices
779
+ * @param {number} destColumnIndex
780
+ */
781
+ ColumnDraggingPlugin.prototype._moveColumns = function (srcColIndices, destColumnIndex) {
782
+ let srcCount = srcColIndices.length;
783
+ let colList = [];
784
+ let csp = this._getPlugin("ColumnStackPlugin");
785
+ let stackId, groupId;
786
+ if(srcCount === 1) {
787
+ if(csp) {
788
+ stackId = csp.getStackId(this._startColumn);
789
+ }
790
+ let cgp = this._getPlugin("ColumnGroupingPlugin");
791
+ if(cgp){
792
+ var cellInfo = cgp.getCellInfo(this._startPos);
793
+ groupId = cellInfo["groupId"] || cellInfo["columnId"];
794
+ }
795
+
796
+ if(stackId && this._startColumn === this._endColumn){
797
+ csp.moveStack(stackId, destColumnIndex);
798
+ } else if(groupId) {
799
+ cgp.moveGroup(groupId, destColumnIndex);
800
+ } else {
801
+ for(let i = this._startColumn; i <= this._endColumn; i++){
802
+ colList.push(i);
803
+ }
804
+ }
805
+ } else {
806
+ let stacking = {}; // Object to optimize call column stack api repeatly
807
+ for (let i = 0; i < srcCount; i++) {
808
+ let srcIdx = srcColIndices[i];
809
+ let srcId = this.getColumnId(srcIdx);
810
+
811
+ if(csp) {
812
+ stackId = csp.getStackId(srcIdx);
813
+ }
814
+ if(stackId && !stacking[stackId]) {
815
+ stacking[stackId] = true; // optimize column same stack
816
+ let stackMemberIds = csp.getStackMemberIds(stackId);
817
+ for (let j = 0; j < stackMemberIds.length; j++) {
818
+ let colId = stackMemberIds[j];
819
+ colList.push(colId);
820
+ }
821
+ } else {
822
+ colList.push(srcId); // Normal case
823
+ }
824
+ }
825
+ }
826
+ for(let i = this._hosts.length; --i >= 0;) {
827
+ var host = this._hosts[i];
828
+ host.reorderColumns(colList, destColumnIndex);
829
+ }
830
+ };
831
+
722
832
  /** @private
723
833
  */
724
834
  ColumnDraggingPlugin.prototype._onDragPulse = function() {