@refinitiv-ui/efx-grid 6.0.38 → 6.0.39

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.
@@ -398,9 +398,6 @@ ColumnStackPlugin.prototype.config = function (options) {
398
398
  */
399
399
  ColumnStackPlugin.prototype.getConfigObject = function (gridOptions) {
400
400
  var obj = gridOptions || {};
401
- var host = this._host || this._hosts[0];
402
-
403
- var columnOptions = obj["columns"];
404
401
 
405
402
  var stacks = this._groupDefs.getGroupMap();
406
403
  var stackOptions = [];
@@ -409,17 +406,6 @@ ColumnStackPlugin.prototype.getConfigObject = function (gridOptions) {
409
406
  var stackOption = stacks[stackKey];
410
407
  var activeColIndex = this.getColumnIndex(stackOption.activeColumn);
411
408
 
412
- if(columnOptions && columnOptions.length){
413
- var memberIndices = this.getStackMemberIndices(stackOption.id);
414
- for(var i = 0; i < memberIndices.length; i++){
415
- var colIndex = memberIndices[i];
416
- var colOption = columnOptions[colIndex];
417
- if(colOption && host.isColumnVisible(colIndex)){
418
- colOption.hidden = colIndex !== activeColIndex;
419
- }
420
- }
421
- }
422
-
423
409
  var stackConfigObj = {
424
410
  id: stackOption.id
425
411
  };
@@ -532,7 +518,8 @@ ColumnStackPlugin.prototype._applyUserConfigs = function(stacks) {
532
518
  * @return {Object}
533
519
  */
534
520
  ColumnStackPlugin.prototype._getColumnStackOptions = function(colIndex) {
535
- if(colIndex >= 0) {
521
+ var colCount = this.getColumnCount();
522
+ if(colIndex >= 0 && colIndex < colCount) {
536
523
  var colId = this.getColumnId(colIndex);
537
524
  var stack = this._groupDefs.getParentGroup(colId);
538
525
  if(stack) {
@@ -970,30 +957,39 @@ ColumnStackPlugin.prototype.isColumnActive = function(colIndex) {
970
957
  };
971
958
 
972
959
  /** @public
973
- * @param {number} colIndex
960
+ * @param {number|string} colRef Column index, id, or field
974
961
  * @return {string}
975
962
  */
976
- ColumnStackPlugin.prototype.getStackId = function(colIndex) {
977
- var stackOpt = this._getColumnStackOptions(colIndex);
978
- return stackOpt ? stackOpt.id : "";
963
+ ColumnStackPlugin.prototype.getStackId = function(colRef) {
964
+ var colIndex = (typeof colRef === "number") ? colRef : this.getColumnIndex(colRef);
965
+ if(colIndex >= 0) {
966
+ var stackOpt = this._getColumnStackOptions(colIndex);
967
+ if(stackOpt) {
968
+ return stackOpt.id || "";
969
+ }
970
+ }
971
+ return "";
979
972
  };
980
973
  /** @public
981
974
  * @param {Array.<number|string>=} colRefs Names of fields or column indices. If not specified, selected columns will be used.
982
975
  * @param {string=} stackId Must be unique
983
976
  * @param {ColumnStackPlugin~StackConfiguration=} options
984
- * @return {boolean} Return true if all of the given columns is stacked together
977
+ * @return {boolean} Return true if there is any change.
985
978
  */
986
979
  ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
987
- var i, sid;
988
- options = options || {};
980
+ if(!options) {
981
+ options = {};
982
+ }
989
983
 
990
- if(stackId) {
991
- if(this._groupDefs.getGroup(stackId)) {
992
- return false; // Cannot store the same stack Id
984
+ var updateRequired = false;
985
+ var sid = stackId;
986
+ if(sid) {
987
+ if(this._removeStack(sid)) {
988
+ // TODO: pinning state are removed and may need to be kept
989
+ updateRequired = true;
993
990
  }
994
- sid = stackId;
995
991
  } else {
996
- sid = stackId = this._generateStackId();
992
+ sid = this._generateStackId();
997
993
  }
998
994
 
999
995
  if(!colRefs) {
@@ -1002,7 +998,10 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
1002
998
 
1003
999
  var refCount = colRefs ? colRefs.length : 0;
1004
1000
  if(refCount < 2) {
1005
- return false; // Only two or more columns can be stacked
1001
+ if(updateRequired) {
1002
+ this._updateUI();
1003
+ }
1004
+ return updateRequired; // Only two or more columns can be stacked
1006
1005
  }
1007
1006
 
1008
1007
  // Clone user data
@@ -1041,7 +1040,10 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
1041
1040
 
1042
1041
  // Prevent columns already in a stack from moving out to another stack
1043
1042
  if(!this.isColumnStackable(colIndices)) {
1044
- return false;
1043
+ if(updateRequired) {
1044
+ this._updateUI();
1045
+ }
1046
+ return updateRequired;
1045
1047
  }
1046
1048
 
1047
1049
  // TODO: If columns are stored as column id and activeColumn is a field, active index could not be found
@@ -1074,7 +1076,7 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
1074
1076
  var csp = this._getPlugin("ColumnSelectionPlugin");
1075
1077
  if(csp && csp.isEnabled()){
1076
1078
  var stackSelection = false;
1077
- for(i = 0; i < validCount; ++i){
1079
+ for(var i = 0; i < validCount; ++i){
1078
1080
  var colIndex = colIndices[i];
1079
1081
  if(colIndex === activeIndex){
1080
1082
  continue;
@@ -1145,7 +1147,7 @@ ColumnStackPlugin.prototype._verifyColumnPinning = function(stack) {
1145
1147
 
1146
1148
  /** @private
1147
1149
  * @param {number} frozenColIndex
1148
- * @param {number} numRightColumn
1150
+ * @param {number=} numRightColumn
1149
1151
  */
1150
1152
  ColumnStackPlugin.prototype._freezeColumn = function(frozenColIndex, numRightColumn) {
1151
1153
  this._inPinning = true;
@@ -1158,24 +1160,22 @@ ColumnStackPlugin.prototype._freezeColumn = function(frozenColIndex, numRightCol
1158
1160
 
1159
1161
  /** @public
1160
1162
  * @description Replace all of the stacking in the Grid with a new one.
1161
- * Grid stores the stacked fields indefinitely.
1162
- * When adding columns, Grid will attempt to restore stacking
1163
- * if there are at least two visible columns that match to the retained fields.
1163
+ * Grid stores the stacked fields indefinitely.
1164
+ * When adding columns, Grid will attempt to restore stacking,
1165
+ * if there are at least two visible columns that match to the retained fields.
1164
1166
  * @param {Array.<number|string>=} colRefs Field names or column indices
1165
1167
  * @param {number|string=} activeColRef Field names or column index of active column
1166
1168
  * @return {boolean} If the stack has been updated, return true.
1167
1169
  */
1168
1170
  ColumnStackPlugin.prototype.setStack = function(colRefs, activeColRef) {
1169
- var sid = "_uniqueStack"; // WARNING : This hardcode for assign uniqe stacking id
1170
-
1171
1171
  this.removeAllStacks();
1172
1172
 
1173
1173
  var stackOptions = {};
1174
-
1175
1174
  if(activeColRef) {
1176
1175
  stackOptions.activeColumn = activeColRef;
1177
1176
  }
1178
- this.stackColumns(colRefs, sid, stackOptions);
1177
+ // WARNING: Id is hardcoded for assign uniqe stacking id
1178
+ this.stackColumns(colRefs, "_uniqueStack", stackOptions);
1179
1179
 
1180
1180
  return true;
1181
1181
  };
@@ -1280,22 +1280,47 @@ ColumnStackPlugin.prototype.removeAllStacks = function(enableUpdateUI) {
1280
1280
  }
1281
1281
  return groupCount ? true : false;
1282
1282
  };
1283
- /** @public
1283
+ /** If the column is in a stack, the column become an activeColumn of the stack.
1284
+ * @public
1285
+ * @param {number|string} activeColumn Column index, id, or field
1286
+ * @return {boolean}
1287
+ */
1288
+ ColumnStackPlugin.prototype.setActiveColumn = function(activeColumn) {
1289
+ var colIndex = this.getColumnIndex(activeColumn);
1290
+ if(colIndex < 0) {
1291
+ return false;
1292
+ }
1293
+ var colCount = this.getColumnCount();
1294
+ if(colIndex >= colCount) {
1295
+ return false;
1296
+ }
1297
+
1298
+ var colId = this.getColumnId(colIndex);
1299
+ var stack = this._groupDefs.getParentGroup(colId);
1300
+ var field = "";
1301
+ if(!stack) {
1302
+ field = this._getField(colIndex);
1303
+ stack = this._groupDefs.getParentGroup(field);
1304
+ }
1305
+ if(!stack) {
1306
+ return false;
1307
+ }
1308
+ var chdr = stack.children;
1309
+ var memberIndex = field ? chdr.indexOf(field) : chdr.indexOf(colId);
1310
+ if(memberIndex < 0) {
1311
+ return false;
1312
+ }
1313
+ return this._setActiveColumn(stack, chdr[memberIndex]);
1314
+ };
1315
+ /** This method is deprecated in favor of setActiveColumn. Make the specified column switch place with the item in the stack.
1316
+ * @public
1284
1317
  * @param {number|Event} colRef
1285
1318
  * @param {number} swappingIndex
1286
1319
  * @return {boolean}
1320
+ * @see {@link ColumnStackPlugin#setActiveColumn}
1287
1321
  */
1288
1322
  ColumnStackPlugin.prototype.swapColumn = function(colRef, swappingIndex) {
1289
- var colIndex = -1;
1290
- if(typeof colRef == "number") {
1291
- colIndex = colRef;
1292
- } else {
1293
- var grid = this.getRelativeGrid(colRef);
1294
- if(grid) {
1295
- var pos = grid.getRelativePosition(colRef);
1296
- colIndex = pos["colIndex"];
1297
- }
1298
- }
1323
+ var colIndex = (typeof colRef === "number") ? colRef : this.getColumnIndex(colRef);
1299
1324
 
1300
1325
  var stackOpt = this._getColumnStackOptions(colIndex);
1301
1326
  if(!stackOpt) {
@@ -1305,22 +1330,32 @@ ColumnStackPlugin.prototype.swapColumn = function(colRef, swappingIndex) {
1305
1330
  if(!children) {
1306
1331
  return false; // Invalid column type
1307
1332
  }
1308
- var newActiveColumn = children[swappingIndex];
1333
+
1334
+ return this._setActiveColumn(stackOpt, children[swappingIndex]);
1335
+ };
1336
+ /** @private
1337
+ * @param {Object} stack Stack object
1338
+ * @param {string} newActiveColumn Column id or field
1339
+ * @return {boolean}
1340
+ */
1341
+ ColumnStackPlugin.prototype._setActiveColumn = function(stack, newActiveColumn) {
1309
1342
  if(!newActiveColumn) {
1310
- return false; // Invalid selected index
1343
+ return false; // Invalid active column
1311
1344
  }
1312
-
1313
- if(newActiveColumn === stackOpt.activeColumn) {
1345
+ if(newActiveColumn === stack.activeColumn) {
1314
1346
  return false; // The given index is already active stacked column
1315
1347
  }
1316
1348
 
1317
- var prevActiveColumnIndex = this.getColumnIndex(stackOpt.activeColumn);
1349
+ var prevActiveColumnIndex = this.getColumnIndex(stack.activeColumn);
1318
1350
  var newActiveColumnIndex = this.getColumnIndex(newActiveColumn);
1319
- stackOpt.activeColumn = newActiveColumn; // Change active column
1351
+ stack.activeColumn = newActiveColumn; // Change active column
1320
1352
 
1321
1353
  this._setColumnVisibility(newActiveColumnIndex, true);
1322
1354
  this._setColumnVisibility(prevActiveColumnIndex, false); // Hide current active column
1323
1355
 
1356
+ this._updateIcon(prevActiveColumnIndex, stack);
1357
+ this._updateIcon(newActiveColumnIndex, stack);
1358
+
1324
1359
  var csp = this._getPlugin("ColumnSelectionPlugin");
1325
1360
  if(csp && csp.isEnabled()) {
1326
1361
  csp.selectSingleColumn(newActiveColumnIndex);
@@ -1332,11 +1367,6 @@ ColumnStackPlugin.prototype.swapColumn = function(colRef, swappingIndex) {
1332
1367
  if(cfp) {
1333
1368
  cfp["refresh"]();
1334
1369
  }
1335
-
1336
- stackOpt = this._getColumnStackOptions(prevActiveColumnIndex);
1337
- this._updateIcon(prevActiveColumnIndex, stackOpt);
1338
- this._updateIcon(newActiveColumnIndex, stackOpt);
1339
-
1340
1370
  return true;
1341
1371
  };
1342
1372
 
@@ -1740,20 +1770,22 @@ ColumnStackPlugin.prototype.addColumnToStack = function(colRef, stackId) {
1740
1770
  // apply stacking
1741
1771
  this._groupDefs.addGroupChild(stackId, colId);
1742
1772
 
1773
+ // To avoid state interference from Core Grid, keep the pin state before moving the columns
1774
+ var host = this._hosts[0];
1775
+ var leftPinnedIndex = host.getFrozenColumnCount() - 1;
1776
+ var rightPinnedCount = host.getPinnedRightColumnCount();
1777
+ var colIndex = this.getColumnIndex(colId);
1778
+
1743
1779
  // Pack stacked columns together
1744
1780
  this._moveStackedColumns(stack.children);
1745
1781
 
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) {
1782
+ // If an unpinned column is added to a pinned stack, the pinning position should be updated
1783
+ if(stack.leftPinned || stack.rightPinned) {
1784
+ if(stack.leftPinned && colIndex > leftPinnedIndex) {
1753
1785
  leftPinnedIndex++;
1754
1786
  this._freezeColumn(leftPinnedIndex, rightPinnedCount);
1755
- } else if (stack.rightPinned) {
1756
- rightPinnedCount--;
1787
+ } else if(stack.rightPinned && colIndex < (colCount - rightPinnedCount)) {
1788
+ rightPinnedCount++;
1757
1789
  this._freezeColumn(leftPinnedIndex, rightPinnedCount);
1758
1790
  }
1759
1791
  }
@@ -1805,21 +1837,6 @@ ColumnStackPlugin.prototype.removeColumnFromStack = function(colRef) {
1805
1837
 
1806
1838
  this.moveColumnById(colIndex, colIndices[memberCount - 1] + 1); // This assumes that the column order is already in correct position
1807
1839
 
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
-
1823
1840
  this._updateUI();
1824
1841
  };
1825
1842
 
@@ -1930,11 +1947,8 @@ ColumnStackPlugin.prototype.addStackChild = function(stackId, colRef) {
1930
1947
  * @param {number|string} colRef Column field or column index
1931
1948
  */
1932
1949
  ColumnStackPlugin.prototype.removeStackChild = function(stackId, colRef) {
1933
- var colIndex = (typeof colRef === "string") ? this.getColumnIndex(colRef) : colRef;
1934
- if(colIndex >= 0) {
1935
- if(stackId === this.getStackId(colIndex)) {
1936
- this.removeColumnFromStack(colIndex);
1937
- }
1950
+ if(stackId === this.getStackId(colRef)) {
1951
+ this.removeColumnFromStack(colIndex);
1938
1952
  }
1939
1953
  };
1940
1954
  /** @public
@@ -2061,6 +2075,103 @@ ColumnStackPlugin.prototype.moveStack = function(stackId, destCol) {
2061
2075
  return dirty;
2062
2076
  };
2063
2077
 
2078
+ /** @public
2079
+ * @param {string} stackId
2080
+ * @param {string=} side Available values are: left|right. If no value is supplied, all columns will be pinned to the left.
2081
+ */
2082
+ ColumnStackPlugin.prototype.pinStack = function(stackId, side) {
2083
+ if(!stackId) {
2084
+ return;
2085
+ }
2086
+
2087
+ var stack = this._groupDefs.getGroup(stackId);
2088
+ if(!stack) {
2089
+ return;
2090
+ }
2091
+
2092
+ var host = this._hosts[0];
2093
+ var leftPinnedIndex = host.getFrozenColumnCount() - 1;
2094
+ var rightPinnedCount = host.getPinnedRightColumnCount();
2095
+ var colCount = this.getColumnCount();
2096
+ var colList = this.getStackMemberIds(stackId); // WARNING: column ids or fields
2097
+ var len = colList.length;
2098
+
2099
+ var dest;
2100
+ if(side === "right") {
2101
+ if(stack.rightPinned) {
2102
+ return;
2103
+ }
2104
+ if(stack.leftPinned) {
2105
+ this.unpinStack(stackId);
2106
+ leftPinnedIndex = host.getFrozenColumnCount() - 1;
2107
+ }
2108
+ stack.rightPinned = true;
2109
+ dest = colCount - rightPinnedCount;
2110
+ rightPinnedCount = rightPinnedCount + len;
2111
+ } else {
2112
+ if(stack.leftPinned) {
2113
+ return;
2114
+ }
2115
+ if(stack.rightPinned) {
2116
+ this.unpinStack(stackId);
2117
+ rightPinnedCount = host.getPinnedRightColumnCount();
2118
+ }
2119
+ stack.leftPinned = true;
2120
+ dest = leftPinnedIndex === -1 ? 0 : leftPinnedIndex + 1;
2121
+ leftPinnedIndex = leftPinnedIndex + len;
2122
+ }
2123
+
2124
+ this.reorderColumns(colList, dest);
2125
+ this._freezeColumn(leftPinnedIndex, rightPinnedCount);
2126
+ };
2127
+
2128
+ /** @public
2129
+ * @param {string} stackId
2130
+ * @param {(number|string)=} dest The unpinned stack will be placed before the destination position after the operation
2131
+ */
2132
+ ColumnStackPlugin.prototype.unpinStack = function(stackId, dest) {
2133
+ if(!stackId) {
2134
+ return;
2135
+ }
2136
+
2137
+ var stack = this._groupDefs.getGroup(stackId);
2138
+ if(!stack) {
2139
+ return;
2140
+ }
2141
+
2142
+ if(!stack.leftPinned && !stack.rightPinned) {
2143
+ return;
2144
+ }
2145
+
2146
+ var host = this._hosts[0];
2147
+ var leftPinnedCount = host.getFrozenColumnCount();
2148
+ var rightPinnedCount = host.getPinnedRightColumnCount();
2149
+ var colCount = this.getColumnCount();
2150
+ var firstRightPinnedIndex = colCount - rightPinnedCount;
2151
+ var colList = this.getStackMemberIds(stackId); // WARNING: column ids or fields
2152
+ var len = colList.length;
2153
+
2154
+ var destId = null;
2155
+ if(dest != null) {
2156
+ var destIdx = this.getColumnIndex(dest);
2157
+ destId = this.getColumnId(destIdx);
2158
+ }
2159
+
2160
+ if(stack.leftPinned) {
2161
+ stack.leftPinned = false;
2162
+ this.reorderColumns(colList, leftPinnedCount);
2163
+ this._freezeColumn(leftPinnedCount - (1 + len));
2164
+ } else if(stack.rightPinned) {
2165
+ stack.rightPinned = false;
2166
+ this.reorderColumns(colList, firstRightPinnedIndex);
2167
+ this._freezeColumn(leftPinnedCount - 1, rightPinnedCount - len);
2168
+ }
2169
+
2170
+ if(destId != null) {
2171
+ this.reorderColumns(colList, destId);
2172
+ }
2173
+ };
2174
+
2064
2175
 
2065
2176
 
2066
2177
  export default ColumnStackPlugin;
@@ -195,6 +195,10 @@ RowDraggingPlugin.prototype._pos = null;
195
195
  * @private
196
196
  */
197
197
  RowDraggingPlugin.prototype._startingRid = "";
198
+ /** @type {string}
199
+ * @private
200
+ */
201
+ RowDraggingPlugin.prototype._startingRowType = "";
198
202
  /** Core grid instance
199
203
  * @type {Object}
200
204
  * @private
@@ -721,6 +725,9 @@ RowDraggingPlugin.prototype._onDragStart = function (e, fromJET) {
721
725
  var dv = grid.getDataSource();
722
726
  this._startingRid = dv.getRowId(rowIndex);
723
727
  this._startingGrid = grid;
728
+ var api = this.getGridApi();
729
+ var rowType = api.getRowType(rowIndex);
730
+ this._startingRowType = rowType;
724
731
 
725
732
  if (this._dragBoxRenderer) { // For custom drag box rendering
726
733
  var arg = cloneObject(e); // TODO: Check if cloning is necessary
@@ -777,18 +784,21 @@ RowDraggingPlugin.prototype._onMouseMove = function (e) {
777
784
  }
778
785
 
779
786
  this._pos = this._hitTest(e); // A new object is created
787
+ this._pos["dragBox"] = this._dragBox; // assign dragBox for user determine valid target
788
+
789
+ // need to check grid properties because row can be move outside the grid
790
+ if(this._pos["grid"] && this._shouldPreventDrop(this._pos["rowIndex"])) {
791
+ this._pos.dragBoxIcon = "void";
792
+ }
780
793
 
781
794
  var dropable = true;
782
795
  if(this._entryPoint === 'JET' && !this._jetContentHasRic) {
783
796
  dropable = false;
784
797
  }
785
-
786
798
  if(dropable) {
787
799
  this._updateGuidePosition(e);
788
800
  }
789
801
 
790
- this._pos.dragBox = this._dragBox; // assign dragBox for user determine valid target
791
-
792
802
  // Dispatch drag event to let user determine valid drop target using allowDrag (allowDrop) method
793
803
  this._dispatch("drag", this._pos);
794
804
  if(!this._uiDisabled && dropable) {
@@ -1051,6 +1061,10 @@ RowDraggingPlugin.prototype._updateGuidePosition = function (e) {
1051
1061
  if (this._uiDisabled || !pos || pos["invalidTarget"]) {
1052
1062
  return;
1053
1063
  }
1064
+ if(pos["dragBoxIcon"] === "not-allowed" || pos["dragBoxIcon"] === "void" ) {
1065
+ Dom.removeParent(this._guideline);
1066
+ return;
1067
+ }
1054
1068
 
1055
1069
  if (_isInContentSection(pos)) {
1056
1070
  var guideline = this._guideline;
@@ -1087,6 +1101,72 @@ RowDraggingPlugin.prototype._updateGuidePosition = function (e) {
1087
1101
  }
1088
1102
  };
1089
1103
 
1104
+
1105
+ /** @private
1106
+ * @param {string|number} destRowRef
1107
+ * @return {boolean}
1108
+ */
1109
+ RowDraggingPlugin.prototype._shouldPreventDrop = function (destRowRef) {
1110
+
1111
+ var api = this.getGridApi();
1112
+ if(!api) { // It should not move the row if api doesn't initialize
1113
+ return false;
1114
+ }
1115
+
1116
+ if(this._startingRowType === "CONSTITUENT" || this._startingRowType === "SUBGROUP_HEADER") {
1117
+ return true;
1118
+ }
1119
+
1120
+ var grid = this._pos["grid"];
1121
+ var rsp = grid.getPlugin("RowSegmentingPlugin");
1122
+ if(!rsp) { // If row segment extension is not used, row drag and drop will not be protected by default.
1123
+ return false;
1124
+ }
1125
+ var destParentId = rsp.getSegmentParentRowId(destRowRef);
1126
+ var startingParentId = rsp.getSegmentParentRowId(this._startingRid);
1127
+ var destParentType;
1128
+ if(this._startingRowType === "GROUP_MEMBER") {
1129
+ var startingParentType = api.getRowType(startingParentId);
1130
+ if(startingParentType === "SUBGROUP_HEADER") {
1131
+ destParentType = api.getRowType(destParentId);
1132
+
1133
+ if(!startingParentId || !destParentId) {
1134
+ return true;
1135
+ }
1136
+
1137
+ if(destParentId === startingParentId) { // GROUP_MEMBER same parent can be move inside
1138
+ return false;
1139
+ }
1140
+ return true;
1141
+ }
1142
+ // else { } starting have GROUP_HEADER case, it can be move outside the group
1143
+
1144
+ } else if(this._startingRowType === "CHAIN" ) {
1145
+ if(destParentId) { // CHAIN can not move inside the member that have parent
1146
+ return true;
1147
+ }
1148
+ } else if (this._startingRowType === "GROUP_HEADER") {
1149
+ if( destParentId !== startingParentId) { // GROUP_HEADER can't move inside another GROUP or SUBGROUP
1150
+ return true;
1151
+ }
1152
+ }
1153
+
1154
+ var destRowType = api.getRowType(destRowRef);
1155
+ if(destRowType === "CONSTITUENT" || destRowType === "SUBGROUP_HEADER") { // Do not allow dropping this type when starting with any row types
1156
+ return true;
1157
+ }
1158
+
1159
+ if(destRowType === "GROUP_MEMBER") {
1160
+ destParentType = api.getRowType(destParentId);
1161
+ if(destParentType === "SUBGROUP_HEADER") { // Do not allow to drop group member that have parent is SUBGROUP_HEADER
1162
+ return true;
1163
+ }
1164
+ }
1165
+
1166
+ return false;
1167
+
1168
+ };
1169
+
1090
1170
  /** @private */
1091
1171
  RowDraggingPlugin.prototype._clearCache = function () {
1092
1172
  if (this._dragPulseId) {
@@ -968,49 +968,27 @@ RowSelectionPlugin.prototype._getSection = function (sectRef) {
968
968
  * @param {boolean=} preserveAnchor
969
969
  */
970
970
  RowSelectionPlugin.prototype._clearSelectedRows = function (preserveAnchor) { // Slow
971
- var i;
972
- if (this._activeGrid) {
973
- if (this._basedOnContent) {
974
- var dv = this._activeGrid.getDataSource();
975
- if (dv) {
976
- var rids = dv.getVisibleRowIds(true);
977
- var rows = dv.getMultipleRowData(rids);
978
- var valueList = [];
979
- var ridList = [];
980
- var dataRow, firstIndex;
981
- var len = rows.length;
982
- for (i = 0; i < len; i++) {
983
- dataRow = this._rowGetter(rows[i]);
984
- if (dataRow && dataRow[this._selectionField]) {
985
- valueList.push(false);
986
- ridList.push(rids[i]);
987
- if (firstIndex == null) {
988
- firstIndex = i;
989
- }
990
- }
991
- }
992
-
993
- len = valueList.length;
994
- if (len === 1) {
995
- // use setData for better optimization in case update only one row
996
- this._setData(dv, firstIndex, this._selectionField, valueList[0]);
997
- } else if (len > 1) {
998
- this._setColumnData(dv, this._selectionField, valueList, ridList);
999
- }
1000
- }
1001
- } else {
1002
- var sections = this._activeGrid.getAllSections("content");
1003
- for (i = sections.length; --i >= 0;) {
1004
- this._sectionClearSelectedRows(sections[i], preserveAnchor);
1005
- }
971
+ if (!this._activeGrid) {
972
+ return;
973
+ }
974
+ if (this._basedOnContent) {
975
+ var dv = this._activeGrid.getDataSource();
976
+ if (dv) {
977
+ var dt = dv.getDataSource();
978
+ this._setColumnData(dt, this._selectionField, false);
1006
979
  }
1007
-
1008
- if (!preserveAnchor) {
1009
- this._anchorSection = null;
980
+ } else {
981
+ var sections = this._activeGrid.getAllSections("content");
982
+ for (var i = sections.length; --i >= 0;) {
983
+ this._sectionClearSelectedRows(sections[i], preserveAnchor);
1010
984
  }
1011
- this._clearPendingClickIndex(this._activeGrid);
1012
- this._clearMenuIcon();
1013
985
  }
986
+
987
+ if (!preserveAnchor) {
988
+ this._anchorSection = null;
989
+ }
990
+ this._clearPendingClickIndex(this._activeGrid);
991
+ this._clearMenuIcon();
1014
992
  };
1015
993
  /** @private
1016
994
  * @suppress {missingProperties}