@refinitiv-ui/efx-grid 6.0.37 → 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.
@@ -115,6 +115,7 @@ var ColumnStackPlugin = function () {
115
115
  this._onColumnAdded = this._onColumnAdded.bind(this);
116
116
  this._onBeforeBatchOperation = this._onBeforeBatchOperation.bind(this);
117
117
  this._onAfterBatchOperation = this._onAfterBatchOperation.bind(this);
118
+ this._onPinningChanged = this._onPinningChanged.bind(this);
118
119
 
119
120
  this._onStackButtonClicked = this._onStackButtonClicked.bind(this);
120
121
  this._updateUI = this._updateUI.bind(this);
@@ -159,7 +160,10 @@ ColumnStackPlugin.prototype._inReordering = false;
159
160
  * @private
160
161
  */
161
162
  ColumnStackPlugin.prototype._inResetting = false;
162
-
163
+ /** @type {boolean}
164
+ * @private
165
+ */
166
+ ColumnStackPlugin.prototype._inPinning = false;
163
167
 
164
168
  /** @type {number}
165
169
  * @private
@@ -214,6 +218,7 @@ ColumnStackPlugin.prototype.initialize = function (host, options) {
214
218
  host.listen("columnAdded", this._onColumnAdded);
215
219
  host.listen("beforeBatchOperation", this._onBeforeBatchOperation);
216
220
  host.listen("afterBatchOperation", this._onAfterBatchOperation);
221
+ host.listen("pinningChanged", this._onPinningChanged);
217
222
  }
218
223
  host.listen("preSectionRender", this._onPreSectionRender);
219
224
 
@@ -234,6 +239,7 @@ ColumnStackPlugin.prototype.unload = function (host) {
234
239
  host.unlisten("beforeBatchOperation", this._onBeforeBatchOperation);
235
240
  host.unlisten("afterBatchOperation", this._onAfterBatchOperation);
236
241
  host.unlisten("preSectionRender", this._onPreSectionRender);
242
+ host.unlisten("pinningChanged", this._onPinningChanged);
237
243
 
238
244
  if(this._hosts.length <= 0) {
239
245
  this._conflator.reset();
@@ -556,7 +562,7 @@ ColumnStackPlugin.prototype._getSelectedColumns = function() {
556
562
  */
557
563
  ColumnStackPlugin.prototype._hideStackedColumns = function(stack, colRefs, activeRef) {
558
564
  if(stack.spreading && !stack.collapsed) {
559
- return; // In spreading mode, columns in an expanded stack don't need to be hiden
565
+ return; // In spreading mode, columns in an expanded stack don't need to be hidden
560
566
  }
561
567
  // WARNING: activeIndex may not be valid
562
568
  var activeIndex = (typeof activeRef === "number") ? activeRef : this.getColumnIndex(stack.activeColumn);
@@ -1069,7 +1075,7 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
1069
1075
  if(csp && csp.isEnabled()){
1070
1076
  var stackSelection = false;
1071
1077
  for(i = 0; i < validCount; ++i){
1072
- colIndex = colIndices[i];
1078
+ var colIndex = colIndices[i];
1073
1079
  if(colIndex === activeIndex){
1074
1080
  continue;
1075
1081
  }
@@ -1087,6 +1093,8 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
1087
1093
  }
1088
1094
  }
1089
1095
 
1096
+ this._verifyColumnPinning(stack);
1097
+
1090
1098
  this._groupDefs.setGroup(sid, stack);
1091
1099
 
1092
1100
  var cfp = this._getPlugin("ColumnFilterPlugin");
@@ -1097,6 +1105,57 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
1097
1105
  return true;
1098
1106
  };
1099
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
+
1100
1159
  /** @public
1101
1160
  * @description Replace all of the stacking in the Grid with a new one.
1102
1161
  * Grid stores the stacked fields indefinitely.
@@ -1307,7 +1366,7 @@ ColumnStackPlugin.prototype._onColumnRemoved = function (e) {
1307
1366
  } else {
1308
1367
  var colData = /** @type{Object} */(e.columnData);
1309
1368
  var field = colData ? colData.field : "";
1310
- stackOpt = this._groupDefs.getParentGroup(fields);
1369
+ stackOpt = this._groupDefs.getParentGroup(field);
1311
1370
  if(stackOpt) {
1312
1371
  colRef = field;
1313
1372
  } else {
@@ -1426,7 +1485,17 @@ ColumnStackPlugin.prototype._onAfterBatchOperation = function (e) {
1426
1485
  this._inReordering = false;
1427
1486
  }
1428
1487
  };
1429
-
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
+ };
1430
1499
  /** @private
1431
1500
  * @param {number} colIndex
1432
1501
  * @return {Object} stackOption
@@ -1477,6 +1546,7 @@ ColumnStackPlugin.prototype._removeRefFromStack = function (stackOption, colRef,
1477
1546
  this._setColumnVisibility(colIndex, true);
1478
1547
  }
1479
1548
  this._updateActiveColumn(stackOption); // This may trigger _updateUI
1549
+
1480
1550
  return true;
1481
1551
  };
1482
1552
 
@@ -1673,6 +1743,21 @@ ColumnStackPlugin.prototype.addColumnToStack = function(colRef, stackId) {
1673
1743
  // Pack stacked columns together
1674
1744
  this._moveStackedColumns(stack.children);
1675
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
+
1676
1761
  this._updateUI();
1677
1762
  };
1678
1763
 
@@ -1719,6 +1804,22 @@ ColumnStackPlugin.prototype.removeColumnFromStack = function(colRef) {
1719
1804
  this._removeRefFromStack(stack, colRef, colIndex);
1720
1805
 
1721
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
+
1722
1823
  this._updateUI();
1723
1824
  };
1724
1825
 
@@ -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;
@@ -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, asChain?: boolean|null, expanded?: boolean|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, asChain?: boolean|null, expanded?: boolean|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
@@ -5,14 +5,14 @@
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.59",
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.37"
69
+ "version": "6.0.38"
70
70
  }