@refinitiv-ui/efx-grid 6.0.84 → 6.0.86

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/lib/core/dist/core.js +241 -153
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/data/DataView.d.ts +4 -0
  4. package/lib/core/es6/data/DataView.js +23 -0
  5. package/lib/core/es6/grid/Core.d.ts +0 -4
  6. package/lib/core/es6/grid/Core.js +34 -22
  7. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +13 -3
  8. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +184 -131
  9. package/lib/grid/index.js +1 -1
  10. package/lib/rt-grid/dist/rt-grid.js +275 -159
  11. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  12. package/lib/rt-grid/es6/ColumnDefinition.js +1 -2
  13. package/lib/rt-grid/es6/Grid.js +7 -7
  14. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -0
  15. package/lib/tr-grid-checkbox/es6/Checkbox.js +38 -0
  16. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +3 -4
  17. package/lib/tr-grid-filter-input/es6/FilterInput.js +32 -3
  18. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +4 -1
  19. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +3 -0
  20. package/lib/tr-grid-textformatting/es6/TextFormatting.js +13 -2
  21. package/lib/tr-grid-util/es6/Dom.d.ts +1 -1
  22. package/lib/tr-grid-util/es6/Dom.js +1 -1
  23. package/lib/tr-grid-util/es6/ExpressionParser.js +1 -1
  24. package/lib/tr-grid-util/es6/FieldFormatter.js +4 -2
  25. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +1 -1
  26. package/lib/tr-grid-util/es6/FilterBuilder.js +1 -1
  27. package/lib/tr-grid-util/es6/NumberFormatter.js +2 -2
  28. package/lib/tr-grid-util/es6/PercentBar.d.ts +1 -1
  29. package/lib/tr-grid-util/es6/PercentBar.js +1 -1
  30. package/lib/tr-grid-util/es6/RangeBar.d.ts +1 -1
  31. package/lib/tr-grid-util/es6/RangeBar.js +8 -7
  32. package/lib/tr-grid-util/es6/TextHighlighter.d.ts +0 -2
  33. package/lib/tr-grid-util/es6/TextHighlighter.js +1 -6
  34. package/lib/tr-grid-util/es6/formula/Formula.js +1 -1
  35. package/lib/tr-grid-util/es6/formula/VariableToken.js +1 -1
  36. package/lib/tr-grid-util/es6/formula/functions/Excel.d.ts +1 -1
  37. package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
  38. package/lib/tr-grid-util/es6/index.js +1 -1
  39. package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +1 -1
  40. package/lib/tr-grid-util/es6/jet/DataGenerator.js +1 -1
  41. package/lib/types/es6/Core/data/DataView.d.ts +4 -0
  42. package/lib/types/es6/Core/grid/Core.d.ts +0 -4
  43. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +13 -3
  44. package/lib/types/es6/RowFiltering.d.ts +4 -1
  45. package/lib/versions.json +6 -6
  46. package/package.json +1 -1
@@ -16058,8 +16058,7 @@ ColumnDefinition.prototype._setField = function(field, columnOption) {
16058
16058
  if(!field) {
16059
16059
  field = "";
16060
16060
  }
16061
- // Trim white spaces -- equivalent to String.trim(), which is not support in IE8
16062
- field = field.replace(/^\s+|\s+$/gm, "");
16061
+ field = field.trim();
16063
16062
 
16064
16063
  var formulaStr = columnOption ? columnOption["formula"] : "";
16065
16064
  if(this._fnEngine) {
@@ -23988,7 +23987,7 @@ Scrollbar.prototype._onMouseWheel = function (e) {
23988
23987
  util._preventDefault(e);
23989
23988
  return;
23990
23989
  }
23991
- if(e.ctrlKey || e.altKey || e.shiftKey) { return; }
23990
+ if(e.ctrlKey || e.altKey ) { return; }
23992
23991
  if (!this.isActive()) { return; }
23993
23992
 
23994
23993
  var delta = (this._vertical) ? e["deltaY"] : e["deltaX"];
@@ -26774,7 +26773,6 @@ LayoutGrid.prototype.updateColumnSeparators = function () {
26774
26773
  }
26775
26774
  }
26776
26775
  };
26777
-
26778
26776
  /** @private
26779
26777
  * @return {Element}
26780
26778
  */
@@ -29233,6 +29231,10 @@ DataView.prototype._groupRows = null; // Shared between groups
29233
29231
  */
29234
29232
  DataView.prototype._groupId = "";
29235
29233
  /** @private
29234
+ * @type {string}
29235
+ */
29236
+ DataView.prototype._groupColor = "";
29237
+ /** @private
29236
29238
  * @type {*}
29237
29239
  */
29238
29240
  DataView.prototype._groupValue;
@@ -29273,6 +29275,10 @@ DataView.prototype._collapsed = false;
29273
29275
  /** @private
29274
29276
  * @type {boolean}
29275
29277
  */
29278
+ DataView.prototype._collapsible = true;
29279
+ /** @private
29280
+ * @type {boolean}
29281
+ */
29276
29282
  DataView.prototype._showOnlyFirstMember = false;
29277
29283
  /** @private
29278
29284
  * @type {boolean}
@@ -30723,7 +30729,7 @@ DataView.prototype._setCollapse = function(collapsed) {
30723
30729
  }
30724
30730
  }
30725
30731
  } else if (this._isHeaderRowShown()) { // Only groups with visible group header can be expanded/collapsed
30726
- if (this._collapsed !== collapsed) {
30732
+ if (this._collapsible && this._collapsed !== collapsed) {
30727
30733
  this._collapsed = collapsed;
30728
30734
  return true;
30729
30735
  }
@@ -30797,6 +30803,41 @@ DataView.prototype.setDefaultCollapse = function(collapse) {
30797
30803
  DataView.prototype.getDefaultCollapse = function() {
30798
30804
  return !!this._shared.defaultCollapse; // it can be null, convert to boolean
30799
30805
  };
30806
+ /**
30807
+ * @public
30808
+ * @return {boolean}
30809
+ */
30810
+ DataView.prototype.isCollapsible = function() {
30811
+ return this._collapsible;
30812
+ };
30813
+ /**
30814
+ * @public
30815
+ * @param {boolean=} bool=true, if set it to false, it will be enable collapsing
30816
+ */
30817
+ DataView.prototype.disableCollapsing = function(bool) {
30818
+ this._collapsible = !(bool !== false);
30819
+ };
30820
+ /**
30821
+ * @public
30822
+ * @param {string} groupColor
30823
+ */
30824
+ DataView.prototype.setGroupColor = function(groupColor) {
30825
+ if(this._groupLevel === 1) {
30826
+ this._groupColor = groupColor;
30827
+ }
30828
+ };
30829
+ /**
30830
+ * @public
30831
+ * @return {string}
30832
+ */
30833
+ DataView.prototype.getGroupColor = function() {
30834
+ if(this._groupLevel === 0) {
30835
+ return "";
30836
+ } else if(this._groupLevel === 1) {
30837
+ return this._groupColor;
30838
+ }
30839
+ return this._parent.getGroupColor();
30840
+ };
30800
30841
  /** @private
30801
30842
  * @return {?Array.<string>}
30802
30843
  */
@@ -31814,7 +31855,7 @@ DataView.prototype._onDataChanged = function (e) {
31814
31855
  var event = events[0];
31815
31856
  if (event["globalChange"]) {
31816
31857
  this._updateRowIds(); // Reset all row ids and perform sorting
31817
- this._dispatchDataChange(e);
31858
+ this._dispatchDataChange(event);
31818
31859
  return;
31819
31860
  }
31820
31861
 
@@ -36228,6 +36269,10 @@ Core.prototype._batches = null;
36228
36269
  * @private
36229
36270
  */
36230
36271
  Core.prototype._firstRendered = false;
36272
+ /** @type {boolean}
36273
+ * @private
36274
+ */
36275
+ Core.prototype._hasPendingRowChange = false;
36231
36276
  //#region Public Methods
36232
36277
 
36233
36278
  /**
@@ -36235,7 +36280,7 @@ Core.prototype._firstRendered = false;
36235
36280
  * @return {string}
36236
36281
  */
36237
36282
  Core.getVersion = function () {
36238
- return "5.1.81";
36283
+ return "5.1.89";
36239
36284
  };
36240
36285
  /** {@link ElementWrapper#dispose}
36241
36286
  * @override
@@ -38350,27 +38395,30 @@ Core.prototype.preserveGridSize = function (preserve) {
38350
38395
  };
38351
38396
  /** @public
38352
38397
  * @param {number} colIndex
38353
- * @return {Object} userData
38398
+ * @return {!Object} Column data object
38354
38399
  */
38355
38400
  Core.prototype.getColumnData = function (colIndex) {
38356
- return this._getColumnDef(colIndex)["columnData"] || null;
38401
+ return this._getColumnDef(colIndex)["columnData"];
38357
38402
  };
38358
38403
  /** @public
38404
+ * @deprecated
38405
+ * @ignore
38359
38406
  * @param {number} colIndex
38360
38407
  * @param {Object} userData
38361
38408
  * @return {Object}
38362
38409
  */
38363
- Core.prototype.setColumnData = function (colIndex, userData) { // TODO: Deprecate this method
38364
- this._getColumnDef(colIndex)["columnData"] = userData;
38410
+ Core.prototype.setColumnData = function (colIndex, userData) {
38411
+ this._getColumnDef(colIndex)["columnData"] = userData || {};
38365
38412
  return userData;
38366
38413
  };
38367
38414
  /** @public
38415
+ * @function
38416
+ * @deprecated
38417
+ * @ignore
38368
38418
  * @param {number} colIndex
38369
38419
  * @return {!Object}
38370
38420
  */
38371
- Core.prototype.newColumnData = function (colIndex) {
38372
- return this.getColumnData(colIndex) || {};
38373
- };
38421
+ Core.prototype.newColumnData = Core.prototype.getColumnData;
38374
38422
  /** @public
38375
38423
  * @param {number} colIndex
38376
38424
  * @param {boolean=} alwaysRender
@@ -38384,10 +38432,7 @@ Core.prototype.setAlwaysRenderColumn = function(colIndex, alwaysRender) {
38384
38432
  */
38385
38433
  Core.prototype._isAlwaysRenderColumn = function (colIndex) {
38386
38434
  var colData = this.getColumnData(colIndex);
38387
- if(colData) {
38388
- return colData["alwaysRender"] === true;
38389
- }
38390
- return false;
38435
+ return colData["alwaysRender"] === true;
38391
38436
  };
38392
38437
 
38393
38438
  /** @public
@@ -40437,8 +40482,8 @@ Core.prototype._setColumnWidth = function (colIndex, px, opt_scalable) {
40437
40482
  * @param {*=} ctx
40438
40483
  */
40439
40484
  Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle, ctx) {
40485
+ var e = {};
40440
40486
  if (this._hasListener("columnAdded")) {
40441
- var e = {};
40442
40487
  e["atTheMiddle"] = atTheMiddle;
40443
40488
  if(count === 1) {
40444
40489
  e["colIndex"] = at;
@@ -40454,7 +40499,11 @@ Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle, ctx
40454
40499
  }
40455
40500
  }
40456
40501
 
40457
- this._dispatchColumnRenderEvent({},
40502
+ if(this._frozenLayout){
40503
+ e["noDataUpdate"] = true;
40504
+ }
40505
+
40506
+ this._dispatchColumnRenderEvent(e,
40458
40507
  at, at + count,
40459
40508
  0, this._settings.length,
40460
40509
  NaN, NaN);
@@ -40839,7 +40888,9 @@ Core.prototype._getColumnDef = function (colIndex) {
40839
40888
  }
40840
40889
  return def;
40841
40890
  }
40842
- return {};
40891
+ return {
40892
+ "columnData": {}
40893
+ };
40843
40894
  };
40844
40895
  /** Retrieve 1 or 2 level of nested object definition
40845
40896
  * @private
@@ -41064,9 +41115,13 @@ Core.prototype._onRowCountChanged = function (e) {
41064
41115
  }
41065
41116
  }
41066
41117
 
41118
+ var noBinding = e["noBinding"];
41067
41119
  var paneChanged = (sectionIndex <= this._startVScrollbarIndex) || (sectionIndex >= this._getFooterStartIndex());
41068
41120
  var forceUpdate = this._frozenFooterCount > 0 ? true : false; // Prevent from footer section flashing
41069
- var viewChanged = this._updateScrollbarHeight(paneChanged, forceUpdate, e["noBinding"]); // Virtualization is triggered
41121
+ var viewChanged = this._updateScrollbarHeight(paneChanged, forceUpdate, noBinding); // Virtualization is triggered
41122
+ if(noBinding){
41123
+ this._hasPendingRowChange = true;
41124
+ }
41070
41125
  if(!this._frozenLayout && !viewChanged) { // Grid must activate newly created section if no event is dispatched from the row virtualizer
41071
41126
  if(this._rowVirtualizer.isVirtualizable()) {
41072
41127
  section.activateRows(this._rowVirtualizer.getFirstIndexInView(),
@@ -41075,6 +41130,7 @@ Core.prototype._onRowCountChanged = function (e) {
41075
41130
  section.activateRows();
41076
41131
  }
41077
41132
  }
41133
+ this._hasPendingRowChange = false;
41078
41134
 
41079
41135
  if(!forceUpdate) {
41080
41136
  this._updateVScrollbar(); // Asynchronous
@@ -41158,6 +41214,9 @@ Core.prototype._containsSection = function (s) {
41158
41214
  * @param {!Object} e
41159
41215
  */
41160
41216
  Core.prototype._onRowAvailable = function (e) {
41217
+ if(this._hasPendingRowChange){
41218
+ return;
41219
+ }
41161
41220
  var sectionIndex = /** @type{number} */(e["sectionIndex"]);
41162
41221
  this._dispatchColumnRenderEvent(e,
41163
41222
  0, this.getColumnCount(),
@@ -42490,16 +42549,26 @@ es6_Ext.inherits(SortableTitlePlugin, event_EventDispatcher);
42490
42549
  * @typedef {"a" | "ascending" | "d" | "descending" | "n" | null} SortableTitlePlugin~SortOrder
42491
42550
  */
42492
42551
 
42493
- /** The sorting object which will be used for initialSort config.
42552
+ /** An object that specifies how sorting should be performed
42494
42553
  * @typedef {Object} SortableTitlePlugin~InitialSort
42495
- * @property {number=} colIndex Index of the column
42496
- * @property {string=} colId column id of the column
42497
- * @property {string=} field field of the column
42554
+ * @property {number=} colIndex Column index of a column to be sorted
42555
+ * @property {string=} colId Column id of a column to be sorted
42556
+ * @property {string=} field Field of a column to be sorted
42498
42557
  * @property {SortableTitlePlugin~SortOrder=} sortOrder=null Set to "d" for descending order and "a" for ascending order
42499
- * @property {SortableTitlePlugin~SortOrder=} order Alias of sortOrder
42558
+ * @property {SortableTitlePlugin~SortOrder=} order Alias to sortOrder
42500
42559
  */
42501
42560
  SortableTitlePlugin.InitialSort;
42502
42561
 
42562
+ /** An object that specifies how sorting should be performed
42563
+ * @typedef {Object} SortableTitlePlugin~SortingDefinition
42564
+ * @property {number=} colIndex Column index of a column to be sorted
42565
+ * @property {string=} colId Column id of a column to be sorted
42566
+ * @property {string=} field Field of a column to be sorted
42567
+ * @property {SortableTitlePlugin~SortOrder=} sortOrder=null Set to "d" for descending order and "a" for ascending order
42568
+ * @property {SortableTitlePlugin~SortOrder=} order Alias to sortOrder
42569
+ */
42570
+ SortableTitlePlugin.SortingDefinition;
42571
+
42503
42572
  /** The sorting properties for column option.
42504
42573
  * @typedef {Object} SortableTitlePlugin~ColumnOptions
42505
42574
  * @property {boolean=} sortable=false If enable, the column can be sorted by user click
@@ -42515,7 +42584,7 @@ SortableTitlePlugin.ColumnOptions;
42515
42584
 
42516
42585
  /** The configuration object for sorting options. This can be defined by `sorting` property in CompositeGrid configuration object.
42517
42586
  * @typedef {Object} SortableTitlePlugin~Options
42518
- * @property {(SortableTitlePlugin~InitialSort|Array.<SortableTitlePlugin.InitialSort>)=} initialSort=null Set this config to initiate sorting after grid is created.
42587
+ * @property {(SortableTitlePlugin~InitialSort|Array.<SortableTitlePlugin.SortingDefinition>)=} initialSort=null Set this config to initiate sorting after grid is created.
42519
42588
  * @property {(boolean|number)=} multicolumn=false Allow multiple columns to be sorted at the same time. If number is defined, it is treated as maximum number of column to be sorted.
42520
42589
  * @property {(boolean|number)=} multiColumn=false Alias to `multicolumn`
42521
42590
  * @property {boolean=} threeStatesSorting=false If enabled, sorting will cycle through ascending, descending and original order states. This option is deprecated in favor of sortingSequence option
@@ -42575,7 +42644,7 @@ SortableTitlePlugin.prototype._delayInterval = 0;
42575
42644
  */
42576
42645
  SortableTitlePlugin.prototype._lastMouseDown = 0;
42577
42646
  /** @private
42578
- * @type {SortableTitlePlugin.InitialSort}
42647
+ * @type {SortableTitlePlugin.SortingDefinition}
42579
42648
  */
42580
42649
  SortableTitlePlugin.prototype._initialSort = null;
42581
42650
  /** @private
@@ -42898,7 +42967,8 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
42898
42967
  }
42899
42968
  field = opt["field"];
42900
42969
  if (field) {
42901
- if(col["field"] != null && col["field"] !== field) { // Core does not have field properties, so when you try to call getConfigObject in Core, it will return sortBy too.
42970
+ // WARNING: When Core's column has no field, sortBy property does not get returned
42971
+ if(col["field"] != null && col["field"] !== field) {
42902
42972
  col["sortBy"] = field;
42903
42973
  } // else The default value is an empty sortBy, which refers to the same column field by default.
42904
42974
 
@@ -43116,18 +43186,38 @@ SortableTitlePlugin.prototype.getSortOrder = function (colIndex) {
43116
43186
  * @return {number} Return negative value if there is no sorted column
43117
43187
  */
43118
43188
  SortableTitlePlugin.prototype.getSortedColumnIndex = function (priority) {
43119
- return this._getColumnIndexByOptions(this._sortStates[priority || 0]);
43189
+ return this._getColumnIndex(this._sortStates[priority || 0]);
43120
43190
  };
43121
43191
  /** Start with 0 (the first column that is being sorted). The highest number will be sorted last. Negative value means the specified column is not sorted
43122
43192
  * @public
43123
43193
  * @param {number} colIndex
43194
+ * @param {string=} colRef field or column id
43124
43195
  * @return {number}
43125
43196
  */
43126
- SortableTitlePlugin.prototype.getSortPriority = function (colIndex) {
43127
- var len = this._sortStates.length;
43128
- for (var i = 0; i < len; ++i) {
43129
- if (this._sortStates[i] === this._getSortOptions(colIndex)) {
43130
- return i;
43197
+ SortableTitlePlugin.prototype.getSortPriority = function (colIndex, colRef) {
43198
+ var host = this._hosts[0];
43199
+ if(host) {
43200
+ var i;
43201
+ var len = this._sortStates.length;
43202
+ if(colIndex >= 0) {
43203
+ var colId = host.getColumnId(colIndex);
43204
+ if(colId) {
43205
+ for(i = 0; i < len; ++i) {
43206
+ if(this._sortStates[i]["colId"] === colId) {
43207
+ return i;
43208
+ }
43209
+ }
43210
+ }
43211
+ } else if(colRef) {
43212
+ for(i = 0; i < len; ++i) {
43213
+ var sortState = this._sortStates[i];
43214
+ if(sortState["colId"] === colRef) {
43215
+ return i;
43216
+ }
43217
+ if(sortState["field"] === colRef) {
43218
+ return i;
43219
+ }
43220
+ }
43131
43221
  }
43132
43222
  }
43133
43223
  return -1;
@@ -43140,7 +43230,7 @@ SortableTitlePlugin.prototype.isColumnSorted = function (colIndex) {
43140
43230
  return this.getSortPriority(colIndex) >= 0;
43141
43231
  };
43142
43232
  /** @public
43143
- * @return {Array.<Object>} Array of object with "colIndex" and "sortOrder"
43233
+ * @return {Array.<Object>} Array of objects with colIndex, colId, field, and sortOrder properties
43144
43234
  */
43145
43235
  SortableTitlePlugin.prototype.getSortedColumns = function () {
43146
43236
  var len = this._sortStates.length;
@@ -43150,12 +43240,21 @@ SortableTitlePlugin.prototype.getSortedColumns = function () {
43150
43240
  for (var i = 0; i < len; ++i) {
43151
43241
  var colIndex = this.getSortedColumnIndex(i);
43152
43242
  var state = this._sortStates[i];
43153
- arr[i] = {
43154
- "colIndex": colIndex,
43155
- "colId": this._getColumnId(colIndex),
43156
- "field": state["field"] || "",
43157
- "sortOrder": state["sortOrder"] || "n"
43158
- };
43243
+ var retObj = {};
43244
+ var colId = "";
43245
+ if(colIndex >= 0) {
43246
+ retObj["colIndex"] = colIndex;
43247
+ colId = this._getColumnId(colIndex);
43248
+ }
43249
+ if(colId) {
43250
+ retObj["colId"] = colId;
43251
+ }
43252
+ var field = state["field"] || "";
43253
+ if(field) {
43254
+ retObj["field"] = field;
43255
+ }
43256
+ retObj["sortOrder"] = state["sortOrder"] || "n";
43257
+ arr[i] = retObj;
43159
43258
  }
43160
43259
  return arr;
43161
43260
  };
@@ -43174,35 +43273,22 @@ SortableTitlePlugin.prototype.isSorting = function () {
43174
43273
  * @fires SortableTitlePlugin#columnSorted
43175
43274
  */
43176
43275
  SortableTitlePlugin.prototype.sortColumn = function (colRef, sortOrder, opt_arg) {
43177
- var state = this._prepareSorting(colRef, sortOrder);
43178
- if (state) {
43179
- this._sortColumn([state], opt_arg);
43180
- }
43276
+ this._sortColumn(this._prepareSorting(colRef, sortOrder), opt_arg);
43181
43277
  };
43182
43278
 
43183
43279
  /** Sort multiple columns at once
43184
43280
  * @public
43185
- * @param {Array.<SortableTitlePlugin.InitialSort>} sortOptions Input an array to specify the multiple column sort order
43281
+ * @param {Array.<SortableTitlePlugin.SortingDefinition>} sortOptions Input an array to specify the multiple column sort order
43186
43282
  * @param {Object=} opt_arg Event argument to be sent with preDataSorting event
43187
43283
  * @fires SortableTitlePlugin#preDataSorting
43188
43284
  * @fires SortableTitlePlugin#columnSorted
43189
43285
  */
43190
43286
  SortableTitlePlugin.prototype.sortColumns = function (sortOptions, opt_arg) {
43191
43287
  if (Array.isArray(sortOptions)) {
43192
- var states = [];
43193
- for (var i = 0; i < sortOptions.length; i++) {
43194
- var opt = sortOptions[i];
43195
- var colRef = opt["colId"] || opt["field"];
43196
- if(colRef == null) {
43197
- colRef = opt["colIndex"];
43198
- }
43199
- var state = this._prepareSorting(
43200
- colRef,
43201
- opt["sortOrder"] || opt["order"]
43202
- );
43203
- if (state) {
43204
- states.push(state);
43205
- }
43288
+ var len = sortOptions.length;
43289
+ var states = new Array(len);
43290
+ for (var i = 0; i < len; i++) {
43291
+ states[i] = this._prepareSorting(sortOptions[i]);
43206
43292
  }
43207
43293
  this._sortColumn(states, opt_arg);
43208
43294
  }
@@ -43303,7 +43389,10 @@ SortableTitlePlugin.prototype.getColumnSortingField = function (colIndex) {
43303
43389
  if (field == null && !this._rowDefMode) { // Old CompositeGrid may store sorting field in DataColumnName
43304
43390
  var host = this._hosts[0];
43305
43391
  if (host) {
43306
- field = host.getDataColumnName(colIndex);
43392
+ field = host.getColumnField(colIndex);
43393
+ if(!field) {
43394
+ field = host.getDataColumnName(colIndex);
43395
+ }
43307
43396
  if(field && sortOptions) {
43308
43397
  sortOptions["field"] = field; // Cache for later use
43309
43398
  }
@@ -43338,28 +43427,20 @@ SortableTitlePlugin.prototype.setColumnSortingField = function (colIndex, field,
43338
43427
  }
43339
43428
  }
43340
43429
  };
43430
+
43431
+ /** @private
43432
+ * @param {Object} sortState
43433
+ * @returns {string}
43434
+ */
43435
+ var _toField = function(sortState) {
43436
+ return sortState["field"] || "";
43437
+ };
43341
43438
  /** Return array of the fields from the currently sorted columns
43342
43439
  * @public
43343
43440
  * @return {!Array.<string>} fields of each sorting states
43344
43441
  */
43345
43442
  SortableTitlePlugin.prototype.getColumnSortingFields = function () {
43346
- var len = this._sortStates.length;
43347
- var ary = new Array(len);
43348
- var host = this._hosts[0];
43349
-
43350
- for(var i = 0; i < len; ++i) {
43351
- var sortOptions = this._sortStates[i];
43352
- var field = sortOptions["field"];
43353
- if(!field && !this._rowDefMode) {
43354
- var colIndex = this._getColumnIndexByOptions(sortOptions); // Slow
43355
- field = host.getDataColumnName(colIndex);
43356
- if(field) {
43357
- sortOptions["field"] = field; // Cache for later use
43358
- }
43359
- }
43360
- ary[i] = field || "";
43361
- }
43362
- return ary;
43443
+ return this._sortStates.map(_toField);
43363
43444
  };
43364
43445
 
43365
43446
  /** This is deprecated in favor of setSortingSequence method. Move existing sort order to the front of sorting sequence. New sort order will be added, if the specified sort order does not exist in current sorting sequence.
@@ -43368,7 +43449,6 @@ SortableTitlePlugin.prototype.getColumnSortingFields = function () {
43368
43449
  * @param {string=} sortOrder="a" "ascending", "descending", "none"
43369
43450
  * @see {@link SortableTitlePlugin#setSortingSequence}
43370
43451
  */
43371
-
43372
43452
  SortableTitlePlugin.prototype.setFirstSortOrder = function (colIdentifier, sortOrder) {
43373
43453
  if (sortOrder) {
43374
43454
  sortOrder = SortableTitlePlugin._toSortOrder(sortOrder);
@@ -43586,16 +43666,18 @@ SortableTitlePlugin.prototype._proceedSorting = function (hitObj) {
43586
43666
  if (this._canClickToSort(hitObj)) {
43587
43667
  var colIndex = hitObj["colIndex"];
43588
43668
  // _proceedSorting() method is always produced by user clicking at the header // Thus, this operation is guaranteed to be a user action
43589
- var state = this._prepareSorting(colIndex);
43590
- if (state) {
43591
- this._sortColumn([state], { "isUserAction": true });
43669
+ this.sortColumn(colIndex, null, { "isUserAction": true });
43670
+
43671
+ var grid = hitObj["grid"];
43672
+ if(grid && grid["focus"]) {
43673
+ grid["focus"]();
43592
43674
  }
43593
43675
 
43594
43676
  if (this._hasListener("clicked")) {
43595
43677
  var ce = {};
43596
43678
  ce["colIndex"] = colIndex;
43597
43679
  ce["sortOrder"] = this.getSortOrder(colIndex);
43598
- ce["dataColumnName"] = this.getColumnSortingField(colIndex);
43680
+ ce["dataColumnName"] = this.getColumnSortingField(colIndex); // This should be deprecated
43599
43681
  this._dispatch("clicked", ce);
43600
43682
  }
43601
43683
  }
@@ -43785,7 +43867,7 @@ SortableTitlePlugin.prototype.sortSeparators = function (comparer) {
43785
43867
  var sortStateCount = this._sortStates.length;
43786
43868
  var rowDefField = SortableTitlePlugin._toRowDefField();
43787
43869
  for(var i = 0; i < sortStateCount; i++){
43788
- var sortState = this._sortStates[i];
43870
+ var sortState = this._sortStates[i];
43789
43871
  var field = this._rowDefMode ? rowDefField : sortState["field"];
43790
43872
  sortOrders.push(sortState["sortOrder"]);
43791
43873
  sortFields.push(field);
@@ -43796,19 +43878,51 @@ SortableTitlePlugin.prototype.sortSeparators = function (comparer) {
43796
43878
 
43797
43879
 
43798
43880
  /** @private
43799
- * @param {number|string} colRef Column index or field
43881
+ * @param {(number|string|SortableTitlePlugin.SortingDefinition)} sortingDef This could be column index, field, or SortingDefinition
43800
43882
  * @param {string=} sortOrder "a" for ascending, "d" for descending, and "n" for no sorting
43801
43883
  * @returns {Object} state Returns null, if nothing is changed
43802
43884
  */
43803
- SortableTitlePlugin.prototype._prepareSorting = function (colRef, sortOrder) {
43885
+ SortableTitlePlugin.prototype._prepareSorting = function (sortingDef, sortOrder) {
43804
43886
  if (!this._maxCount) {
43805
43887
  return null;
43806
43888
  }
43889
+ var host = this._hosts[0];
43890
+ if(!host) {
43891
+ return null;
43892
+ }
43807
43893
 
43808
- var colIndex = this._getColumnIndex(colRef);
43809
- var priority = this.getSortPriority(colIndex);
43810
- var field = this.getColumnSortingField(colIndex);
43894
+ var colIndex = -1;
43895
+ var colRef = "";
43896
+ if(typeof sortingDef === "number") {
43897
+ colIndex = sortingDef;
43898
+ } else if(typeof sortingDef === "string") { // This would be either column id or field
43899
+ colRef = sortingDef;
43900
+ colIndex = this._getColumnIndex(colRef);
43901
+ } else if(sortingDef && typeof sortingDef === "object") {
43902
+ colRef = sortingDef["colId"] || sortingDef["field"];
43903
+ if(colRef) {
43904
+ colIndex = this._getColumnIndex(colRef);
43905
+ } else if(typeof sortingDef["colIndex"] === "number") {
43906
+ colIndex = sortingDef["colIndex"];
43907
+ }
43908
+ if(!sortOrder) {
43909
+ sortOrder = sortingDef["sortOrder"] || sortingDef["order"] || null;
43910
+ }
43911
+ }
43912
+
43913
+ var field = "";
43914
+ var sortLogic = null;
43915
+ if(colIndex >= 0) {
43916
+ field = this.getColumnSortingField(colIndex);
43917
+ var sortOptions = this._getSortOptions(colIndex);
43918
+ if(sortOptions) {
43919
+ sortLogic = sortOptions["sortLogic"];
43920
+ }
43921
+ } else if(colRef) {
43922
+ field = colRef; // Assume that colRef is a field and not a column id
43923
+ }
43811
43924
 
43925
+ var priority = this.getSortPriority(colIndex, field);
43812
43926
  var curState = (priority >= 0) ? this._sortStates[priority] : null;
43813
43927
  var curOrder = curState ? curState["sortOrder"] : "n";
43814
43928
 
@@ -43836,7 +43950,6 @@ SortableTitlePlugin.prototype._prepareSorting = function (colRef, sortOrder) {
43836
43950
 
43837
43951
  this._sortStates.splice(priority, 1); // Remove sort states
43838
43952
  this._clearSortSymbols(curState); // Clear any previous symbols
43839
- // TODO: Other states in curState should be cleared as it is actually a sortOptions object
43840
43953
  }
43841
43954
 
43842
43955
  if (nextOrder === "a" || nextOrder === "d") { // Reorder sort states
@@ -43844,12 +43957,14 @@ SortableTitlePlugin.prototype._prepareSorting = function (colRef, sortOrder) {
43844
43957
  return null;
43845
43958
  }
43846
43959
  if (!curState) {
43847
- // TODO: Sort state object should not be sortOptions
43848
- curState = this._newSortOptions(colIndex); // This may come with sortLogic
43849
- }
43850
- if(colIndex < 0) {
43851
- curState["field"] = field;
43960
+ curState = {};
43961
+ var colId = host.getColumnId(colIndex);
43962
+ if(colId) {
43963
+ curState["colId"] = colId;
43964
+ }
43852
43965
  }
43966
+ curState["field"] = field;
43967
+ curState["sortLogic"] = sortLogic || null;
43853
43968
 
43854
43969
  this._sortStates.push(curState); // Latest sorting have lowest priority (multiColumn sorting)
43855
43970
  }
@@ -43884,31 +43999,47 @@ SortableTitlePlugin.prototype._prepareSorting = function (colRef, sortOrder) {
43884
43999
  };
43885
44000
 
43886
44001
  /** @private
43887
- * @param {Array.<Object>} states States from _prepareSorting for dispatching columnSorted event.
44002
+ * @param {Object|Array.<Object>} states States from _prepareSorting for dispatching columnSorted event.
43888
44003
  * @param {Object=} opt_arg Event argument to be sent with preDataSorting event
43889
44004
  * @fires SortableTitlePlugin#preDataSorting
43890
44005
  * @fires SortableTitlePlugin#columnSorted
43891
44006
  */
43892
44007
  SortableTitlePlugin.prototype._sortColumn = function (states, opt_arg) {
44008
+ if(!states) {
44009
+ return;
44010
+ }
44011
+
43893
44012
  this._sortDataView(opt_arg); // Update Data
43894
44013
  this.updateSortSymbols(); // Update Display
43895
44014
 
43896
- var res = states[0] || {};
43897
- var len = states.length;
43898
- if (len > 1) {
43899
- res["colIndices"] = new Array(len);
43900
- res["sortedFields"] = new Array(len);
43901
- res["sortOrders"] = new Array(len);
43902
- res["prevOrders"] = new Array(len);
43903
- for (var i = 0; i < len; i++) {
43904
- var obj = states[i];
43905
- res["colIndices"][i] = obj["colIndex"];
43906
- res["sortedFields"][i] = obj["sortedField"];
43907
- res["sortOrders"][i] = obj["sortOrder"];
43908
- res["prevOrders"][i] = obj["prevOrder"];
44015
+ var evtArg = null;
44016
+ if(Array.isArray(states)) {
44017
+ var len = states.length;
44018
+ for(var i = 0; i < len; ++i) {
44019
+ var state = states[i];
44020
+ if(state) {
44021
+ if(evtArg) {
44022
+ if(!evtArg["colIndices"]) {
44023
+ evtArg["colIndices"] = [];
44024
+ evtArg["sortedFields"] = [];
44025
+ evtArg["sortOrders"] = [];
44026
+ evtArg["prevOrders"] = [];
44027
+ }
44028
+
44029
+ evtArg["colIndices"].push(state["colIndex"]);
44030
+ evtArg["sortedFields"].push(state["sortedField"]);
44031
+ evtArg["sortOrders"].push(state["sortOrder"]);
44032
+ evtArg["prevOrders"].push(state["prevOrder"]);
44033
+ } else {
44034
+ evtArg = state;
44035
+ }
44036
+ }
43909
44037
  }
44038
+ evtArg = states[0];
44039
+ } else {
44040
+ evtArg = states;
43910
44041
  }
43911
- this._dispatch("columnSorted", res);
44042
+ this._dispatch("columnSorted", evtArg);
43912
44043
  };
43913
44044
 
43914
44045
  /** @private
@@ -43966,24 +44097,23 @@ SortableTitlePlugin.prototype._onColumnAdded = function (e) {
43966
44097
  * @fires SortableTitlePlugin#columnSorted
43967
44098
  */
43968
44099
  SortableTitlePlugin.prototype._onColumnRemoved = function (e) {
43969
- if (!e["atTheMiddle"]) { return; }
43970
-
43971
44100
  var sortCount = this._sortStates.length;
43972
44101
  if (!sortCount) {
43973
44102
  return;
43974
44103
  }
43975
- var colData = e["columnData"];
43976
- var sortOptions = colData ? colData["sortableTitle"] : null;
43977
- var sortOrder = sortOptions ? sortOptions["sortOrder"] : "";
43978
-
43979
- // TODO: columnRemoved event could be fired repeatedly and triggers multiple sorts
43980
- if (sortOrder) {
43981
- var priority = this._sortStates.indexOf(sortOptions);
43982
- if (priority >= 0) {
43983
- this._sortStates.splice(priority, 1);
44104
+ var colId = e["colId"];
44105
+ if (!colId) {
44106
+ return;
44107
+ }
44108
+ // WARNING: columnRemoved event could be fired repeatedly. Sorting could be triggered multiple times
44109
+ for(var i = 0; i < sortCount; ++i) {
44110
+ var sortState = this._sortStates[i];
44111
+ if (sortState["colId"] === colId) {
44112
+ this._sortStates.splice(i, 1);
44113
+ this._clearSortSymbols(sortState);
44114
+ this._sortDataView();
44115
+ break;
43984
44116
  }
43985
- this._clearSortSymbols(sortOptions);
43986
- this._sortDataView();
43987
44117
  }
43988
44118
  };
43989
44119
 
@@ -44077,8 +44207,8 @@ SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
44077
44207
 
44078
44208
  var section = host.getSection("title");
44079
44209
  if (section == null) { return; }
44080
- var sectionCount = section["getColumnCount"]();
44081
- for (var col = sectionCount; --col >= 0;) {
44210
+ var colCount = section["getColumnCount"]();
44211
+ for (var col = colCount; --col >= 0;) {
44082
44212
 
44083
44213
  var rowCount = section["getRowCount"]();
44084
44214
  for (var r = 0; r < rowCount; r++) {
@@ -44172,35 +44302,24 @@ SortableTitlePlugin.prototype._createIconElem = function (icon, fallback) {
44172
44302
  };
44173
44303
 
44174
44304
  /** @private
44175
- * @param {Object} sortOptions
44305
+ * @param {string|number|Object} colRef This can be sortState, column id, column field, or column index
44176
44306
  * @return {number}
44177
44307
  */
44178
- SortableTitlePlugin.prototype._getColumnIndexByOptions = function (sortOptions) {
44179
- if(sortOptions) {
44308
+ SortableTitlePlugin.prototype._getColumnIndex = function (colRef) {
44309
+ if(colRef != null) {
44180
44310
  var host = this._hosts[0];
44181
- var colCount = host ? host.getColumnCount() : 0;
44182
- for (var c = 0; c < colCount; ++c) {
44183
- var colData = host.getColumnData(c); // Equivalent to _getSortOptions() method
44184
- if (colData) {
44185
- if(sortOptions === colData["sortableTitle"]) {
44186
- return c;
44187
- }
44311
+ if(host) {
44312
+ if(typeof colRef === "number") {
44313
+ return colRef;
44314
+ } else if(typeof colRef === "string") {
44315
+ return host.getColumnIndex(colRef);
44316
+ } else {
44317
+ return host.getColumnIndex(colRef["colId"]);
44188
44318
  }
44189
44319
  }
44190
44320
  }
44191
44321
  return -1;
44192
44322
  };
44193
- /** @private
44194
- * @param {string|number} colRef
44195
- * @return {number}
44196
- */
44197
- SortableTitlePlugin.prototype._getColumnIndex = function (colRef) {
44198
- var host = this._hosts[0];
44199
- if(host && colRef != null) {
44200
- return host.getColumnIndex(colRef);
44201
- }
44202
- return -1;
44203
- };
44204
44323
 
44205
44324
  /** @private
44206
44325
  * @param {string|number} colRef
@@ -44221,10 +44340,7 @@ SortableTitlePlugin.prototype._getColumnId = function (colRef) {
44221
44340
  SortableTitlePlugin.prototype._getSortOptions = function (colIndex) {
44222
44341
  var host = this._hosts[0];
44223
44342
  if (host) {
44224
- var colData = host.getColumnData(colIndex);
44225
- if (colData) {
44226
- return colData["sortableTitle"];
44227
- }
44343
+ return host.getColumnData(colIndex)["sortableTitle"] || null;
44228
44344
  }
44229
44345
  return null;
44230
44346
  };
@@ -44356,10 +44472,10 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
44356
44472
  * @property {boolean=} columnVirtualization=false If enabled, all columns will be rendered. This will greatly impact grid's performance if the column set is huge.
44357
44473
  * @property {(number|null|boolean)=} topFreezingCount=null If number >= 0 will fix number of frozen title section, If false = disabled scrollbar, if null then title section will freeze auto when new section added, this option will not work with scrollbar option.
44358
44474
  * @property {(number|null)=} bottomFreezingCount=null If number >= 0 will fix nuber of frozen footer section, if null then footer section will freeze auto when new section added, this option will not work with scrollbar option.
44359
- * @property {boolean=} borders=true Lines around grid element
44360
- * @property {boolean=} gridlines=true Horizontal and Vertical lines for ONLY content sections
44361
- * @property {boolean=} verticalLines=true Vertical lines for all sections
44362
- * @property {boolean=} contentVerticalLines=true Vertical lines for all content section
44475
+ * @property {boolean=} borders=false Lines around grid element
44476
+ * @property {boolean=} gridlines Horizontal and Vertical lines for ONLY content sections
44477
+ * @property {boolean=} verticalLines=false Vertical lines for all sections
44478
+ * @property {boolean=} contentVerticalLines=false Vertical lines for all content section
44363
44479
  * @property {boolean=} horizontalLines=true Horizontal lines for all sections
44364
44480
  * @property {*=} RTK=null rtk toolkit instance
44365
44481
  * @property {Grid~ADCOptions=} ADC=null ADC requesting level config object from adc team
@@ -46069,7 +46185,7 @@ Grid.prototype.restoreColumns = function(columns, byId) {
46069
46185
  }
46070
46186
  }
46071
46187
  if (!found) {
46072
- removingFields.push(previousColumns[i].field);
46188
+ removingFields.push(i);
46073
46189
  }
46074
46190
  }
46075
46191
 
@@ -46085,7 +46201,7 @@ Grid.prototype.restoreColumns = function(columns, byId) {
46085
46201
  for (j = 0; j < keepingLen; j++) { // loop only keeping column
46086
46202
  if(compareLogic(columns[i], keepingColumns[j])) {
46087
46203
  found = true;
46088
- var colIndex = this.getColumnIndex(columns[i].field); // We cannot use 'i' (colIndex) in this case, as it will sort the columns. Instead, we need to obtain a new column index from the field.
46204
+ var colIndex = this.getColumnIndex(columns[i].id || columns[i].field); // We cannot use 'i' (colIndex) in this case, as it will sort the columns. Instead, we need to obtain a new column index from the field.
46089
46205
  columnOrdering.push(this.getColumnId(colIndex));
46090
46206
  break;
46091
46207
  }
@@ -47381,8 +47497,8 @@ Grid.prototype._getRowId = function(rowRef) {
47381
47497
  */
47382
47498
  Grid.prototype.getColumnIndex = function(colRef) {
47383
47499
  if(colRef) {
47384
- var colCount = this.getColumnCount();
47385
47500
  if(colRef instanceof ColumnDefinition) {
47501
+ var colCount = this.getColumnCount();
47386
47502
  for(var i = 0; i < colCount; ++i) {
47387
47503
  var colDef = this.getColumnDefinition(i);
47388
47504
  if(colDef === colRef) {