@refinitiv-ui/efx-grid 6.0.36 → 6.0.38

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 (31) hide show
  1. package/lib/core/dist/core.js +51 -4
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/grid/Core.d.ts +2 -0
  4. package/lib/core/es6/grid/Core.js +51 -4
  5. package/lib/grid/index.js +1 -1
  6. package/lib/grid/themes/base.less +1 -0
  7. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  8. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  9. package/lib/grid/themes/halo/efx-grid.less +2 -0
  10. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  11. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  12. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  13. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  14. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  15. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  16. package/lib/rt-grid/dist/rt-grid.js +375 -131
  17. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  18. package/lib/rt-grid/es6/FieldDefinition.js +0 -41
  19. package/lib/rt-grid/es6/Grid.d.ts +1 -1
  20. package/lib/rt-grid/es6/Grid.js +63 -29
  21. package/lib/rt-grid/es6/RowDefinition.d.ts +2 -2
  22. package/lib/rt-grid/es6/RowDefinition.js +103 -53
  23. package/lib/tr-grid-cell-selection/es6/CellSelection.js +180 -421
  24. package/lib/tr-grid-column-stack/es6/ColumnStack.js +159 -31
  25. package/lib/tr-grid-util/es6/jet/MockQuotes2.js +7 -0
  26. package/lib/types/es6/ColumnStack.d.ts +1 -0
  27. package/lib/types/es6/Core/grid/Core.d.ts +2 -0
  28. package/lib/types/es6/Core/grid/LayoutGrid.d.ts +4 -0
  29. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -2
  30. package/lib/versions.json +3 -3
  31. package/package.json +1 -1
@@ -44,7 +44,7 @@ import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";
44
44
  * @description Available options describing grouped column displaying
45
45
  * @property {boolean=} spreading=false If specified true, this group will be running in collapsing mode
46
46
  * @property {boolean=} collapsed=true If disabled, this group will be expanded at the first time
47
- * @property {string=} activeColumn="" Column index or field for set as active column
47
+ * @property {string=} activeColumn="" Column index, column id, or field for set as active column
48
48
  */
49
49
 
50
50
  /** @event ColumnStackPlugin#clicked
@@ -95,6 +95,7 @@ var _resolveActiveColumn = function(stackOpt) {
95
95
  var children = stackOpt.children;
96
96
  if(children && children.length) {
97
97
  var activeColumn = stackOpt.activeColumn;
98
+ // TODO: If columns are stored as column id and activeColumn is a field, active index could not be found
98
99
  if(!activeColumn || children.indexOf(activeColumn) < 0) {
99
100
  stackOpt.activeColumn = stackOpt.spreading ? children[children.length - 1] : children[0];
100
101
  return true;
@@ -114,6 +115,7 @@ var ColumnStackPlugin = function () {
114
115
  this._onColumnAdded = this._onColumnAdded.bind(this);
115
116
  this._onBeforeBatchOperation = this._onBeforeBatchOperation.bind(this);
116
117
  this._onAfterBatchOperation = this._onAfterBatchOperation.bind(this);
118
+ this._onPinningChanged = this._onPinningChanged.bind(this);
117
119
 
118
120
  this._onStackButtonClicked = this._onStackButtonClicked.bind(this);
119
121
  this._updateUI = this._updateUI.bind(this);
@@ -158,7 +160,10 @@ ColumnStackPlugin.prototype._inReordering = false;
158
160
  * @private
159
161
  */
160
162
  ColumnStackPlugin.prototype._inResetting = false;
161
-
163
+ /** @type {boolean}
164
+ * @private
165
+ */
166
+ ColumnStackPlugin.prototype._inPinning = false;
162
167
 
163
168
  /** @type {number}
164
169
  * @private
@@ -213,6 +218,7 @@ ColumnStackPlugin.prototype.initialize = function (host, options) {
213
218
  host.listen("columnAdded", this._onColumnAdded);
214
219
  host.listen("beforeBatchOperation", this._onBeforeBatchOperation);
215
220
  host.listen("afterBatchOperation", this._onAfterBatchOperation);
221
+ host.listen("pinningChanged", this._onPinningChanged);
216
222
  }
217
223
  host.listen("preSectionRender", this._onPreSectionRender);
218
224
 
@@ -233,6 +239,7 @@ ColumnStackPlugin.prototype.unload = function (host) {
233
239
  host.unlisten("beforeBatchOperation", this._onBeforeBatchOperation);
234
240
  host.unlisten("afterBatchOperation", this._onAfterBatchOperation);
235
241
  host.unlisten("preSectionRender", this._onPreSectionRender);
242
+ host.unlisten("pinningChanged", this._onPinningChanged);
236
243
 
237
244
  if(this._hosts.length <= 0) {
238
245
  this._conflator.reset();
@@ -547,6 +554,34 @@ ColumnStackPlugin.prototype._getSelectedColumns = function() {
547
554
  var csp = this._getPlugin("ColumnSelectionPlugin");
548
555
  return (csp && csp.isEnabled()) ? csp.getSelectedColumns() : [];
549
556
  };
557
+ /** Hide the specified column to prevent it from flashing when it is added as a member of the stack
558
+ * @private
559
+ * @param {Object} stack
560
+ * @param {(number|Array.<number>)=} colRefs
561
+ * @param {number=} activeRef
562
+ */
563
+ ColumnStackPlugin.prototype._hideStackedColumns = function(stack, colRefs, activeRef) {
564
+ if(stack.spreading && !stack.collapsed) {
565
+ return; // In spreading mode, columns in an expanded stack don't need to be hidden
566
+ }
567
+ // WARNING: activeIndex may not be valid
568
+ var activeIndex = (typeof activeRef === "number") ? activeRef : this.getColumnIndex(stack.activeColumn);
569
+ var colIndices = null;
570
+ if(typeof colRefs === "number") {
571
+ colIndices = [colRefs];
572
+ } else if(colIndices == null) {
573
+ colIndices = this.getColumnIndices(stack.children);
574
+ } else {
575
+ colIndices = colRefs;
576
+ }
577
+ var validCount = colIndices.length;
578
+ for(var i = 0; i < validCount; ++i) {
579
+ var colIndex = colIndices[i];
580
+ if(colIndex !== activeIndex) {
581
+ this._setColumnVisibility(colIndex, false); // Hide a column
582
+ }
583
+ }
584
+ };
550
585
  /** @private
551
586
  * @param {number} colIndex
552
587
  * @param {boolean} shown
@@ -1009,20 +1044,28 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
1009
1044
  return false;
1010
1045
  }
1011
1046
 
1047
+ // TODO: If columns are stored as column id and activeColumn is a field, active index could not be found
1012
1048
  stack.children = children;
1013
- _resolveActiveColumn(stack); // stack.activeColumn may be modified here
1014
- var activeIndex = this.getColumnIndex(stack.activeColumn);
1015
-
1016
- // Hide the column to prevent it from flashing in stack mode
1017
- if(!isSpreading || !isCollapsed) {
1018
- for(i = 0; i < validCount; ++i) {
1019
- var colIndex = colIndices[i];
1020
- if(colIndex !== activeIndex) {
1021
- this._setColumnVisibility(colIndex, false); // Hide a column
1049
+ var activeIndex = -1;
1050
+ if(activeColumn && typeof activeColumn === "string") {
1051
+ activeIndex = this.getColumnIndex(activeColumn);
1052
+ if(children.indexOf(activeColumn) < 0) { // children and activeColumn may have different type
1053
+ var field = this._getField(activeIndex);
1054
+ if(field === activeColumn) {
1055
+ stack.activeColumn = activeColumn = this.getColumnId(activeIndex);
1022
1056
  }
1023
1057
  }
1058
+ } else if(typeof activeColumn === "number"){
1059
+ activeIndex = activeColumn;
1024
1060
  }
1025
1061
 
1062
+ if(_resolveActiveColumn(stack)) {
1063
+ activeColumn = stack.activeColumn;
1064
+ activeIndex = this.getColumnIndex(activeColumn);
1065
+ }
1066
+
1067
+ this._hideStackedColumns(stack, colIndices, activeIndex);
1068
+
1026
1069
  // Make sure that all columns stay packed together
1027
1070
  this.reorderColumns(colIndices, colIndices[0]);
1028
1071
 
@@ -1032,7 +1075,7 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
1032
1075
  if(csp && csp.isEnabled()){
1033
1076
  var stackSelection = false;
1034
1077
  for(i = 0; i < validCount; ++i){
1035
- colIndex = colIndices[i];
1078
+ var colIndex = colIndices[i];
1036
1079
  if(colIndex === activeIndex){
1037
1080
  continue;
1038
1081
  }
@@ -1050,6 +1093,8 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
1050
1093
  }
1051
1094
  }
1052
1095
 
1096
+ this._verifyColumnPinning(stack);
1097
+
1053
1098
  this._groupDefs.setGroup(sid, stack);
1054
1099
 
1055
1100
  var cfp = this._getPlugin("ColumnFilterPlugin");
@@ -1060,6 +1105,57 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
1060
1105
  return true;
1061
1106
  };
1062
1107
 
1108
+ /** @private
1109
+ * @param {Object} stack
1110
+ */
1111
+ ColumnStackPlugin.prototype._verifyColumnPinning = function(stack) {
1112
+ stack.leftPinned = false;
1113
+ stack.rightPinned = false;
1114
+
1115
+ var host = this._hosts[0];
1116
+ var leftPinnedIndex = host.getFrozenColumnCount() - 1;
1117
+ var rightPinnedIndex = host.getFirstPinnedRightIndex();
1118
+ var colCount = this.getColumnCount();
1119
+
1120
+ if (leftPinnedIndex < 0 && rightPinnedIndex === colCount) {
1121
+ return;
1122
+ }
1123
+
1124
+ var colIndices = this.getColumnIndices(stack.children);
1125
+ var min = colIndices[0];
1126
+ var max = colIndices[0];
1127
+ for (var i = 1; i < colIndices.length; i++) {
1128
+ var colIndex = colIndices[i];
1129
+ if (colIndex > max) { max = colIndex; }
1130
+ if (colIndex < min) { min = colIndex; }
1131
+ }
1132
+
1133
+ if (min <= leftPinnedIndex) {
1134
+ stack.leftPinned = true;
1135
+ if (max > leftPinnedIndex) {
1136
+ this._freezeColumn(max, colCount - rightPinnedIndex);
1137
+ }
1138
+ } else if (max >= rightPinnedIndex) {
1139
+ stack.rightPinned = true;
1140
+ if (min < rightPinnedIndex) {
1141
+ this._freezeColumn(leftPinnedIndex, colCount - min);
1142
+ }
1143
+ }
1144
+ };
1145
+
1146
+ /** @private
1147
+ * @param {number} frozenColIndex
1148
+ * @param {number} numRightColumn
1149
+ */
1150
+ ColumnStackPlugin.prototype._freezeColumn = function(frozenColIndex, numRightColumn) {
1151
+ this._inPinning = true;
1152
+ var hosts = this._hosts;
1153
+ for (var i = 0; i < hosts.length; i++) {
1154
+ hosts[i].freezeColumn(frozenColIndex, numRightColumn);
1155
+ }
1156
+ this._inPinning = false;
1157
+ };
1158
+
1063
1159
  /** @public
1064
1160
  * @description Replace all of the stacking in the Grid with a new one.
1065
1161
  * Grid stores the stacked fields indefinitely.
@@ -1270,7 +1366,7 @@ ColumnStackPlugin.prototype._onColumnRemoved = function (e) {
1270
1366
  } else {
1271
1367
  var colData = /** @type{Object} */(e.columnData);
1272
1368
  var field = colData ? colData.field : "";
1273
- stackOpt = this._groupDefs.getParentGroup(fields);
1369
+ stackOpt = this._groupDefs.getParentGroup(field);
1274
1370
  if(stackOpt) {
1275
1371
  colRef = field;
1276
1372
  } else {
@@ -1376,17 +1472,30 @@ ColumnStackPlugin.prototype._onBeforeBatchOperation = function (e) {
1376
1472
  ColumnStackPlugin.prototype._onAfterBatchOperation = function (e) {
1377
1473
  if(e.batchType === "reset") {
1378
1474
  this._inResetting = false;
1379
- // TODO: Re-packing each stack
1475
+ // TODO: Revalidate members in stacks
1476
+ // TODO: Reposition members and stacks
1380
1477
  var groups = this._groupDefs.getGroups();
1381
1478
  var groupCount = groups.length;
1382
1479
  for(var i = 0; i < groupCount; ++i) {
1383
- this._updateActiveColumn(groups[i]);
1480
+ var group = groups[i];
1481
+ this._updateActiveColumn(group);
1482
+ this._hideStackedColumns(group);
1384
1483
  }
1385
1484
  } else if(e.batchType === "move") {
1386
1485
  this._inReordering = false;
1387
1486
  }
1388
1487
  };
1389
-
1488
+ /** @private
1489
+ * @param {Object} e
1490
+ */
1491
+ ColumnStackPlugin.prototype._onPinningChanged = function (e) {
1492
+ if (!this._inPinning) {
1493
+ var stacks = this._groupDefs.getGroups();
1494
+ for (var i = 0; i < stacks.length; i++) {
1495
+ this._verifyColumnPinning(stacks[i]);
1496
+ }
1497
+ }
1498
+ };
1390
1499
  /** @private
1391
1500
  * @param {number} colIndex
1392
1501
  * @return {Object} stackOption
@@ -1410,13 +1519,7 @@ ColumnStackPlugin.prototype._isWithinStack = function (colIndex) {
1410
1519
  ColumnStackPlugin.prototype._addRefToStack = function (stackOption, colIndex) {
1411
1520
  var colId = this._toIdOrField(colIndex);
1412
1521
 
1413
- // Hide the column to prevent it from flashing in stack mode
1414
- if(!stackOption.spreading || !stackOption.collapsed) {
1415
- var activeIndex = this.getColumnIndex(stackOption.activeColumn);
1416
- if(colIndex >= 0 && colIndex !== activeIndex) {
1417
- this._setColumnVisibility(colIndex, false); // Hide a column
1418
- }
1419
- }
1522
+ this._hideStackedColumns(stackOption, colIndex);
1420
1523
 
1421
1524
  // Find a position to be placed in the stack
1422
1525
  var rightColRef = this._toIdOrField(colIndex + 1);
@@ -1443,6 +1546,7 @@ ColumnStackPlugin.prototype._removeRefFromStack = function (stackOption, colRef,
1443
1546
  this._setColumnVisibility(colIndex, true);
1444
1547
  }
1445
1548
  this._updateActiveColumn(stackOption); // This may trigger _updateUI
1549
+
1446
1550
  return true;
1447
1551
  };
1448
1552
 
@@ -1631,14 +1735,7 @@ ColumnStackPlugin.prototype.addColumnToStack = function(colRef, stackId) {
1631
1735
  return;
1632
1736
  }
1633
1737
 
1634
- // Hide the column to prevent it from flashing in stack mode
1635
- if(!stack.spreading || !stack.collapsed) {
1636
- var activeIndex = this.getColumnIndex(stack.activeColumn);
1637
- var colIndex = this.getColumnIndex(colId);
1638
- if(colIndex >= 0 && colIndex !== activeIndex) {
1639
- this._setColumnVisibility(colIndex, false); // Hide a column
1640
- }
1641
- }
1738
+ this._hideStackedColumns(stack, this.getColumnIndex(colId));
1642
1739
 
1643
1740
  // apply stacking
1644
1741
  this._groupDefs.addGroupChild(stackId, colId);
@@ -1646,6 +1743,21 @@ ColumnStackPlugin.prototype.addColumnToStack = function(colRef, stackId) {
1646
1743
  // Pack stacked columns together
1647
1744
  this._moveStackedColumns(stack.children);
1648
1745
 
1746
+ // Update pinning position
1747
+ if (stack.leftPinned || stack.rightPinned) {
1748
+ var host = this._hosts[0];
1749
+ var leftPinnedIndex = host.getFrozenColumnCount() - 1;
1750
+ var rightPinnedCount = host.getPinnedRightColumnCount();
1751
+
1752
+ if (stack.leftPinned) {
1753
+ leftPinnedIndex++;
1754
+ this._freezeColumn(leftPinnedIndex, rightPinnedCount);
1755
+ } else if (stack.rightPinned) {
1756
+ rightPinnedCount--;
1757
+ this._freezeColumn(leftPinnedIndex, rightPinnedCount);
1758
+ }
1759
+ }
1760
+
1649
1761
  this._updateUI();
1650
1762
  };
1651
1763
 
@@ -1692,6 +1804,22 @@ ColumnStackPlugin.prototype.removeColumnFromStack = function(colRef) {
1692
1804
  this._removeRefFromStack(stack, colRef, colIndex);
1693
1805
 
1694
1806
  this.moveColumnById(colIndex, colIndices[memberCount - 1] + 1); // This assumes that the column order is already in correct position
1807
+
1808
+ // Update pinning position
1809
+ if (stack.leftPinned || stack.rightPinned) {
1810
+ var host = this._hosts[0];
1811
+ var leftPinnedIndex = host.getFrozenColumnCount() - 1;
1812
+ var rightPinnedCount = host.getPinnedRightColumnCount();
1813
+
1814
+ if (stack.leftPinned) {
1815
+ leftPinnedIndex--;
1816
+ this._freezeColumn(leftPinnedIndex, rightPinnedCount);
1817
+ } else if (stack.rightPinned) {
1818
+ rightPinnedCount++;
1819
+ this._freezeColumn(leftPinnedIndex, rightPinnedCount);
1820
+ }
1821
+ }
1822
+
1695
1823
  this._updateUI();
1696
1824
  };
1697
1825
 
@@ -556,6 +556,13 @@ MockSubscriptions.prototype._generateQuoteData = function(sub, fields) {
556
556
  values[field] = data.value;
557
557
  values[formattedField] = data.formattedValue;
558
558
  }
559
+
560
+ // The delay symbol for X_RIC_NAME will depend on the INDICATOR field.
561
+ if(values["X_RIC_NAME"] != null && values["INDICATOR"] != null) {
562
+ if(values["INDICATOR"] > 0) {
563
+ values["X_RIC_NAME"] = "/" + values["X_RIC_NAME"];
564
+ }
565
+ }
559
566
  return values;
560
567
  };
561
568
 
@@ -3,6 +3,7 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
3
3
  import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
4
4
  import { Icon } from "../../tr-grid-util/es6/Icon.js";
5
5
  import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
6
+ import { GroupDefinitions } from "../../tr-grid-util/es6/GroupDefinitions.js";
6
7
  import { Dom } from "../../tr-grid-util/es6/Dom.js";
7
8
  import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
8
9
  import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";
@@ -359,6 +359,8 @@ declare class Core extends ElementWrapper {
359
359
 
360
360
  public synchronizeVScrollbar(subGrid: Core|null): void;
361
361
 
362
+ public synchronizeHScrollbar(subGrid: Core|null): void;
363
+
362
364
  public updateRowData(sectionRef?: Core.SectionReference|null, fromRowIndex?: number|null, lastRowIndex?: number|null, userParam?: any): void;
363
365
 
364
366
  public rerender(): void;
@@ -26,7 +26,11 @@ declare class LayoutGrid extends ElementWrapper {
26
26
 
27
27
  public setCellBounds(colIndex: number, rowIndex: number, width: number, height: number): void;
28
28
 
29
+ public updateColumnSeparators(): void;
30
+
29
31
  }
30
32
 
33
+ declare function rgtPx(): void;
34
+
31
35
  export default LayoutGrid;
32
36
  export { LayoutGrid };
@@ -37,7 +37,7 @@ declare class RowDefinition {
37
37
 
38
38
  public initialize(rowOptions?: RowDefinition.Options|null): void;
39
39
 
40
- public setContent(userInput: string, permId?: string|null): boolean;
40
+ public setContent(userInput: string, permId?: string|null, asChain?: boolean|null, expanded?: boolean|null, realTime?: boolean|null): boolean;
41
41
 
42
42
  public getRowId(): string;
43
43
 
@@ -143,7 +143,7 @@ declare const ROW_DEF: string;
143
143
 
144
144
  declare const ROW_TYPES: RowDefinition.RowTypes;
145
145
 
146
- declare function rowData(userInput: string, permId?: string|null): boolean;
146
+ declare function rowData(userInput: string, permId?: string|null, asChain?: boolean|null, expanded?: boolean|null, realTime?: boolean|null): boolean;
147
147
 
148
148
  export {RowDefinition, ROW_DEF, ROW_TYPES};
149
149
  export default RowDefinition;
package/lib/versions.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
- "tr-grid-util": "1.3.103",
2
+ "tr-grid-util": "1.3.104",
3
3
  "@grid/column-dragging": "1.0.13",
4
4
  "@grid/row-segmenting": "1.0.23",
5
5
  "@grid/statistics-row": "1.0.14",
6
6
  "@grid/zoom": "1.0.11",
7
7
  "tr-grid-auto-tooltip": "1.1.5",
8
- "tr-grid-cell-selection": "1.0.32",
8
+ "tr-grid-cell-selection": "1.0.33",
9
9
  "tr-grid-checkbox": "1.0.60",
10
10
  "tr-grid-column-fitter": "1.0.39",
11
11
  "tr-grid-column-formatting": "0.9.34",
12
12
  "tr-grid-column-grouping": "1.0.47",
13
13
  "tr-grid-column-resizing": "1.0.28",
14
14
  "tr-grid-column-selection": "1.0.28",
15
- "tr-grid-column-stack": "1.0.58",
15
+ "tr-grid-column-stack": "1.0.61",
16
16
  "tr-grid-conditional-coloring": "1.0.61",
17
17
  "tr-grid-content-wrap": "1.0.20",
18
18
  "tr-grid-contextmenu": "1.0.38",
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.36"
69
+ "version": "6.0.38"
70
70
  }