@refinitiv-ui/efx-grid 6.0.40 → 6.0.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +2 -1
  2. package/lib/column-selection-dialog/lib/column-selection-dialog.js +23 -7
  3. package/lib/core/dist/core.js +846 -881
  4. package/lib/core/dist/core.min.js +1 -1
  5. package/lib/core/es6/grid/Core.d.ts +4 -0
  6. package/lib/core/es6/grid/Core.js +91 -27
  7. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +3 -2
  8. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +26 -26
  9. package/lib/core/es6/grid/util/util.js +25 -9
  10. package/lib/grid/index.js +1 -1
  11. package/lib/rt-grid/dist/rt-grid.js +2253 -1755
  12. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  13. package/lib/rt-grid/es6/Grid.d.ts +22 -0
  14. package/lib/rt-grid/es6/Grid.js +146 -11
  15. package/lib/rt-grid/es6/RowDefinition.d.ts +2 -2
  16. package/lib/rt-grid/es6/RowDefinition.js +37 -18
  17. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -0
  18. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +60 -59
  19. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +9 -3
  20. package/lib/tr-grid-column-stack/es6/ColumnStack.js +290 -364
  21. package/lib/tr-grid-util/es6/CellPainter.d.ts +2 -1
  22. package/lib/tr-grid-util/es6/CellPainter.js +6 -4
  23. package/lib/tr-grid-util/es6/DateTime.js +3 -3
  24. package/lib/tr-grid-util/es6/ExpressionParser.d.ts +10 -0
  25. package/lib/tr-grid-util/es6/ExpressionParser.js +366 -0
  26. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +10 -6
  27. package/lib/tr-grid-util/es6/FilterBuilder.js +264 -234
  28. package/lib/tr-grid-util/es6/FilterOperators.d.ts +3 -1
  29. package/lib/tr-grid-util/es6/FilterOperators.js +51 -2
  30. package/lib/tr-grid-util/es6/GridPlugin.js +1 -1
  31. package/lib/tr-grid-util/es6/Util.d.ts +0 -3
  32. package/lib/tr-grid-util/es6/Util.js +0 -53
  33. package/lib/tr-grid-util/es6/formula/Formula.js +3 -3
  34. package/lib/types/es6/ColumnDragging.d.ts +51 -0
  35. package/lib/types/es6/ColumnGrouping.d.ts +4 -0
  36. package/lib/types/es6/ColumnStack.d.ts +9 -3
  37. package/lib/types/es6/Core/grid/Core.d.ts +4 -0
  38. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +3 -2
  39. package/lib/types/es6/ExtensionOptions.d.ts +2 -0
  40. package/lib/types/es6/Extensions.d.ts +3 -1
  41. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -2
  42. package/lib/types/es6/index.d.ts +1 -0
  43. package/lib/versions.json +4 -4
  44. package/package.json +1 -1
@@ -320,6 +320,28 @@ declare class Grid extends EventDispatcher {
320
320
 
321
321
  public replaceRow(rowRef: Grid.RowReference|null, rowOption?: any): any;
322
322
 
323
+ public scrollToColumn(colIndex: number, leftOfView?: boolean|null): boolean;
324
+
325
+ public scrollToRow(rowIndex: number, topOfView?: boolean|null): void;
326
+
327
+ public getScrollLeft(): number;
328
+
329
+ public getScrollTop(): number;
330
+
331
+ public setScrollLeft(pixels: number): void;
332
+
333
+ public setScrollTop(pixels: number): void;
334
+
335
+ public scrollRight(pixels: number): void;
336
+
337
+ public scrollDown(pixels: number): void;
338
+
339
+ public getScrollWidth(): number;
340
+
341
+ public getScrollHeight(): number;
342
+
343
+ public getVScrollView(): any;
344
+
323
345
  }
324
346
 
325
347
  declare function borders(gridOptions?: any): any;
@@ -140,21 +140,17 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
140
140
  * @description Fired after ADC data or response received from the server
141
141
  * @property {Array.<Array>} data Data part of the server response
142
142
  */
143
-
144
143
  /** @event Grid#pageIndexChanged
145
144
  * @description Fired after page index in the data view is changed during the active pagination mode
146
145
  */
147
-
148
146
  /** @event Grid#pageCountChanged
149
147
  * @description Fired after page count in the data view is changed during the active pagination mode
150
148
  */
151
-
152
149
  /** @event Grid#dataComposed
153
150
  * @description Trigger before dataChanged. Perform any data update during the event will NOT cause more dataChanged events
154
151
  * @property {Grid} grid
155
152
  * @property {RowDefinition} rowDef
156
153
  */
157
-
158
154
  /** @event Grid#beforeRowRemoved
159
155
  * @description Fired only when a row will be removed through Grid's API and before occurring of the actual removal
160
156
  */
@@ -230,6 +226,45 @@ var compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit n
230
226
  return (rowDefA.getData(fieldName) - rowDefB.getData(fieldName)) * sortOrder; // for numeric comparison
231
227
  };
232
228
 
229
+ /**
230
+ * @private
231
+ * @param {string} rowDefA
232
+ * @param {string} rowDefB
233
+ * @param {string} sortOrder
234
+ * @return {number} The outcome of the value comparison
235
+ */
236
+ var _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
237
+ var parentA = rowDefA.getParent();
238
+
239
+ if (!parentA) {
240
+ return 0;
241
+ }
242
+
243
+ var parentB = rowDefB.getParent();
244
+
245
+ if (!parentB) {
246
+ return 0;
247
+ }
248
+
249
+ if (parentA !== parentB) {
250
+ return 0;
251
+ }
252
+
253
+ var a = rowDefA.getData('CHILD_ORDER');
254
+
255
+ if (a == null) {
256
+ return 0;
257
+ }
258
+
259
+ var b = rowDefB.getData('CHILD_ORDER');
260
+
261
+ if (b == null) {
262
+ return 0;
263
+ }
264
+
265
+ return ( a - b ) * sortOrder;
266
+ };
267
+
233
268
  /** @private
234
269
  * @param {ColumnDefinition} colDef
235
270
  * @return {string}
@@ -258,6 +293,7 @@ var Grid = function(placeholder, config) {
258
293
  var t = this; // This is to primarily reduce file size
259
294
 
260
295
  t._onDataChanged = t._onDataChanged.bind(t);
296
+ t._onQuote2PostUpdate = t._onQuote2PostUpdate.bind(t);
261
297
  t._onDataComposed = t._onDataComposed.bind(t);
262
298
  t._onSubSegmentChanged = t._onSubSegmentChanged.bind(t);
263
299
  t._recalculateFormulas = t._recalculateFormulas.bind(t);
@@ -616,6 +652,7 @@ Grid.prototype.initSubscription = function() {
616
652
  this._subs = s;
617
653
  this._subs["start"]();
618
654
  this._dc.setSubscriptions(s);
655
+ this._subs.addEventListener("postUpdate", this._onQuote2PostUpdate);
619
656
 
620
657
  // TODO: Subscriptions should be registered per row.
621
658
  // However, chain subscription cannot be integrated with DataConnector in this current implementation.
@@ -2608,13 +2645,7 @@ Grid.prototype.setRic = function(rowRef, str, options) {
2608
2645
  options["ric"] = str;
2609
2646
  var extractedOptions = RowDefinition.extractRowOptions(options);
2610
2647
  var oldRic = rowDef.getSymbol();
2611
- var permId = options["permId"];
2612
- var expanded = null;
2613
- var collapsed = options["collapsed"];
2614
- if(collapsed != null){
2615
- expanded = !extractedOptions["collapsed"];
2616
- }
2617
- if(rowDef.setContent(str, permId, extractedOptions["asChain"], expanded)) { // The given string may not be a RIC
2648
+ if(rowDef.setContent(str, extractedOptions)) { // The given string may not be a RIC
2618
2649
  this._connector.removeRic(rowDef, oldRic);
2619
2650
  this._initDuplicateRicData(rowDef);
2620
2651
  this._connector.addRic(rowDef);
@@ -3328,6 +3359,19 @@ Grid.prototype.clearSort = function() {
3328
3359
  this._stp.clearSortState(); // WARNING: No event is dispatched
3329
3360
  };
3330
3361
 
3362
+ /**
3363
+ * @private
3364
+ * @param {Object} e Event object from quote2
3365
+ */
3366
+ Grid.prototype._onQuote2PostUpdate = function (e) {
3367
+ if(e.childOrderChange) { // For dynamic chain when CHILD_ORDER from the server change, it will be call sort children
3368
+ if(!this.isSorting()) {
3369
+ // Use rowDef for get CHILD_ORDER to sort
3370
+ this._dt.sortOnce("ROW_DEF", "a", _sortChildrenOfChain);
3371
+ }
3372
+ }
3373
+ };
3374
+
3331
3375
  /** @private
3332
3376
  * @param {!Object} e
3333
3377
  */
@@ -3873,6 +3917,7 @@ Grid.prototype._logData = function(rowDefs, options) {
3873
3917
 
3874
3918
  console.table(tbl); // eslint-disable-line
3875
3919
  };
3920
+
3876
3921
  /** @public
3877
3922
  * @description Replace existing row with a new row. Row ID would be changed, after row is replaced.
3878
3923
  * @param {Grid~RowReference} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
@@ -3896,5 +3941,95 @@ Grid.prototype.replaceRow = function(rowRef, rowOption) {
3896
3941
  }
3897
3942
  };
3898
3943
 
3944
+ /** Scroll the view to the specified column. If the column is already in the view, nothing happens. If the column is outside of the view, the view will be moved to the column with some additional offsets
3945
+ * @public
3946
+ * @param {number} colIndex
3947
+ * @param {boolean=} leftOfView Default is false. If true, the specified column will be put at the leftmost of the view (no offset)
3948
+ * @returns {boolean} Return true, if there is any change
3949
+ */
3950
+ Grid.prototype.scrollToColumn = function (colIndex, leftOfView) {
3951
+ return this._grid.scrollToColumn(colIndex, leftOfView);
3952
+ };
3953
+ /** Scroll the view to the specified row. If the row is already in the view, nothing happens. If the row is outside of the view, the view will be moved to the row with some additional offsets
3954
+ * @public
3955
+ * @param {number} rowIndex
3956
+ * @param {boolean=} topOfView=false If true, the specified row will be put at the top of the view (no offset)
3957
+ */
3958
+ Grid.prototype.scrollToRow = function (rowIndex, topOfView) {
3959
+ this._grid.scrollToRow("content", rowIndex, topOfView);
3960
+ };
3961
+
3962
+ /** Get scroll value in pixel from the horizontal scrollbar
3963
+ * @public
3964
+ * @returns {number} pixels
3965
+ */
3966
+ Grid.prototype.getScrollLeft = function () {
3967
+ return this._grid.getScrollLeft();
3968
+ };
3969
+ /** Get scroll value in pixel from the vertical scrollbar
3970
+ * @public
3971
+ * @returns {number} pixels
3972
+ */
3973
+ Grid.prototype.getScrollTop = function () {
3974
+ return this._grid.getScrollTop();
3975
+ };
3976
+
3977
+ /** Set scroll value to the horizontal scrollbar. This will move the scrollbar to specific position
3978
+ * @public
3979
+ * @param {number} pixels
3980
+ * @see {@link Grid.scrollRight}
3981
+ */
3982
+ Grid.prototype.setScrollLeft = function (pixels) {
3983
+ this._grid.setScrollLeft(pixels);
3984
+ };
3985
+ /** Set scroll value to the vertical scrollbar. This will move the scrollbar to specific position
3986
+ * @public
3987
+ * @param {number} pixels
3988
+ * @see {@link Grid.scrollDown}
3989
+ */
3990
+ Grid.prototype.setScrollTop = function (pixels) {
3991
+ this._grid.setScrollTop(pixels);
3992
+ };
3993
+
3994
+ /** Scroll the view to the right by the specified value. Use negative value to scroll the view to the left
3995
+ * @public
3996
+ * @param {number} pixels
3997
+ * @see {@link Grid.setScrollLeft}
3998
+ */
3999
+ Grid.prototype.scrollRight = function (pixels) {
4000
+ this._grid.scrollRight(pixels);
4001
+ };
4002
+ /** Scroll the view down by the specified value. Use negative value to scroll the view to the top
4003
+ * @public
4004
+ * @param {number} pixels
4005
+ * @see {@link Grid.setScrollTop}
4006
+ */
4007
+ Grid.prototype.scrollDown = function (pixels) {
4008
+ this._grid.scrollDown(pixels);
4009
+ };
4010
+
4011
+ /** Get width of scrollable area from the horizontal scrollbar. This is useful for determining the end of scrollbar
4012
+ * @public
4013
+ * @returns {number}
4014
+ */
4015
+ Grid.prototype.getScrollWidth = function () {
4016
+ return this._grid.getScrollWidth();
4017
+ };
4018
+ /** Get height of scrollable area from the vertical scrollbar. This is useful for determining the end of scrollbar
4019
+ * @public
4020
+ * @returns {number}
4021
+ */
4022
+ Grid.prototype.getScrollHeight = function () {
4023
+ return this._grid.getScrollHeight();
4024
+ };
4025
+
4026
+ /** Get information about current grid's view and the vertical scrollbar
4027
+ * @public
4028
+ * @returns {Object} Returns null, if vertical scrollbar does not exists
4029
+ */
4030
+ Grid.prototype.getVScrollView = function () {
4031
+ return this._grid.getVScrollView();
4032
+ };
4033
+
3899
4034
  export { Grid };
3900
4035
  export default Grid;
@@ -104,7 +104,7 @@ declare class RowDefinition {
104
104
 
105
105
  public resetUpdates(): void;
106
106
 
107
- public registerToView(view: DataTable|null, rowId?: string|null): void;
107
+ public registerToView(view: DataView|null, rowId?: string|null): void;
108
108
 
109
109
  public static deregisterFromView(rowIds: (string)[]|null, rowDef: RowDefinition|null): (string)[]|null;
110
110
 
@@ -142,7 +142,7 @@ declare const ROW_DEF: string;
142
142
 
143
143
  declare const ROW_TYPES: RowDefinition.RowTypes;
144
144
 
145
- declare function rowData(userInput: string, permId?: string|null, asChain?: boolean|null, expanded?: boolean|null): boolean;
145
+ declare function rowData(userInput: string, extractedOptions: any): boolean;
146
146
 
147
147
  export {RowDefinition, ROW_DEF, ROW_TYPES};
148
148
  export default RowDefinition;
@@ -248,8 +248,9 @@ RowDefinition.prototype.initialize = function(rowOptions) {
248
248
  }
249
249
 
250
250
  val = rowOptions["collapsed"];
251
- if(val != null){
252
- this._expanded = extractedOptions["collapsed"];
251
+ var collapsed = extractedOptions["collapsed"];
252
+ if(val != null || !collapsed){
253
+ this._expanded = !collapsed;
253
254
  }
254
255
  val = rowOptions["keepModel"];
255
256
  if(val) {
@@ -258,7 +259,7 @@ RowDefinition.prototype.initialize = function(rowOptions) {
258
259
 
259
260
  var symbol = this._ric || this._chainRic;
260
261
  if(symbol || this._permId){
261
- this.setContent(symbol, this._permId, this._isChain, this._expanded); // this._dataId is modified
262
+ this.setContent(symbol, extractedOptions); // this._dataId is modified
262
263
  }
263
264
 
264
265
  val = rowOptions["values"];
@@ -293,12 +294,10 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
293
294
  /** @public
294
295
  * @ignore
295
296
  * @param {string} userInput RIC
296
- * @param {string=} permId=null Organization PermId, which use for getting ADC data for private company
297
- * @param {boolean=} asChain
298
- * @param {boolean=} expanded
297
+ * @param {Object} extractedOptions
299
298
  * @return {boolean} True if there is any change otherwise false
300
299
  */
301
- RowDefinition.prototype.setContent = function(userInput, permId, asChain, expanded) {
300
+ RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
302
301
  if(this._autoGenerated) { // AutoGenerated RowDefinition cannot be changed by user input
303
302
  return false;
304
303
  }
@@ -310,6 +309,7 @@ RowDefinition.prototype.setContent = function(userInput, permId, asChain, expand
310
309
  }
311
310
 
312
311
  var dirty = (this._userInput !== userInput);
312
+ var permId = extractedOptions["permId"];
313
313
  if(this._permId !== permId){
314
314
  this._permId = permId || "";
315
315
  dirty = true;
@@ -327,15 +327,17 @@ RowDefinition.prototype.setContent = function(userInput, permId, asChain, expand
327
327
  if(this._userInput.charAt(0) === "'") { // This is a row header
328
328
  this._ric = this._chainRic = ""; // No ric for realtime request
329
329
  } else {
330
+ var asChain = extractedOptions["asChain"];
331
+ var expanded = !extractedOptions["collapsed"];
332
+ var chainRic = extractedOptions["chainRic"];
330
333
  if(asChain === true){
331
334
  this._ric = expanded === false ? this._userInput : this._userInput.replace("0#", "");
332
- this._expanded = expanded;
333
- this._isChain = true; // Only chain can be expanded by 0#
334
- this._chainRic = this._userInput;
335
+ this._expanded = expanded; // Only chain can be expanded by 0#
335
336
  } else {
336
337
  this._ric = this._userInput;
337
- this._isChain = asChain;
338
338
  }
339
+ this._isChain = asChain;
340
+ this._chainRic = chainRic || "";
339
341
  }
340
342
 
341
343
  if(this._view) {
@@ -767,8 +769,17 @@ RowDefinition.prototype.subscribeForUpdates = function() {
767
769
  var prevRowData = this.unsubscribeForUpdates();
768
770
 
769
771
  if(this.isChain()) {
770
- this._subId = subs["addChain"](this._chainRic || this._ric, this._rowId); // Some chain require 0# symbol to populate its constituents
771
- // TODO: Handle Dynamic chain such as .PG.PA
772
+ var symbol = this._chainRic;
773
+ if(!symbol){
774
+ symbol = this._ric;
775
+ if(symbol.indexOf("0#") < 0){
776
+ var count = (symbol.match(/\./g) || []).length;
777
+ if(count < 2){
778
+ symbol = "0#" + symbol;
779
+ }
780
+ }
781
+ }
782
+ this._subId = subs["addChain"](symbol, this._rowId); // Some chain require 0# symbol to populate its constituents
772
783
  } else if(this._ric) {
773
784
  this._subId = subs["addRic"](this._ric, this._rowId);
774
785
  }
@@ -845,7 +856,7 @@ RowDefinition.prototype.resetUpdates = function() {
845
856
  };
846
857
 
847
858
  /** @public
848
- * @param {DataTable} view
859
+ * @param {DataView} view
849
860
  * @param {string=} rowId
850
861
  */
851
862
  RowDefinition.prototype.registerToView = function(view, rowId) {
@@ -962,11 +973,17 @@ RowDefinition.prototype.addConstituent = function(ric) {
962
973
  }
963
974
 
964
975
  if(this._view) {
965
- // WARNING: ChildCount may not be enough to determine proper inserting position
966
- // TODO: Handle nested children
967
976
  var rowId = this.getRowId();
968
- var rowIndex = this._view.getRowIndex(rowId) + this.getChildCount(); // Children must be directly under its parent
969
- childDef.registerToView(this._view, this._view.getRowId(rowIndex));
977
+ // WARNING: insert position, we prioritize using CHILD_ORDER (From server) in dc first. If it does not exist, the last row of the segment will be pushed
978
+ var childOrder = childDef.getData("CHILD_ORDER");
979
+ var parentIndex = this._view.getRowIndex(rowId);
980
+ var position = parentIndex + this.getChildCount(); // push the last position
981
+ if(childOrder != null) {
982
+ // Warning: We need to carry a value of 1 because the CHILD_ORDER starts with 0, and it will be added to the parentIndex. In case the parent rowIndex is not included.
983
+ position = parentIndex + childOrder + 1; // insert between segment
984
+ } // else {} it will be push in the last row of segment
985
+ childDef.registerToView(this._view, this._view.getRowId(position));
986
+ // TODO: Handle nested children
970
987
  this._view.addSegmentChild(rowId, childDef.getRowId(), childDef.getDataId());
971
988
  }
972
989
 
@@ -1217,6 +1234,7 @@ RowDefinition.toRowId = function(rowDef) {
1217
1234
  */
1218
1235
  RowDefinition.extractRowOptions = function(rowOptions) {
1219
1236
  var ric = rowOptions["ric"];
1237
+ var permId = rowOptions["permId"];
1220
1238
  var chainRic = rowOptions["chainRic"];
1221
1239
  var collapsed = rowOptions["collapsed"];
1222
1240
  var asChain = rowOptions["asChain"];
@@ -1238,6 +1256,7 @@ RowDefinition.extractRowOptions = function(rowOptions) {
1238
1256
  extractedOptions["collapsed"] = collapsed;
1239
1257
  }
1240
1258
  extractedOptions["ric"] = ric;
1259
+ extractedOptions["permId"] = permId;
1241
1260
  extractedOptions["chainRic"] = chainRic;
1242
1261
  extractedOptions["asChain"] = asChain;
1243
1262
  return extractedOptions;
@@ -93,6 +93,10 @@ declare class ColumnGroupingPlugin extends GridPlugin {
93
93
 
94
94
  public unpinGroup(groupId: string, dest?: (number|string)|null): void;
95
95
 
96
+ public static getObjectIndex(column: any): number;
97
+
98
+ public static getObjectId(column: any): string;
99
+
96
100
  }
97
101
 
98
102
  export default ColumnGroupingPlugin;
@@ -64,10 +64,6 @@ ColumnGroupingPlugin.prototype._maxDepth = 0;
64
64
  * @private
65
65
  */
66
66
  ColumnGroupingPlugin.prototype._restructuring = false;
67
- /** @type {boolean}
68
- * @private
69
- */
70
- ColumnGroupingPlugin.prototype._autoGrouping = true;
71
67
  /** @type {number}
72
68
  * @private
73
69
  */
@@ -487,7 +483,7 @@ ColumnGroupingPlugin.prototype._applyGrouping = function () {
487
483
  for (r = 0; r < rowCount; r++) {
488
484
  cell = section.getCell(c, r, false);
489
485
  if (cell) {
490
- cell.reset();
486
+ // TODO: The style and class from the user will not be reset, for example, the color or background
491
487
  cell.removeClass("no-sort");
492
488
  cell.removeAttribute("group-id");
493
489
  }
@@ -894,9 +890,11 @@ ColumnGroupingPlugin.prototype._applyTimeSeries = function (e) {
894
890
  * @param {Object} e dispatching of columnAdded event object
895
891
  */
896
892
  ColumnGroupingPlugin.prototype._onColumnAdded = function (e) {
897
- var colIndex = e.colIndex;
898
- this._requestApplyAddChildGroup(e);
899
- this._applyNearestGrouping(colIndex);
893
+ var batches = e["batches"];
894
+ if (!(batches && batches["reset"])) {
895
+ this._requestApplyAddChildGroup(e);
896
+ this._applyNearestGrouping(e.colIndex);
897
+ }
900
898
  this._requestApplyGrouping();
901
899
  };
902
900
  /** @private
@@ -908,7 +906,8 @@ ColumnGroupingPlugin.prototype._onColumnChanged = function () {
908
906
  * @param {Object} e dispatching of columnMoved event object
909
907
  */
910
908
  ColumnGroupingPlugin.prototype._onColumnMoved = function (e) {
911
- if (this._autoGrouping) {
909
+ var batches = e["batches"];
910
+ if (!(batches && batches["move"])) {
912
911
  this._applyNearestGrouping(e.toColIndex);
913
912
  }
914
913
  this._requestApplyGrouping();
@@ -917,11 +916,16 @@ ColumnGroupingPlugin.prototype._onColumnMoved = function (e) {
917
916
  * @param {Object} e
918
917
  */
919
918
  ColumnGroupingPlugin.prototype._onColumnRemoved = function (e) {
920
- var colId = e.colId;
921
- if (colId) {
922
- if (this._groupDefs.unsetParent(colId)) {
923
- this._requestApplyGrouping();
919
+ var batches = e["batches"];
920
+ if (!(batches && batches["reset"])) {
921
+ var colId = e.colId;
922
+ if (colId) {
923
+ if (this._groupDefs.unsetParent(colId)) {
924
+ this._requestApplyGrouping();
925
+ }
924
926
  }
927
+ } else {
928
+ this._requestApplyGrouping();
925
929
  }
926
930
  };
927
931
  /** @private
@@ -1028,29 +1032,22 @@ ColumnGroupingPlugin.prototype._onBeforeColumnBoundUpdate = function (e) {
1028
1032
  */
1029
1033
  ColumnGroupingPlugin.prototype.addColumnToGroup = function (column, groupId, colIndex) {
1030
1034
  if (!column) return;
1031
- var columnIndex = -1;
1032
- if (colIndex == null) {
1035
+ var destIndex = this.getColumnCount();
1036
+ if (colIndex != null) {
1033
1037
  var groupDef = this._groupDefs.getGroup(groupId);
1034
1038
  if (groupDef) {
1035
- var childIndices = this.getChildColumnIndices(groupId);
1036
- if (childIndices && childIndices.length) {
1037
- // Child indices need to be sorted here
1038
- columnIndex = childIndices[childIndices.length - 1] + 1; // Put new column next to the last child in the group
1039
- }
1040
-
1041
1039
  this._groupDefs.addGroupChild(groupId, column.id);
1042
1040
  }
1043
- } else {
1044
- columnIndex = colIndex;
1045
- }
1046
- if (columnIndex < 0) {
1047
- columnIndex = this.getColumnCount();
1041
+ destIndex = colIndex;
1048
1042
  }
1049
1043
  if (this._realTimeGrid) {
1050
1044
  // TODO: Support multi-table feature
1051
- this._realTimeGrid.insertColumn(column, columnIndex);
1045
+ this._realTimeGrid.insertColumn(column, destIndex);
1052
1046
  } else if (this._compositeGrid) {
1053
- this._compositeGrid.insertColumn(columnIndex, column);
1047
+ this._compositeGrid.insertColumn(destIndex, column);
1048
+ }
1049
+ if (colIndex == null) {
1050
+ this.setColumnParent(column.id || destColIndex, groupId);
1054
1051
  }
1055
1052
  };
1056
1053
 
@@ -1125,14 +1122,13 @@ ColumnGroupingPlugin.prototype.setGroupDefinition = function (groupId, groupDef)
1125
1122
  if (this._groupDefs.setGroup(groupId, groupDef)) {
1126
1123
  var newDef = this._groupDefs.getGroup(groupId);
1127
1124
  if (newDef) {
1128
- var chdr = newDef.children;
1125
+ var host = this._hosts[0];
1126
+ var chdr = host.getValidColumnList(newDef.children).map(ColumnGroupingPlugin.getObjectId); //this return only valid columns without group
1129
1127
  var len = chdr.length;
1130
- // TODO: Filter out group id
1131
1128
  if (len > 1) {
1132
- this.reorderColumns(chdr, chdr[0]); // WARNING: group id doesn't work
1129
+ this.reorderColumns(chdr, chdr[0]);
1133
1130
  }
1134
1131
  }
1135
-
1136
1132
  this._applyGrouping();
1137
1133
  return groupId;
1138
1134
  }
@@ -1195,16 +1191,17 @@ ColumnGroupingPlugin.prototype._getAvaliableChildren = function (groupId) {
1195
1191
  var childCount = chdr ? chdr.length : 0;
1196
1192
  var validChildren = [];
1197
1193
  if (childCount) {
1194
+ var host = this._hosts[0];
1195
+ var validCols = host.getValidColumnList(chdr);
1196
+ validChildren = validCols.map(ColumnGroupingPlugin.getObjectId);
1198
1197
  var groupMap = this._groupDefs.getGroupMap();
1199
- // Filter out columns that do not exist
1200
1198
  for (var i = 0; i < childCount; i++) {
1201
1199
  var childId = chdr[i];
1202
- if (groupMap[childId] || this.getColumnIndex(childId) > -1) {
1203
- validChildren.push(childId); // TODO: This is slow
1200
+ if (groupMap[childId]) {
1201
+ validChildren.push(childId);
1204
1202
  }
1205
1203
  }
1206
1204
  }
1207
-
1208
1205
  return validChildren;
1209
1206
  };
1210
1207
 
@@ -1226,19 +1223,14 @@ ColumnGroupingPlugin.prototype.getGroupChildren = function (groupId) {
1226
1223
  * @return {Array.<number>}
1227
1224
  */
1228
1225
  ColumnGroupingPlugin.prototype.getChildColumnIndices = function (groupId) {
1226
+ var colIndices = [];
1227
+ var host = this._hosts[0];
1229
1228
  var colIds = this._groupDefs.getLeafDescendants(groupId);
1230
1229
  if (colIds) {
1231
- var colIndices = [];
1232
- var leafCount = colIds.length;
1233
- for (var i = 0; i < leafCount; i++) {
1234
- var index = this.getColumnIndex(colIds[i]);
1235
- if (index >= 0) {
1236
- colIndices.push(index);
1237
- }
1238
- }
1239
- return colIndices.sort(ColumnGroupingPlugin._ascSortLogic); // TODO: This could be unnecessary
1230
+ var validColList = host.getValidColumnList(colIds);
1231
+ colIndices = validColList.map(ColumnGroupingPlugin.getObjectIndex);
1232
+ return colIndices;
1240
1233
  }
1241
-
1242
1234
  return null;
1243
1235
  };
1244
1236
 
@@ -1622,13 +1614,7 @@ ColumnGroupingPlugin.prototype.moveGroup = function (id, destCol) {
1622
1614
  * @return {boolean}
1623
1615
  */
1624
1616
  ColumnGroupingPlugin.prototype.reorderColumns = function (colList, destCol) {
1625
- var dirty = false;
1626
- // TODO: create method for toggling autoGrouping flag
1627
- this._autoGrouping = false; // Prevent re-grouping in columnMoved event
1628
-
1629
- this._reorderColumns(colList, destCol);
1630
- this._autoGrouping = true;
1631
- return dirty;
1617
+ return this._reorderColumns(colList, destCol);
1632
1618
  };
1633
1619
  /** Move the specified column to position before the destination
1634
1620
  * @public
@@ -1637,12 +1623,7 @@ ColumnGroupingPlugin.prototype.reorderColumns = function (colList, destCol) {
1637
1623
  * @return {boolean}
1638
1624
  */
1639
1625
  ColumnGroupingPlugin.prototype.moveColumnById = function (srcCol, destCol) {
1640
- var dirty = false;
1641
- this._autoGrouping = false; // Prevent re-grouping in columnMoved event
1642
-
1643
- this._moveColumnById(srcCol, destCol);
1644
- this._autoGrouping = true;
1645
- return dirty;
1626
+ return this._moveColumnById(srcCol, destCol);
1646
1627
  };
1647
1628
  /** @public
1648
1629
  * @param {string} groupId
@@ -1729,5 +1710,25 @@ ColumnGroupingPlugin.prototype.unpinGroup = function (groupId, dest) {
1729
1710
  this.moveGroup(groupId, destId);
1730
1711
  }
1731
1712
  };
1713
+
1714
+ /** Get column index from column object
1715
+ * @public
1716
+ * @function
1717
+ * @param {Object} column
1718
+ * @return {number}
1719
+ */
1720
+ ColumnGroupingPlugin.getObjectIndex = function (column) {
1721
+ return column["index"];
1722
+ };
1723
+
1724
+ /** Get column id from column object
1725
+ * @public
1726
+ * @function
1727
+ * @param {Object} column
1728
+ * @return {string}
1729
+ */
1730
+ ColumnGroupingPlugin.getObjectId = function (column) {
1731
+ return column["id"];
1732
+ };
1732
1733
  export default ColumnGroupingPlugin;
1733
1734
  export { ColumnGroupingPlugin, ColumnGroupingPlugin as ColumnGrouping, ColumnGroupingPlugin as ColumnGroupingExtension };
@@ -32,8 +32,8 @@ declare namespace ColumnStackPlugin {
32
32
  id: string,
33
33
  spreading?: boolean|null,
34
34
  collapsed?: boolean|null,
35
- children: (string)[]|null,
36
- fields: (string)[]|null,
35
+ children?: (string)[]|null,
36
+ fields?: (string)[]|null,
37
37
  name?: string|null,
38
38
  activeColumn?: string|null
39
39
  };
@@ -88,7 +88,11 @@ declare class ColumnStackPlugin extends GridPlugin {
88
88
 
89
89
  public stackColumns(colRefs?: (number|string)[]|null, stackId?: string|null, options?: ColumnStackPlugin.StackConfiguration|null): boolean;
90
90
 
91
- public setStack(colRefs?: (number|string)[]|null, activeColRef?: number|string|null): boolean;
91
+ public setStack(colRefs?: (number|string)[]|null, activeColRef?: (number|string)|null): boolean;
92
+
93
+ public setStacks(stacks: (ColumnStackPlugin.StackDefinition)[]|null): void;
94
+
95
+ public getStacks(): (ColumnStackPlugin.StackDefinition)[];
92
96
 
93
97
  public unstackColumns(colIndices?: (number)[]|null): boolean;
94
98
 
@@ -120,6 +124,8 @@ declare class ColumnStackPlugin extends GridPlugin {
120
124
 
121
125
  public getStackName(stackId: string): string;
122
126
 
127
+ public getActiveColumnId(stackId: string): string;
128
+
123
129
  public getActiveColumnField(stackId: string): string;
124
130
 
125
131
  public getActiveColumnIndex(stackId: string): number;