@refinitiv-ui/efx-grid 6.0.33 → 6.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.js +50 -40
  2. package/lib/core/dist/core.js +210 -38
  3. package/lib/core/dist/core.min.js +1 -1
  4. package/lib/core/es6/data/DataTable.d.ts +3 -1
  5. package/lib/core/es6/data/DataTable.js +27 -9
  6. package/lib/core/es6/data/DataView.d.ts +2 -0
  7. package/lib/core/es6/data/DataView.js +12 -1
  8. package/lib/core/es6/data/Segment.d.ts +2 -0
  9. package/lib/core/es6/data/Segment.js +16 -0
  10. package/lib/core/es6/data/SegmentCollection.d.ts +1 -3
  11. package/lib/core/es6/data/SegmentCollection.js +25 -18
  12. package/lib/core/es6/grid/Core.d.ts +12 -0
  13. package/lib/core/es6/grid/Core.js +64 -2
  14. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +13 -7
  15. package/lib/grid/index.js +1 -1
  16. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  17. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  18. package/lib/grid/themes/halo/efx-grid.less +3 -1
  19. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  20. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  21. package/lib/rt-grid/dist/rt-grid.js +766 -293
  22. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  23. package/lib/rt-grid/es6/ColumnDefinition.js +13 -8
  24. package/lib/rt-grid/es6/DataConnector.js +3 -2
  25. package/lib/rt-grid/es6/Grid.d.ts +3 -1
  26. package/lib/rt-grid/es6/Grid.js +148 -40
  27. package/lib/rt-grid/es6/RowDefSorter.d.ts +5 -5
  28. package/lib/rt-grid/es6/RowDefSorter.js +165 -71
  29. package/lib/rt-grid/es6/RowDefinition.d.ts +7 -2
  30. package/lib/rt-grid/es6/RowDefinition.js +48 -10
  31. package/lib/rt-grid/es6/SnapshotFiller.d.ts +1 -0
  32. package/lib/rt-grid/es6/SnapshotFiller.js +1 -11
  33. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +66 -0
  34. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +2 -0
  35. package/lib/tr-grid-column-stack/es6/ColumnStack.js +38 -13
  36. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +12 -5
  37. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +128 -42
  38. package/lib/tr-grid-heat-map/es6/HeatMap.d.ts +3 -3
  39. package/lib/tr-grid-heat-map/es6/HeatMap.js +13 -2
  40. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +2 -1
  41. package/lib/tr-grid-row-dragging/es6/RowDragging.js +153 -17
  42. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +3 -2
  43. package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +20 -20
  44. package/lib/tr-grid-textformatting/es6/TextFormatting.js +37 -138
  45. package/lib/tr-grid-util/es6/CellPainter.d.ts +1 -1
  46. package/lib/tr-grid-util/es6/CellPainter.js +56 -55
  47. package/lib/tr-grid-util/es6/DragUI.js +7 -3
  48. package/lib/tr-grid-util/es6/FieldFormatter.js +6 -2
  49. package/lib/tr-grid-util/es6/NumberFormatter.js +23 -11
  50. package/lib/tr-grid-util/es6/Util.d.ts +3 -0
  51. package/lib/tr-grid-util/es6/Util.js +53 -0
  52. package/lib/tr-grid-util/es6/jet/DataGenerator.js +36 -33
  53. package/lib/types/es6/ColumnStack.d.ts +2 -0
  54. package/lib/types/es6/ConditionalColoring.d.ts +12 -5
  55. package/lib/types/es6/Core/data/DataTable.d.ts +3 -1
  56. package/lib/types/es6/Core/data/DataView.d.ts +2 -0
  57. package/lib/types/es6/Core/data/Segment.d.ts +2 -0
  58. package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -3
  59. package/lib/types/es6/Core/grid/Core.d.ts +4 -0
  60. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +1 -0
  61. package/lib/types/es6/HeatMap.d.ts +3 -3
  62. package/lib/types/es6/RealtimeGrid/Grid.d.ts +3 -1
  63. package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +5 -5
  64. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +7 -2
  65. package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +1 -0
  66. package/lib/types/es6/RowDragging.d.ts +2 -1
  67. package/lib/types/es6/TextFormatting.d.ts +20 -20
  68. package/lib/versions.json +9 -9
  69. package/package.json +1 -1
@@ -150,20 +150,22 @@ Ext.inherits = function (childCtor, parentCtor) {
150
150
 
151
151
  "use strict";
152
152
  /* unused harmony export Util */
153
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return extendObject; });
153
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return extendObject; });
154
154
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return cloneObject; });
155
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isEmptyObject; });
156
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return deepEqual; });
155
157
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return arrayToObject; });
156
158
  /* unused harmony export extendProperty */
157
159
  /* unused harmony export extendArrayProperty */
158
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return parseCondition; });
159
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return prettifyCss; });
160
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return parseCondition; });
161
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return prettifyCss; });
160
162
  /* unused harmony export getShadowRoot */
161
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return injectCss; });
163
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return injectCss; });
162
164
  /* unused harmony export isIE */
163
165
  /* unused harmony export isMac */
164
166
  /* unused harmony export isTouchDevice */
165
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return nestedObjectToArray; });
166
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return rgb2Hex; });
167
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return nestedObjectToArray; });
168
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return rgb2Hex; });
167
169
  /* unused harmony export prepareTSVContent */
168
170
  /** @namespace */
169
171
  var Util = {};
@@ -305,6 +307,20 @@ var extendObject = function (obj, extender, limiters) {
305
307
  var cloneObject = function (obj, limiters) {
306
308
  return extendObject({}, obj, limiters);
307
309
  };
310
+
311
+ /** Check empty object
312
+ * @public
313
+ * @function
314
+ * @param {Object} obj
315
+ * @return {boolean}=true, if the obj is empty
316
+ */
317
+ var isEmptyObject = function (obj) {
318
+ for (var key in obj) {
319
+ return false;
320
+ }
321
+ return true;
322
+ };
323
+
308
324
  /** @public
309
325
  * @param {Array=} data
310
326
  * @param {Array.<string>=} fields In case of the given data is an array, this param will be used for mapping index to field
@@ -353,6 +369,58 @@ var extendProperty = function (obj, extender, propName) {
353
369
  }
354
370
  }
355
371
  };
372
+
373
+
374
+ /** Compare the values of obj1 and obj2. if they are the same object or have the same value, the result will be true. Otherwise, it will return false.
375
+ * @public
376
+ * @param {*} obj1
377
+ * @param {*} obj2
378
+ * @return {boolean}
379
+ */
380
+ var deepEqual = function (obj1, obj2) {
381
+
382
+ if(obj1 === obj2) {
383
+ return true;
384
+ }
385
+
386
+ if (typeof obj1 !== typeof obj2) {
387
+ return false;
388
+ }
389
+
390
+ if (typeof obj1 === "object") {
391
+
392
+ // We need to split array and object for performance reason
393
+ if(Array.isArray(obj1)) {
394
+ if(obj1.length !== obj2.length) {
395
+ return false;
396
+ }
397
+
398
+ for (var i = 0; i < obj1.length; i++) {
399
+ if (!deepEqual(obj1[i], obj2[i])) { // The array may not be a match if the elements are not sorted, so it will not be considered equal if there is a mismatch.
400
+ return false;
401
+ }
402
+ }
403
+
404
+ } else {
405
+
406
+ if (Object.keys(obj1).length !== Object.keys(obj2).length) {
407
+ return false;
408
+ }
409
+
410
+ for (var key in obj1) {
411
+ if (!deepEqual(obj1[key], obj2[key])) {
412
+ return false;
413
+ }
414
+ }
415
+ }
416
+
417
+
418
+ return true;
419
+ }
420
+
421
+ return false;
422
+
423
+ };
356
424
  /** Array.push() is much faster than Array.concat(). The downside is the parameters must be an array, whereas concat() has no such requirement. <br>
357
425
  * This method excels in extending known array property in an object.
358
426
  * @public
@@ -3475,7 +3543,7 @@ ElfUtil.injectIcons = function (configObj, optElem) {
3475
3543
  */
3476
3544
  ElfUtil.getIconList = function () {
3477
3545
  var iconStruct = ElfUtil._icons[ElfUtil.getThemeName()];
3478
- return iconStruct ? Object(Util["e" /* nestedObjectToArray */])(iconStruct) : [];
3546
+ return iconStruct ? Object(Util["g" /* nestedObjectToArray */])(iconStruct) : [];
3479
3547
  };
3480
3548
 
3481
3549
  /** @private
@@ -3767,9 +3835,9 @@ ElfUtil._retrieveThemeColors = function(profileName) {
3767
3835
  }
3768
3836
  }
3769
3837
  // WARNING: Computed styles return rgb/rgba color format instead of hex format
3770
- colors["tableBg"] = Object(Util["h" /* rgb2Hex */])(colors["tableBg"]);
3771
- colors["tableText"] = Object(Util["h" /* rgb2Hex */])(colors["tableText"]);
3772
- colors["tableBorder"] = Object(Util["h" /* rgb2Hex */])(colors["tableBorder"]);
3838
+ colors["tableBg"] = Object(Util["j" /* rgb2Hex */])(colors["tableBg"]);
3839
+ colors["tableText"] = Object(Util["j" /* rgb2Hex */])(colors["tableText"]);
3840
+ colors["tableBorder"] = Object(Util["j" /* rgb2Hex */])(colors["tableBorder"]);
3773
3841
  document.body.removeChild(tableElem);
3774
3842
 
3775
3843
  // For CellPainter backward compatability
@@ -10497,6 +10565,22 @@ Segment.prototype.getOrder = function() {
10497
10565
  }
10498
10566
  return this._order * 10000;
10499
10567
  };
10568
+ /** Get the last (highest) order from the entire tree regardless of the current position segment in the hierachy
10569
+ * @public
10570
+ * @return {number}
10571
+ */
10572
+ Segment.prototype.getLastOrder = function() {
10573
+ if(this._subSegDef) {
10574
+ var subSegments = this._subSegDef.subSegments;
10575
+ if(subSegments) {
10576
+ var lastSegment = subSegments[subSegments.length - 1];
10577
+ if(lastSegment) {
10578
+ return lastSegment.getOrder();
10579
+ }
10580
+ }
10581
+ }
10582
+ return this.getOrder();
10583
+ };
10500
10584
  /** @public
10501
10585
  * @param {number} val
10502
10586
  */
@@ -10618,9 +10702,10 @@ SegmentCollection.prototype.dispose = function() {
10618
10702
  };
10619
10703
  /** @public
10620
10704
  * @param {string} rid
10705
+ * @param {Array.<string>=} childRids Children of the newly added segment. This is a shorthand to addSegmentChildren method
10621
10706
  * @return {boolean} Returns true if there is any change. Otherwise, returns false
10622
10707
  */
10623
- SegmentCollection.prototype.addSegment = function(rid) {
10708
+ SegmentCollection.prototype.addSegment = function(rid, childRids) {
10624
10709
  if(rid && !this._segments[rid]) {
10625
10710
  if(this.getParentRowId(rid)) {
10626
10711
  console.log("child of a segment cannot be set as a segment separator");
@@ -10631,6 +10716,10 @@ SegmentCollection.prototype.addSegment = function(rid) {
10631
10716
  segment.addEventListener("subSegmentRemoved", this._onSubSegmentRemoved);
10632
10717
  ++this._segmentCount;
10633
10718
  this._segmentList = null; // order could be changed
10719
+
10720
+ if(childRids && childRids.length) {
10721
+ segment.addChildren(childRids);
10722
+ }
10634
10723
  return true;
10635
10724
  }
10636
10725
  return false;
@@ -10978,9 +11067,10 @@ SegmentCollection.prototype.calcSegmentOrder = function(rids) {
10978
11067
  };
10979
11068
  /** @public
10980
11069
  * @param {!Array.<string>} rids Array of row ids
11070
+ * @param {boolean=} partial Indicating that the given ids are not the whole list
10981
11071
  * @return {Array.<number>} Returns Array of segment values, if there are at least one segment, otherwise returns null
10982
- */
10983
- SegmentCollection.prototype.getSegmentValues = function(rids) {
11072
+ */ //
11073
+ SegmentCollection.prototype.getSegmentValues = function(rids, partial) {
10984
11074
  var rowCount = rids ? rids.length : 0;
10985
11075
  if(!rowCount) {
10986
11076
  return null;
@@ -10997,29 +11087,30 @@ SegmentCollection.prototype.getSegmentValues = function(rids) {
10997
11087
  var rid = rids[r];
10998
11088
  curSegment = segmentSeparators[rid];
10999
11089
  if(curSegment) { // segment separator
11000
- if(prevSegment !== curSegment) {
11001
- prevSegment = curSegment;
11002
- segmentVal = curSegment.getOrder() * 100;
11003
- if(segmentVal > highestVal) {
11004
- highestVal = segmentVal;
11090
+ segmentVal = curSegment.getOrder() * 100;
11091
+ offset = 0;
11092
+ if(!curSegment.isSubSegment()) {
11093
+ if(prevSegment !== curSegment) {
11094
+ prevSegment = curSegment;
11095
+ highestVal = curSegment.getLastOrder() * 100;
11005
11096
  }
11006
11097
  }
11007
- offset = 0;
11008
11098
  } else {
11009
11099
  var parentId = childToSegmentId[rid];
11010
11100
  if(parentId) { // segment member
11011
11101
  curSegment = segmentSeparators[parentId];
11012
- if(prevSegment !== curSegment) {
11013
- prevSegment = curSegment;
11014
- segmentVal = curSegment.getOrder() * 100;
11015
- if(segmentVal > highestVal) {
11016
- highestVal = segmentVal;
11017
- }
11018
- }
11102
+ segmentVal = curSegment.getOrder() * 100;
11019
11103
  offset = 1;
11104
+ if(partial) {
11105
+ highestVal = curSegment.getLastOrder() * 100;
11106
+ }
11020
11107
  } else { // row outside of segments
11021
- segmentVal = highestVal;
11022
- offset = 10;
11108
+ if(highestVal) {
11109
+ segmentVal = highestVal;
11110
+ offset = 10;
11111
+ } else {
11112
+ segmentVal = offset = 0;
11113
+ }
11023
11114
  }
11024
11115
  }
11025
11116
 
@@ -12038,7 +12129,24 @@ DataTable.prototype.setSortingLogic = function(func) {
12038
12129
  * @param {DataTable.SortLogic} func Use null to remove current sorting logic
12039
12130
  */
12040
12131
  DataTable.prototype.setColumnSortingLogic = function(cid, func) {
12041
- this._compMap[cid] = func;
12132
+ if(cid) {
12133
+ this._compMap[cid] = func;
12134
+ }
12135
+ };
12136
+ /** Get sorting logic for the specified field. Default logic is returned, if no logic is specified for the column
12137
+ * @public
12138
+ * @param {string=} cid
12139
+ * @return {DataTable.SortLogic}
12140
+ */
12141
+ DataTable.prototype.getColumnSortingLogic = function(cid) {
12142
+ if(cid) {
12143
+ var logic = this._compMap[cid];
12144
+ if(logic) {
12145
+ return logic;
12146
+ }
12147
+ }
12148
+
12149
+ return this._compMap["_default"] || null;
12042
12150
  };
12043
12151
 
12044
12152
  /** Freeze data table so that no event is fired for data processing until executing {@link DataTable#unfreeze} method
@@ -12201,11 +12309,12 @@ DataTable.prototype.getSegmentParentRowId = function(rid) {
12201
12309
  /**
12202
12310
  * @public
12203
12311
  * @param {Array.<string>=} rids If no row id is given, row ids of this data table is used instead
12312
+ * @param {boolean=} partial Indicating that the given ids are not the whole list
12204
12313
  * @return {Array.<number>} Return null if there is no segmentation
12205
12314
  */
12206
- DataTable.prototype.getSegmentValues = function(rids) {
12315
+ DataTable.prototype.getSegmentValues = function(rids, partial) {
12207
12316
  if(this._segments) {
12208
- return this._segments.getSegmentValues(rids || this._rids);
12317
+ return this._segments.getSegmentValues(rids || this._rids, partial);
12209
12318
  }
12210
12319
  return null;
12211
12320
  };
@@ -12288,9 +12397,9 @@ DataTable.prototype.addSegmentChild = function(segmentId, rid, dataId) {
12288
12397
  if(this._segments) {
12289
12398
  var dirty = this._segments.addSegmentChild(segmentId, rid, dataId);
12290
12399
  if(dirty) {
12291
- if(this._sort(null)) {
12292
- this._dispatchPositionChange();
12293
- }
12400
+ this._sort(null);
12401
+ this._dispatchPositionChange(); // Force rerendering, even if there is no position change
12402
+
12294
12403
  this.requestClassifying();
12295
12404
  return true;
12296
12405
  }
@@ -12307,9 +12416,9 @@ DataTable.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
12307
12416
  if(this._segments) {
12308
12417
  var dirty = this._segments.addSegmentChildren(segmentId, rids, dataIds);
12309
12418
  if(dirty) {
12310
- if(this._sort(null)) {
12311
- this._dispatchPositionChange();
12312
- }
12419
+ this._sort(null);
12420
+ this._dispatchPositionChange(); // Force rerendering, even if there is no position change
12421
+
12313
12422
  this.requestClassifying();
12314
12423
  return true;
12315
12424
  }
@@ -13062,6 +13171,7 @@ DataTable._proto = DataTable.prototype;
13062
13171
  /** @typedef {Object} RowDefinition~Options
13063
13172
  * @description RowDefinition options
13064
13173
  * @property {string=} ric="" RIC for real-time fields. Prefixing 0# to the ric is equivalent to specifying asChain property.
13174
+ * @property {string=} permId="" Organization PermId to be used instead of ric for private company.
13065
13175
  * @property {(Array|Object)=} values=null Values for static data
13066
13176
  * @property {Array.<string>=} fields=null Field that corresponds to the given static values
13067
13177
  * @property {boolean=} asChain=false The given ric will be treated as a chain
@@ -13143,6 +13253,10 @@ RowDefinition.prototype._ric = ""; // Contains no 0#
13143
13253
  /** @type {string}
13144
13254
  * @private
13145
13255
  */
13256
+ RowDefinition.prototype._permId = "";
13257
+ /** @type {string}
13258
+ * @private
13259
+ */
13146
13260
  RowDefinition.prototype._displayText = "";
13147
13261
  /** @type {string|null}
13148
13262
  * @private
@@ -13268,13 +13382,20 @@ RowDefinition.prototype.initialize = function(rowOptions) {
13268
13382
 
13269
13383
  var val = rowOptions["ric"];
13270
13384
  if(val != null) {
13271
- this.setContent(/** @type{string} */(val)); // this._dataId is modified
13385
+ this._ric = val;
13386
+ }
13387
+ val = rowOptions["permId"];
13388
+ if(val != null) {
13389
+ this._permId = val;
13272
13390
  }
13391
+ if(this._ric || this._permId){
13392
+ this.setContent(this._ric, this._permId); // this._dataId is modified
13393
+ }
13394
+
13273
13395
  val = rowOptions["chainRic"];
13274
13396
  if(val != null) {
13275
13397
  this._chainRic = val;
13276
13398
  }
13277
-
13278
13399
  val = rowOptions["values"];
13279
13400
  // eslint-disable-next-line no-undefined
13280
13401
  if(val !== undefined) {
@@ -13328,10 +13449,11 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
13328
13449
  }
13329
13450
  };
13330
13451
  /** @public
13331
- * @param {string} userInput
13452
+ * @param {string} userInput RIC
13453
+ * @param {string=} permId=null Organization PermId, which use for getting ADC data for private company
13332
13454
  * @return {boolean} True if there is any change otherwise false
13333
13455
  */
13334
- RowDefinition.prototype.setContent = function(userInput) {
13456
+ RowDefinition.prototype.setContent = function(userInput, permId) {
13335
13457
  if(this._autoGenerated) { // AutoGenerated RowDefinition cannot be changed by user input
13336
13458
  return false;
13337
13459
  }
@@ -13342,7 +13464,15 @@ RowDefinition.prototype.setContent = function(userInput) {
13342
13464
  userInput += "";
13343
13465
  }
13344
13466
 
13345
- if(this._userInput === userInput) {
13467
+ var dirty = (this._userInput !== userInput);
13468
+ if(this._permId !== permId){
13469
+ this._permId = permId || "";
13470
+ if(!userInput){
13471
+ this._displayText = this._permId;
13472
+ dirty = true;
13473
+ }
13474
+ }
13475
+ if(!dirty) {
13346
13476
  return false;
13347
13477
  }
13348
13478
 
@@ -13369,7 +13499,7 @@ RowDefinition.prototype.setContent = function(userInput) {
13369
13499
  this._displayText = this._ric; // No 0#
13370
13500
  }
13371
13501
 
13372
- this._dataId = this._rowId + this._ric; // JET/RTK will generate data id to be rowId (given from this rowDef) + ric;
13502
+ this._dataId = this._rowId + this.getSymbol(); // JET/RTK will generate data id to be rowId (given from this rowDef) + ric;
13373
13503
 
13374
13504
  // This will work for runtime ric modification, but not for first initilization.
13375
13505
  if(!this.subscribeForUpdates()) {
@@ -13397,6 +13527,11 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
13397
13527
  obj["ric"] = val;
13398
13528
  }
13399
13529
 
13530
+ val = this._permId;
13531
+ if(val) {
13532
+ obj["permId"] = val;
13533
+ }
13534
+
13400
13535
  val = this._chainRic;
13401
13536
  if(val) {
13402
13537
  obj["chainRic"] = val;
@@ -13642,6 +13777,18 @@ RowDefinition.prototype.getRic = function() {
13642
13777
  /** @public
13643
13778
  * @return {string}
13644
13779
  */
13780
+ RowDefinition.prototype.getPermId = function() {
13781
+ return this._permId;
13782
+ };
13783
+ /** @public
13784
+ * @return {string}
13785
+ */
13786
+ RowDefinition.prototype.getSymbol = function() {
13787
+ return this._ric || this._permId;
13788
+ };
13789
+ /** @public
13790
+ * @return {string}
13791
+ */
13645
13792
  RowDefinition.prototype.getDisplayText = function() {
13646
13793
  if(this._label != null) { // Empty string is allowed
13647
13794
  return this._label;
@@ -13707,7 +13854,7 @@ RowDefinition.prototype.isAutoGenerated = function() {
13707
13854
  * @return {boolean}
13708
13855
  */
13709
13856
  RowDefinition.prototype.isRealTimeRow = function() {
13710
- if(!this._ric) { // Empty row
13857
+ if(!this.getRic()) { // Empty row
13711
13858
  return false;
13712
13859
  }
13713
13860
  if(this.isRowHeader()) {
@@ -13724,7 +13871,7 @@ RowDefinition.prototype.isRealTimeRow = function() {
13724
13871
  * @return {boolean} If a subscription is made, return true.
13725
13872
  */
13726
13873
  RowDefinition.prototype.subscribeForUpdates = function() {
13727
- if(!this.isRealTimeRow()) {
13874
+ if(!this.isRealTimeRow() && !this.getPermId()) {
13728
13875
  return false;
13729
13876
  }
13730
13877
 
@@ -13738,14 +13885,14 @@ RowDefinition.prototype.subscribeForUpdates = function() {
13738
13885
  if(this.isChain()) {
13739
13886
  this._subId = subs["addChain"](this._chainRic || this._ric, this._rowId); // Some chain require 0# symbol to populate its constituents
13740
13887
  // TODO: Handle Dynamic chain such as .PG.PA
13741
- } else {
13888
+ } else if(this._ric) {
13742
13889
  this._subId = subs["addRic"](this._ric, this._rowId);
13743
13890
  }
13744
13891
 
13745
13892
  if(prevRowData) {
13746
13893
  this._dc.setRowData(this._dataId, prevRowData); // TODO: We may need to create a new object instead of prevRowData for data correctness
13747
13894
  } else {
13748
- this._dc.setRowData(this._dataId, {"X_RIC_NAME": this._ric, "ROW_DEF": this}); // Trigger data update immediately
13895
+ this._dc.setRowData(this._dataId, {"X_RIC_NAME": this.getSymbol(), "ROW_DEF": this}); // Trigger data update immediately
13749
13896
  }
13750
13897
  return true;
13751
13898
  };
@@ -15402,7 +15549,7 @@ ColumnDefinition.prototype.getAllFields = function() {
15402
15549
  * @return {boolean}
15403
15550
  */
15404
15551
  ColumnDefinition.prototype.isRealTimeField = function() {
15405
- return js_FieldDefinition.isRealTimeField(this.getField());
15552
+ return js_FieldDefinition.isRealTimeField(this.getField() || this._field);
15406
15553
  };
15407
15554
  /** @public
15408
15555
  * @return {boolean}
@@ -15593,8 +15740,9 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
15593
15740
  obj["sort"] = this._initialOrder;
15594
15741
  }
15595
15742
 
15596
- if(this._classes) {
15597
- obj["className"] = this._classes.join(" ");
15743
+ var classes = this._classes;
15744
+ if(classes && classes.length > 0) {
15745
+ obj["className"] = classes.join(" ");
15598
15746
  }
15599
15747
 
15600
15748
  if(this._textSelect) {
@@ -15612,14 +15760,18 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
15612
15760
  var core = this._eventArg["core"];
15613
15761
  var grid = this._eventArg["grid"];
15614
15762
  var colIndex = grid.getColumnIndex(this);
15615
- value = core.getColumnScalability(colIndex);
15616
- obj["scalable"] = value;
15617
15763
 
15618
- value = core.getColumnCustomLaneSize(colIndex);
15619
- obj["width"] = value;
15764
+ // The scalable, width and minWidth cannot be shifted into core as getConfigObject is accessible from colDef.
15765
+ var scalable = core.getColumnScalability(colIndex);
15766
+ var width = core.getColumnCustomLaneSize(colIndex);
15767
+
15768
+ if (scalable !== true || width !== 1) {
15769
+ obj["scalable"] = scalable;
15770
+ obj["width"] = width;
15771
+ }
15620
15772
 
15621
15773
  value = core.getMinimumColumnWidth(colIndex);
15622
- if(value !== 32) {
15774
+ if(value !== 0) {
15623
15775
  obj["minWidth"] = value;
15624
15776
  }
15625
15777
 
@@ -15976,16 +16128,6 @@ ColumnDefinition.prototype._setCoreColumnDef = function(obj) {
15976
16128
 
15977
16129
 
15978
16130
 
15979
- /** @private
15980
- * @param {Object} obj
15981
- * @return {boolean}
15982
- */
15983
- var isEmptyObject = function (obj) {
15984
- for (var key in obj) {
15985
- return false;
15986
- }
15987
- return true;
15988
- };
15989
16131
 
15990
16132
  /** This class make requesting ADC field easier by encapsulating JET.Data APIs and mapping data to the row
15991
16133
  * @constructor
@@ -16305,7 +16447,7 @@ SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
16305
16447
  var updatedData = {};
16306
16448
  for (ric in ricMap) {
16307
16449
  var obj = ricMap[ric];
16308
- if (!isEmptyObject(obj)) {
16450
+ if (!Object(Util["f" /* isEmptyObject */])(obj)) {
16309
16451
  updatedData[ric] = obj;
16310
16452
  }
16311
16453
  }
@@ -16378,7 +16520,7 @@ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
16378
16520
  var updatedData = {};
16379
16521
  for (ric in ricMap) {
16380
16522
  var obj = ricMap[ric];
16381
- if (!isEmptyObject(obj)) {
16523
+ if (!Object(Util["f" /* isEmptyObject */])(obj)) {
16382
16524
  updatedData[ric] = obj;
16383
16525
  }
16384
16526
  }
@@ -16448,7 +16590,7 @@ SnapshotFiller.prototype._onRTKTimeSeriesSuccess = function (fields, serverResul
16448
16590
  var dataMapping = {};
16449
16591
  for (ric in ricMap) {
16450
16592
  var obj = ricMap[ric];
16451
- if (!isEmptyObject(obj)) {
16593
+ if (!Object(Util["f" /* isEmptyObject */])(obj)) {
16452
16594
  dataMapping[ric] = obj;
16453
16595
  }
16454
16596
  }
@@ -29320,6 +29462,17 @@ DataView.prototype.setColumnSortingLogic = function(cid, func) {
29320
29462
  this._dt.setColumnSortingLogic(cid, func);
29321
29463
  }
29322
29464
  };
29465
+ /** Get sorting logic for the specified field. Default logic is returned, if no logic is specified for the column
29466
+ * @public
29467
+ * @param {string=} cid
29468
+ * @return {DataTable.SortLogic}
29469
+ */
29470
+ DataView.prototype.getColumnSortingLogic = function(cid) {
29471
+ if(this._dt) {
29472
+ return this._dt.getColumnSortingLogic(cid);
29473
+ }
29474
+ return null;
29475
+ };
29323
29476
  /** Check if this view is in sorting mode
29324
29477
  * @public
29325
29478
  * @return {boolean}
@@ -31837,7 +31990,7 @@ DataView.prototype._sort = function() {
31837
31990
  if(this._dt._getSegmentSeparators() || this.isSorting()) {
31838
31991
  var rids = this._rids;
31839
31992
  var dataRows = this._dt.getMultipleRowData(rids);
31840
- var segmentValues = this._dt.getSegmentValues(rids);
31993
+ var segmentValues = this._dt.getSegmentValues(rids, true); // WARNING: This does not work well for hidden/filtered rows
31841
31994
  var change = data_DataTable._performMultiLevelSorting(dataRows, this._sortingDefs, segmentValues);
31842
31995
 
31843
31996
  if(change) {
@@ -35056,6 +35209,7 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
35056
35209
 
35057
35210
  // eslint-disable-line
35058
35211
 
35212
+
35059
35213
  // eslint-disable-line
35060
35214
 
35061
35215
 
@@ -35255,7 +35409,9 @@ var Core = function (opt_initializer) {
35255
35409
  "rowRemoved",
35256
35410
  "columnPositionChanged",
35257
35411
  "rowPositionChanged",
35258
- "beforeColumnBoundUpdate"
35412
+ "beforeColumnBoundUpdate",
35413
+ "beforeBatchOperation",
35414
+ "afterBatchOperation"
35259
35415
  );
35260
35416
 
35261
35417
  // For debugging in advanced optimization mode
@@ -35330,6 +35486,15 @@ Core.SectionReference;
35330
35486
  */
35331
35487
  Core.MouseInfo;
35332
35488
 
35489
+ /** @typedef {Object} Core~BatchInfo
35490
+ * @private
35491
+ * @property {string=} reset //set columns
35492
+ * @property {string=} insertion //add cols
35493
+ * @property {string=} removal //remove cols
35494
+ * @property {string=} moving //reorder
35495
+ */
35496
+ Core.BatchInfo;
35497
+
35333
35498
  /** @typedef {Core.MouseInfo|ElementWrapper|Element} Core~CellReference
35334
35499
  * @description A section in core grid can be refered by the following object <br>
35335
35500
  * `{Core.MouseInfo}` : Object with valid x, y coordinates and section index <br>
@@ -35584,6 +35749,10 @@ Core.prototype._rowHeightTimerId = 0;
35584
35749
  * @private
35585
35750
  */
35586
35751
  Core.prototype._groupDefs = null;
35752
+ /** @type {BatchInfo}
35753
+ * @private
35754
+ */
35755
+ Core.prototype._batches = null;
35587
35756
  //#region Public Methods
35588
35757
 
35589
35758
  /**
@@ -35591,7 +35760,7 @@ Core.prototype._groupDefs = null;
35591
35760
  * @return {string}
35592
35761
  */
35593
35762
  Core.getVersion = function () {
35594
- return "5.1.41";
35763
+ return "5.1.48";
35595
35764
  };
35596
35765
  /** {@link ElementWrapper#dispose}
35597
35766
  * @override
@@ -35727,10 +35896,10 @@ Core.prototype.getConfigObject = function (gridOptions) {
35727
35896
  }
35728
35897
  }
35729
35898
 
35730
- if(this._rowHighlighting) {
35731
- obj["rowHighlighting"] = true;
35732
- }
35733
- obj["columnVirtualization"] = this._colVirtualizer.isEnabled();
35899
+ // It will be overwrite in rt-grid or atlas-blotter
35900
+ obj["rowVirtualization"] = this.isRowVirtualizationEnabled();
35901
+ obj["columnVirtualization"] = this.isColumnVirtualizationEnabled();
35902
+ obj["rowHighlighting"] = this._rowHighlighting;
35734
35903
 
35735
35904
  if(this._fixFrozenTopSections) {
35736
35905
  obj["topFreezingCount"] = this._startVScrollbarIndex >= 0 ? (this._startVScrollbarIndex + 1) : false;
@@ -35743,7 +35912,13 @@ Core.prototype.getConfigObject = function (gridOptions) {
35743
35912
  if(this._rowScrollingStep) {
35744
35913
  obj["stepScroll"] = (this._rowScrollingStep === 1) ? true : this._rowScrollingStep;
35745
35914
  }
35746
- obj["autoHideScrollbar"] = this._vscrollbar.getAutoHide(); // this._hscrollbar has the same settings
35915
+
35916
+ var val = this._vscrollbar.getAutoHide();
35917
+ if(val !== true) {
35918
+ // TODO: check this._hscrollbar and this._vscrollbar can be difference config
35919
+ obj["autoHideScrollbar"] = val; // this._hscrollbar has the same settings
35920
+ }
35921
+
35747
35922
  var wheelSpeed = this._vscrollbar.getMouseWheelSpeed();
35748
35923
  if(wheelSpeed) {
35749
35924
  obj["linearWheelScrolling"] = wheelSpeed;
@@ -36524,6 +36699,10 @@ Core.prototype.removeColumnAt = function (index) {
36524
36699
 
36525
36700
  if (this._hasListener("columnRemoved")) {
36526
36701
  var e = {};
36702
+ var batches = this._batches;
36703
+ if(batches){
36704
+ e["batches"] = batches;
36705
+ }
36527
36706
  e["atTheMiddle"] = true;
36528
36707
  e["colIndex"] = index;
36529
36708
  e["columns"] = "deprecated";
@@ -38716,6 +38895,14 @@ Core.prototype.enableRowVirtualization = function (opt_enabled) {
38716
38895
  this._rowVirtualizer.deactivate();
38717
38896
  }
38718
38897
  };
38898
+
38899
+ /** @public
38900
+ * @return {boolean}
38901
+ */
38902
+ Core.prototype.isRowVirtualizationEnabled = function () {
38903
+ return this._rowVirtualizer.isEnabled();
38904
+ };
38905
+
38719
38906
  /** No runtime support
38720
38907
  * @public
38721
38908
  * @param {boolean=} opt_enabled
@@ -38730,6 +38917,13 @@ Core.prototype.enableColumnVirtualization = function (opt_enabled) {
38730
38917
  }
38731
38918
  };
38732
38919
 
38920
+ /** @public
38921
+ * @return {boolean}
38922
+ */
38923
+ Core.prototype.isColumnVirtualizationEnabled = function () {
38924
+ return this._colVirtualizer.isEnabled();
38925
+ };
38926
+
38733
38927
  /** Scrolling step will be multiple of the default row height in pixels. For example, if default row height is 32 pixel and row scrolling step is 2, <br>
38734
38928
  * then the actual scrolling step for vertical scrollbar will be (32 * 2) = 64 pixels
38735
38929
  * @public
@@ -39353,6 +39547,40 @@ Core.prototype.getColumnGroupChildIds = function (groupId) {
39353
39547
  }
39354
39548
  return null;
39355
39549
  };
39550
+
39551
+ /** @public
39552
+ * @param {string} batchType
39553
+ * @return {boolean}
39554
+ * @fires Core#beforeBatchOperation
39555
+ */
39556
+ Core.prototype.startBatch = function (batchType) {
39557
+ if(!batchType){
39558
+ return false;
39559
+ }
39560
+ if(!this._batches){
39561
+ this._batches = {};
39562
+ }
39563
+ this._batches[batchType] = batchType;
39564
+ this._dispatch("beforeBatchOperation", { batches: this._batches, batchType: batchType });
39565
+ return true;
39566
+ };
39567
+ /** @public
39568
+ * @param {string} batchType
39569
+ * @return {boolean}
39570
+ * @fires Core#afterBatchOperation
39571
+ */
39572
+ Core.prototype.stopBatch = function (batchType) {
39573
+ if(!batchType){
39574
+ return false;
39575
+ }
39576
+ this._dispatch("afterBatchOperation", { batches: this._batches, batchType: batchType });
39577
+
39578
+ delete this._batches[batchType];
39579
+ if(Object(Util["f" /* isEmptyObject */])(this._batches)){
39580
+ this._batches = null;
39581
+ }
39582
+ return true;
39583
+ };
39356
39584
  //#endregion Public Methods
39357
39585
 
39358
39586
  //#region Private Methods
@@ -39596,6 +39824,10 @@ Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle, ctx
39596
39824
  if (this._hasListener("columnAdded")) {
39597
39825
  var e = {};
39598
39826
  e["atTheMiddle"] = atTheMiddle;
39827
+ var batches = this._batches;
39828
+ if(batches){
39829
+ e["batches"] = batches;
39830
+ }
39599
39831
  if(count === 1) {
39600
39832
  e["colIndex"] = at;
39601
39833
  e["context"] = ctx;
@@ -39747,6 +39979,10 @@ Core.prototype._removeColumn = function (num) { // TODO: change the logic to us
39747
39979
 
39748
39980
  if (this._hasListener("columnRemoved")) {
39749
39981
  var e = {};
39982
+ var batches = this._batches;
39983
+ if(batches){
39984
+ e["batches"] = batches;
39985
+ }
39750
39986
  for (var c = colCount; --c >= newCount; ) {
39751
39987
  var colDef = removedCols[c - newCount];
39752
39988
  e["colIndex"] = c;
@@ -40746,7 +40982,7 @@ StyleLoader.chainIcon = '';
40746
40982
  /** @type {string}
40747
40983
  * @public
40748
40984
  */
40749
- StyleLoader.styles = Object(Util["g" /* prettifyCss */])([
40985
+ StyleLoader.styles = Object(Util["i" /* prettifyCss */])([
40750
40986
  ".tr-grid .chain-icon", [
40751
40987
  "cursor: pointer;"
40752
40988
  ],
@@ -40769,7 +41005,7 @@ StyleLoader.styles = Object(Util["g" /* prettifyCss */])([
40769
41005
  StyleLoader.applyStyle = function (grid) {
40770
41006
  if (grid && !grid._rowGroupingStyles) { // TODO: Support run-time theme loading
40771
41007
  grid._rowGroupingStyles = true; // Prevent loading the same style twice
40772
- Object(Util["d" /* injectCss */])(StyleLoader.styles, grid.getElement());
41008
+ Object(Util["e" /* injectCss */])(StyleLoader.styles, grid.getElement());
40773
41009
  }
40774
41010
  };
40775
41011
 
@@ -41107,7 +41343,7 @@ DataConnector.prototype.getRowDefByRic = function (ric) {
41107
41343
  * @return {boolean} True if new reference is added.
41108
41344
  */
41109
41345
  DataConnector.prototype.addRic = function (rowDef) {
41110
- var ric = rowDef ? rowDef.getRic() : "";
41346
+ var ric = rowDef ? rowDef.getSymbol() : "";
41111
41347
  if(!ric) {
41112
41348
  return false;
41113
41349
  }
@@ -41135,7 +41371,8 @@ DataConnector.prototype.addRic = function (rowDef) {
41135
41371
  */
41136
41372
  DataConnector.prototype.removeRic = function (rowDef, ric) {
41137
41373
  if(!ric) {
41138
- ric = rowDef ? rowDef.getRic() : "";
41374
+ // TODO: RIC or permId maybe change during run-time, need to check before remove RIC/permId
41375
+ ric = rowDef ? rowDef.getSymbol() : "";
41139
41376
  }
41140
41377
  if(!ric) {
41141
41378
  return;
@@ -41296,73 +41533,150 @@ DataConnector.prototype.reset = function () {
41296
41533
  /* harmony default export */ var js_DataConnector = (DataConnector);
41297
41534
 
41298
41535
  // CONCATENATED MODULE: ./src/js/RowDefSorter.js
41536
+
41537
+
41538
+ /** @private
41539
+ * @param {*} a
41540
+ * @param {*} b
41541
+ * @param {number} order
41542
+ * @return {number}
41543
+ */
41544
+ var _defaultCompare = function(a, b, order) {
41545
+ if(a == null || a !== a) {
41546
+ if(b == null || b !== b) {
41547
+ return 0;
41548
+ }
41549
+ return 1;
41550
+ }
41551
+ if(b == null || b !== b) {
41552
+ return -1;
41553
+ }
41554
+
41555
+ if(a < b) {
41556
+ return -order;
41557
+ }
41558
+ if(b < a) {
41559
+ return order;
41560
+ }
41561
+ return 0;
41562
+ };
41563
+
41299
41564
  /** @constructor
41300
41565
  */
41301
41566
  var RowDefSorter = function() {
41302
41567
  this._defaultSorter = this._defaultSorter.bind(this);
41303
41568
  this._dataSorter = this._dataSorter.bind(this);
41304
41569
  this._rowDefSorter = this._rowDefSorter.bind(this);
41570
+ this._multiColumnsSorter = this._multiColumnsSorter.bind(this);
41305
41571
 
41306
- this._sortContext = {};
41572
+ this._globalContext = {};
41573
+ this._sortParams = [];
41574
+ this._ctxCaches = [];
41307
41575
  };
41308
41576
 
41309
-
41310
- /** @type {string}
41577
+ /** @type {!Object}
41311
41578
  * @private
41312
41579
  */
41313
- RowDefSorter.prototype._field = "";
41314
- /** @type {!Object}
41580
+ RowDefSorter.prototype._globalContext;
41581
+ /** @type {!Array.<Array>}
41315
41582
  * @private
41316
41583
  */
41317
- RowDefSorter.prototype._sortContext;
41318
- /** @type {Function}
41584
+ RowDefSorter.prototype._sortParams;
41585
+ /** @type {!Array.<Object>}
41586
+ * @private
41587
+ */
41588
+ RowDefSorter.prototype._ctxCaches;
41589
+ /** @type {Array}
41319
41590
  * @private
41320
41591
  */
41321
- RowDefSorter.prototype._sortLogic = null;
41592
+ RowDefSorter.prototype._primaryParams;
41322
41593
 
41323
41594
 
41324
41595
  /** @public
41325
41596
  */
41326
41597
  RowDefSorter.prototype.dispose = function() {
41327
- this._sortLogic = null;
41328
- this._sortContext = {}; // Clear any existing reference
41598
+ this._globalContext = {}; // Clear any existing reference
41599
+ this._sortParams.length = 0;
41600
+ this._ctxCaches.length = 0;
41601
+ this._primaryParams = null;
41329
41602
  };
41330
41603
 
41331
41604
  /** @public
41332
- * @param {boolean=} rowSorting=false
41333
41605
  * @return {Function}
41334
41606
  */
41335
- RowDefSorter.prototype.getSorter = function(rowSorting) {
41336
- if(this._sortLogic) {
41337
- return rowSorting ? this._rowDefSorter : this._dataSorter;
41338
- } else {
41339
- return this._defaultSorter;
41607
+ RowDefSorter.prototype.getSorter = function() {
41608
+ this._primaryParams = null;
41609
+ var sortCount = this._sortParams.length;
41610
+ if(sortCount === 1) {
41611
+ var params = this._primaryParams = this._sortParams[0];
41612
+ var sortLogic = params[1];
41613
+ if(sortLogic) {
41614
+ var rowSorting = params[3];
41615
+ return rowSorting ? this._rowDefSorter : this._dataSorter;
41616
+ } else {
41617
+ return this._defaultSorter;
41618
+ }
41619
+ } else if(sortCount > 1) {
41620
+ return this._multiColumnsSorter;
41340
41621
  }
41341
- };
41342
- /** @public
41343
- * @param {Function=} func
41344
- */
41345
- RowDefSorter.prototype.setSortLogic = function(func) {
41346
- this._sortLogic = (typeof func === "function") ? func : null;
41347
- };
41348
41622
 
41623
+ return RowDefSorter._noSorting;
41624
+ };
41349
41625
 
41350
41626
  /** @public
41351
- * @param {string} field
41627
+ * @param {string} key
41628
+ * @param {*} value
41352
41629
  */
41353
- RowDefSorter.prototype.setField = function(field) {
41354
- if(!field) {
41355
- field = "";
41630
+ RowDefSorter.prototype.reset = function() {
41631
+ if(this._sortParams.length) {
41632
+ this._sortParams.length = 0;
41356
41633
  }
41357
- this._sortContext["field"] = this._field = field;
41358
- this._sortContext["formattedField"] = field + "_FORMATTED";
41359
41634
  };
41360
41635
  /** @public
41361
41636
  * @param {string} key
41362
41637
  * @param {*} value
41363
41638
  */
41364
41639
  RowDefSorter.prototype.setContext = function(key, value) {
41365
- this._sortContext[key] = value;
41640
+ this._globalContext[key] = value;
41641
+ };
41642
+ /** @public
41643
+ * @param {string} field
41644
+ * @param {Function} logic
41645
+ * @param {boolean} rowSorting
41646
+ * @param {string} order
41647
+ * @param {number} colIndex
41648
+ * @param {*} colDef
41649
+ */
41650
+ RowDefSorter.prototype.addColumnContext = function(field, logic, rowSorting, order, colIndex, colDef) {
41651
+ if(!field) {
41652
+ field = "";
41653
+ }
41654
+ var sortPriority = this._sortParams.length;
41655
+ var ctx = this._ctxCaches[sortPriority];
41656
+ if(!ctx) {
41657
+ ctx = this._ctxCaches[sortPriority] = Object(Util["b" /* cloneObject */])(this._globalContext);
41658
+ }
41659
+ var orderNum = 0;
41660
+ if(order === "a") {
41661
+ orderNum = 1;
41662
+ } else if(order === "d") {
41663
+ orderNum = -1;
41664
+ }
41665
+
41666
+ var params = [
41667
+ field, // 0
41668
+ (typeof logic === "function") ? logic : null, // 1
41669
+ ctx, // 2
41670
+ rowSorting, // 3
41671
+ orderNum // 4
41672
+ ];
41673
+
41674
+ ctx["colIndex"] = colIndex;
41675
+ ctx["field"] = field;
41676
+ ctx["formattedField"] = field + "_FORMATTED";
41677
+ ctx["colDef"] = colDef;
41678
+
41679
+ this._sortParams.push(params);
41366
41680
  };
41367
41681
 
41368
41682
  /** @private
@@ -41371,32 +41685,7 @@ RowDefSorter.prototype.setContext = function(key, value) {
41371
41685
  * @param {number} order
41372
41686
  * @return {number}
41373
41687
  */
41374
- RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
41375
- var orderA = rowDefA.getGroupOrder();
41376
- var orderB = rowDefB.getGroupOrder();
41377
- if(orderA !== orderB) {
41378
- return orderA - orderB; // Regardless of sort order
41379
- }
41380
-
41381
- var a = rowDefA.getData(this._field);
41382
- var b = rowDefB.getData(this._field);
41383
-
41384
- if(a == null || a !== a) {
41385
- if(b == null || b !== b) {
41386
- return 0;
41387
- }
41388
- return 1;
41389
- }
41390
- if(b == null || b !== b) {
41391
- return -1;
41392
- }
41393
-
41394
- if(a < b) {
41395
- return -order;
41396
- }
41397
- if(b < a) {
41398
- return order;
41399
- }
41688
+ RowDefSorter._noSorting = function(rowDefA, rowDefB, order) {
41400
41689
  return 0;
41401
41690
  };
41402
41691
  /** @private
@@ -41405,16 +41694,30 @@ RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
41405
41694
  * @param {number} order
41406
41695
  * @return {number}
41407
41696
  */
41697
+ RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
41698
+ var field = this._primaryParams[0];
41699
+ return _defaultCompare(
41700
+ rowDefA.getData(field),
41701
+ rowDefB.getData(field),
41702
+ order
41703
+ );
41704
+ };
41705
+ /** @private
41706
+ * @param {RowDefinition} rowDefA
41707
+ * @param {RowDefinition} rowDefB
41708
+ * @param {number} order
41709
+ * @return {number}
41710
+ */
41408
41711
  RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
41409
- var orderA = rowDefA.getGroupOrder();
41410
- var orderB = rowDefB.getGroupOrder();
41411
- if(orderA !== orderB) {
41412
- return orderA - orderB; // Regardless of sort order
41413
- }
41414
-
41415
- var a = rowDefA.getData(this._field);
41416
- var b = rowDefB.getData(this._field);
41417
- return this._sortLogic(a, b, order, this._sortContext);
41712
+ var params = this._primaryParams;
41713
+ var field = params[0];
41714
+ var sortLogic = params[1];
41715
+ return sortLogic(
41716
+ rowDefA.getData(field),
41717
+ rowDefB.getData(field),
41718
+ order,
41719
+ params[2]
41720
+ );
41418
41721
  };
41419
41722
  /** @private
41420
41723
  * @param {RowDefinition} rowDefA
@@ -41423,13 +41726,41 @@ RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
41423
41726
  * @return {number}
41424
41727
  */
41425
41728
  RowDefSorter.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
41426
- var orderA = rowDefA.getGroupOrder();
41427
- var orderB = rowDefB.getGroupOrder();
41428
- if(orderA !== orderB) {
41429
- return orderA - orderB; // Regardless of sort order
41729
+ var params = this._primaryParams;
41730
+ var sortLogic = params[1];
41731
+ return sortLogic(rowDefA, rowDefB, order, params[2]);
41732
+ };
41733
+ /** @private
41734
+ * @param {RowDefinition} rowDefA
41735
+ * @param {RowDefinition} rowDefB
41736
+ * @param {number} primaryOrder
41737
+ * @return {number}
41738
+ */
41739
+ RowDefSorter.prototype._multiColumnsSorter = function(rowDefA, rowDefB, primaryOrder) {
41740
+ var sortParams = this._sortParams;
41741
+ var sortCount = sortParams.length;
41742
+ for(var i = 0; i < sortCount; ++i) {
41743
+ var params = sortParams[i];
41744
+ var field = params[0];
41745
+ var sortLogic = params[1];
41746
+ var ctx = params[2];
41747
+ var rowSorting = params[3];
41748
+ var orderNum = params[4];
41749
+ var ret = 0;
41750
+ if(sortLogic) {
41751
+ if(rowSorting) {
41752
+ ret = sortLogic(rowDefA, rowDefB, orderNum, ctx);
41753
+ } else {
41754
+ ret = sortLogic(rowDefA.getData(field), rowDefB.getData(field), orderNum, ctx);
41755
+ }
41756
+ } else {
41757
+ ret = _defaultCompare(rowDefA.getData(field), rowDefB.getData(field), orderNum);
41758
+ }
41759
+ if(ret) {
41760
+ return ret;
41761
+ }
41430
41762
  }
41431
-
41432
- return this._sortLogic(rowDefA, rowDefB, order, this._sortContext);
41763
+ return 0;
41433
41764
  };
41434
41765
 
41435
41766
  /* harmony default export */ var js_RowDefSorter = (RowDefSorter);
@@ -41442,6 +41773,7 @@ RowDefSorter.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
41442
41773
 
41443
41774
 
41444
41775
 
41776
+
41445
41777
  /* eslint-enable */
41446
41778
 
41447
41779
  /** Fired when user click and before the sorting operation.
@@ -41901,7 +42233,10 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
41901
42233
  }
41902
42234
  field = opt["field"];
41903
42235
  if (field) {
41904
- col["sortBy"] = field;
42236
+ if(col["field"] !== field) {
42237
+ col["sortBy"] = field;
42238
+ } // else The default value is an empty sortBy, which refers to the same column field by default.
42239
+
41905
42240
  if (this._sortingSequenceMap && this._sortingSequenceMap[field]) {
41906
42241
  col["sortingSequence"] = this._sortingSequenceMap[field];
41907
42242
  }
@@ -41914,16 +42249,32 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
41914
42249
  extOptions = obj["sorting"] = {};
41915
42250
  }
41916
42251
 
41917
- extOptions["initialSort"] = this.getSortedColumns();
41918
- extOptions["sortableIndicator"] = this._sortableIndicator;
42252
+ var val = this.getSortedColumns();
42253
+ if(val != null) {
42254
+ extOptions["initialSort"] = val;
42255
+ }
42256
+
42257
+ val = this._sortableIndicator;
42258
+ if(val !== false) {
42259
+ extOptions["sortableIndicator"] = val;
42260
+ }
42261
+
41919
42262
  if(this._maxCount !== 1) {
41920
42263
  extOptions["multiColumn"] = this._maxCount === -1 ? true : this._maxCount;
41921
42264
  }
41922
42265
  if(this._dblClickAllowed) {
41923
42266
  extOptions["disableDoubleClickToSort"] = !this._dblClickAllowed;
41924
42267
  }
41925
- extOptions["sortableColumns"] = this._sortableColumns;
41926
- extOptions["indicatorOnly"] = !this._dataSorting;
42268
+
42269
+ val = this._sortableColumns;
42270
+ if(val !== true) {
42271
+ extOptions["sortableColumns"] = val;
42272
+ }
42273
+
42274
+ val = this._dataSorting;
42275
+ if(val !== true) {
42276
+ extOptions["indicatorOnly"] = val;
42277
+ }
41927
42278
  // extOptions["mode"] = this._mode;
41928
42279
  if(this._disabled) {
41929
42280
  extOptions["disabled"] = true;
@@ -41940,6 +42291,10 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
41940
42291
  extOptions["sortingSequence"] = sortingSeq.slice();
41941
42292
  }
41942
42293
 
42294
+ if(Object(Util["f" /* isEmptyObject */])(obj["sorting"])) {
42295
+ delete obj["sorting"];
42296
+ }
42297
+
41943
42298
  return obj;
41944
42299
  };
41945
42300
 
@@ -42954,6 +43309,9 @@ SortableTitlePlugin.prototype._sortDataView = function (opt_action) {
42954
43309
  if (!this._dataSorting) { return; }
42955
43310
 
42956
43311
  var sortCount = this._sortStates.length;
43312
+ if(this._userManagedLogic && sortCount > 1) { // The logic is managed by the user. There is no point in using multi-column sorting
43313
+ sortCount = 1;
43314
+ }
42957
43315
  var orders = null;
42958
43316
  var sortLogics = null;
42959
43317
  var c_ref = null;
@@ -42969,6 +43327,9 @@ SortableTitlePlugin.prototype._sortDataView = function (opt_action) {
42969
43327
  } else {
42970
43328
  c_ref = this.getColumnSortingFields();
42971
43329
  }
43330
+ if(this._userManagedLogic && c_ref.length > 1) {
43331
+ c_ref = c_ref.slice(0, 1);
43332
+ }
42972
43333
  }
42973
43334
 
42974
43335
  // Perform sorting even if there is no sort state
@@ -43077,16 +43438,16 @@ SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
43077
43438
  symbol = t._createIconElem(icon, textContent);
43078
43439
  symbol.className = "sort-symbol";
43079
43440
  cell["insertFloatingIcon"](symbol, 0);
43080
-
43081
- if (t._sortStates.length > 1) {
43082
- symbol = document.createElement("span");
43083
- symbol.className = "priority-symbol";
43084
- symbol.textContent = priority + 1;
43085
- cell["insertFloatingIcon"](symbol, 1);
43086
- }
43087
43441
  } else {
43088
43442
  cell["addClass"]("edge-indicator");
43089
43443
  }
43444
+
43445
+ if (t._sortStates.length > 1) {
43446
+ symbol = document.createElement("span");
43447
+ symbol.className = "priority-symbol";
43448
+ symbol.textContent = priority + 1;
43449
+ cell["insertFloatingIcon"](symbol, 1);
43450
+ }
43090
43451
  } else if (t._sortableIndicator) { // Can sort but currently not sorting
43091
43452
  icon = SortableTitlePlugin._icons["sortable"];
43092
43453
  symbol = t._createIconElem(icon, CODE_DIAMOND);
@@ -44220,7 +44581,7 @@ Grid.prototype.initialize = function(gridOption) {
44220
44581
  if(rows[n]["values"]) { // merge row's values, values can be object or array
44221
44582
  values = Object(Util["a" /* arrayToObject */])(rows[n]["values"], fields);
44222
44583
  data = Object(Util["a" /* arrayToObject */])(ary[n], fields);
44223
- rows[n]["values"] = Object(Util["c" /* extendObject */])(values, data);
44584
+ rows[n]["values"] = Object(Util["d" /* extendObject */])(values, data);
44224
44585
  } else {
44225
44586
  rows[n]["values"] = ary[n];
44226
44587
  }
@@ -44282,6 +44643,28 @@ Grid.prototype.getConfigObject = function (gridOptions) {
44282
44643
  grid.getConfigObject(obj);
44283
44644
  }
44284
44645
 
44646
+ // Difference from composite grid in default config
44647
+ if(obj["columnVirtualization"] === false) {
44648
+ delete obj["columnVirtualization"];
44649
+ }
44650
+
44651
+ if(obj["rowVirtualization"] === true) {
44652
+ delete obj["rowVirtualization"];
44653
+ }
44654
+
44655
+ if(obj["rowHighlighting"] === true) {
44656
+ delete obj["rowHighlighting"];
44657
+ }
44658
+
44659
+ if(obj["contentVerticalLines"] === false) { // the default value change in wrapper (atlas-blotter)
44660
+ delete obj["contentVerticalLines"];
44661
+ }
44662
+
44663
+ if(obj["borders"] === false) { // the default value change in wrapper (atlas-blotter)
44664
+ delete obj["borders"];
44665
+ }
44666
+
44667
+
44285
44668
  var i, len;
44286
44669
  len = this.getColumnCount();
44287
44670
  for (i = 0; i < len; ++i) {
@@ -44306,12 +44689,12 @@ Grid.prototype.getConfigObject = function (gridOptions) {
44306
44689
  }
44307
44690
 
44308
44691
  val = grid.getDefaultRowHeight();
44309
- if(val !== 32) {
44692
+ if(val !== 28) { // the default value change in wrapper (atlas-blotter)
44310
44693
  obj["rowHeight"] = val;
44311
44694
  }
44312
44695
 
44313
44696
  val = grid.getSection("title").getDefaultRowHeight();
44314
- if(val !== 32) {
44697
+ if(val !== 28) { // the default value change in wrapper (atlas-blotter)
44315
44698
  obj["headerRowHeight"] = val;
44316
44699
  }
44317
44700
 
@@ -44319,7 +44702,8 @@ Grid.prototype.getConfigObject = function (gridOptions) {
44319
44702
  obj["autoLayoutUpdate"] = true;
44320
44703
  }
44321
44704
 
44322
- if (this._defaultColumnOptions) {
44705
+ val = Object(Util["f" /* isEmptyObject */])(this._defaultColumnOptions);
44706
+ if (!val) { // Currently, this variable is the object, we need to check empty array for default value
44323
44707
  obj["defaultColumnOptions"] = this._defaultColumnOptions;
44324
44708
  }
44325
44709
 
@@ -44378,10 +44762,13 @@ Grid.prototype.getConfigObject = function (gridOptions) {
44378
44762
  }
44379
44763
 
44380
44764
  // TODO: The following states need to be retrieved
44381
- // rowHighlighting
44382
- // columnVirtualization
44383
44765
  // topFreezingCount, bottomFreezingCount
44384
44766
  // scrollbarParent
44767
+ // linearWheelScrolling
44768
+ // stepScroll
44769
+ // noColumnDragging
44770
+ // columnReorder
44771
+ // topSection
44385
44772
 
44386
44773
  // NOTE: no need to export synapseApiKey, ADC and RTK
44387
44774
 
@@ -44457,7 +44844,7 @@ Grid.prototype._onRicAdded = function(e) {
44457
44844
  var jLen = rowDefs ? rowDefs.length : 0;
44458
44845
  for (var j = 0; j < jLen; ++j) {
44459
44846
  var rowDef = rowDefs[j];
44460
- if (rowDef.getRic() === ric) {
44847
+ if (rowDef.getSymbol() === ric) {
44461
44848
  this._snapshot.addRic(ric); // ADC
44462
44849
  }
44463
44850
  }
@@ -44482,7 +44869,7 @@ Grid.prototype._onFieldAdded = function(e) {
44482
44869
 
44483
44870
  // ADC
44484
44871
  for (var i in rowDefs) {
44485
- this._snapshot.addRic(rowDefs[i].getRic());
44872
+ this._snapshot.addRic(rowDefs[i].getSymbol());
44486
44873
  }
44487
44874
  this._snapshot.addFields(addedFields);
44488
44875
 
@@ -44676,7 +45063,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
44676
45063
  colConfig["width"] = value;
44677
45064
 
44678
45065
  value = core.getMinimumColumnWidth(colIndex);
44679
- if(value !== 32) {
45066
+ if(value > 0) {
44680
45067
  colConfig["minWidth"] = value;
44681
45068
  }
44682
45069
 
@@ -44814,22 +45201,101 @@ Grid.prototype._shouldLoadFieldInfo = function (field) {
44814
45201
  * @param {Array.<Object>} columns Array of column options
44815
45202
  */
44816
45203
  Grid.prototype.setColumns = function(columns) {
45204
+ var grid = this._grid;
44817
45205
  var colCount = (columns) ? columns.length : 0;
44818
45206
 
45207
+ grid.startBatch("reset");
44819
45208
  this.removeAllColumns();
44820
45209
  if(colCount > 0) {
44821
45210
  var prevState = false;
44822
45211
  if(colCount > 1) {
44823
- prevState = this._grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
45212
+ prevState = grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
44824
45213
  }
44825
45214
  for(var i = 0; i < colCount; ++i) {
44826
45215
  this.insertColumn(columns[i], i);
44827
45216
  }
44828
45217
  if(colCount > 1) {
44829
- this._grid.freezeLayout(prevState);
45218
+ grid.freezeLayout(prevState);
45219
+ }
45220
+ }
45221
+ grid.stopBatch("reset");
45222
+ };
45223
+
45224
+
45225
+ /** Remove, add and keep column based on the given column data
45226
+ * @public
45227
+ * @param {Array.<Object>} columns Array of column options
45228
+ */
45229
+ Grid.prototype.restoreColumns = function(columns) {
45230
+ var grid = this._grid;
45231
+ grid.startBatch("reset");
45232
+ var configObj = this.getConfigObject();
45233
+ var previousColumns = configObj.columns;
45234
+
45235
+ var preColLen = previousColumns.length;
45236
+ var newColLen = columns.length;
45237
+
45238
+ var removingFields = [];
45239
+ var keepingColumns = [];
45240
+ var columnOrdering = [];
45241
+
45242
+ var i, j, found;
45243
+ // Slow, time complexity BigO(n ^ 2)
45244
+ for (i = 0; i < preColLen; i++) {
45245
+ found = false;
45246
+ for (j = 0; j < newColLen; j++) {
45247
+ if (Object(Util["c" /* deepEqual */])(previousColumns[i], columns[j])) {
45248
+ keepingColumns.push(previousColumns[i]);
45249
+ found = true;
45250
+ break;
45251
+ }
45252
+ }
45253
+ if (!found) {
45254
+ removingFields.push(previousColumns[i].field);
45255
+ }
45256
+ }
45257
+
45258
+ var sortingStates;
45259
+ var removeLen = removingFields.length;
45260
+ if(removeLen > 0 && this._stp) {
45261
+ sortingStates = this._stp.getSortingStates().slice(); // We need to clone array for avoid object reference in remove column
45262
+ }
45263
+
45264
+ this.removeColumns(removingFields);
45265
+
45266
+ var keepingLen = keepingColumns.length;
45267
+ var prevState = false;
45268
+ if(newColLen > 1) {
45269
+ prevState = this._grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
45270
+ }
45271
+ for (i = 0; i < newColLen; i++) {
45272
+ found = false;
45273
+ for (j = 0; j < keepingLen; j++) { // loop only keeping column
45274
+ if (Object(Util["c" /* deepEqual */])(columns[i], keepingColumns[j])) {
45275
+ found = true;
45276
+ 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.
45277
+ columnOrdering.push(this.getColumnId(colIndex));
45278
+ break;
45279
+ }
45280
+ }
45281
+ if (!found) {
45282
+ this.insertColumn(columns[i], i);
45283
+ columnOrdering.push(this.getColumnId(i)); // Use new insertion column index
44830
45284
  }
44831
45285
  }
45286
+
45287
+ if(newColLen > 1) {
45288
+ this._grid.freezeLayout(prevState);
45289
+ }
45290
+
45291
+ if(removeLen > 0 && this._stp) {
45292
+ this._stp.sortColumns(sortingStates);
45293
+ }
45294
+
45295
+ grid.reorderColumns(columnOrdering);
45296
+ grid.stopBatch("reset");
44832
45297
  };
45298
+
44833
45299
  /** Remove all existing columns and add new columns based on the given texts/fields
44834
45300
  * @public
44835
45301
  * @function
@@ -44974,10 +45440,11 @@ Grid.prototype.removeColumn = function(colRef) {
44974
45440
  this._dc.removeStaticFields([colDef.getField()]);
44975
45441
  }
44976
45442
  }
44977
- colDef.dispose();
44978
- this._grid.removeColumnAt(colIndex);
44979
45443
 
45444
+ this._grid.removeColumnAt(colIndex);
44980
45445
  this._connector.removeFields(colDef);
45446
+
45447
+ colDef.dispose(); // Dispose at the last line to avoid making properties inaccessible
44981
45448
  // TODO: Remove fields that are related to the column (e.g. fields for coloring)
44982
45449
  };
44983
45450
  /** Remove multiple columns through array. To remove all columns, use removeAllColumns() instead of this method
@@ -45323,7 +45790,7 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
45323
45790
  * @param {RowDefinition} rowDef
45324
45791
  */
45325
45792
  Grid.prototype._initDuplicateRicData = function(rowDef) {
45326
- var ric = rowDef.getRic();
45793
+ var ric = rowDef.getSymbol();
45327
45794
  var rowDefs = this._connector.getRowDefByRic(ric);
45328
45795
  if(rowDefs && rowDefs.length) {
45329
45796
  cloneRowData(rowDefs[0], rowDef);
@@ -45740,8 +46207,9 @@ Grid.prototype.setRic = function(rowRef, str, options) {
45740
46207
  this.insertRow(options, rowIndex);
45741
46208
  }
45742
46209
  } else {
45743
- var oldRic = rowDef.getRic();
45744
- if(rowDef.setContent(str)) { // The given string may not be a RIC
46210
+ var oldRic = rowDef.getSymbol();
46211
+ var permId = options["permId"] || "";
46212
+ if(rowDef.setContent(str, permId)) { // The given string may not be a RIC
45745
46213
  this._connector.removeRic(rowDef, oldRic);
45746
46214
  this._initDuplicateRicData(rowDef);
45747
46215
  this._connector.addRic(rowDef);
@@ -46062,7 +46530,7 @@ Grid.prototype.setRicData = function(ric, values) {
46062
46530
  var rowCount = rowDefs ? rowDefs.length : 0;
46063
46531
  for (var i = 0; i < rowCount; ++i) {
46064
46532
  var rowDef = rowDefs[i];
46065
- if (rowDef && rowDef.getRic() === ric) {
46533
+ if (rowDef && rowDef.getSymbol() === ric) {
46066
46534
  rowDef.setRowData(values); // TODO: Need conflator to improve performance
46067
46535
  }
46068
46536
  }
@@ -46518,33 +46986,34 @@ Grid.prototype._updateStreamingData = function() {
46518
46986
  * @param {Object} e
46519
46987
  */
46520
46988
  Grid.prototype._onPreDataSorting = function (e) {
46521
- var field = "";
46522
- var rowSorting = false;
46523
- var sortLogic = null;
46524
-
46525
- var states = this._stp.getSortingStates(); // WARNING: Use of deprecated function
46526
- var state = states ? states[0] : null; // TODO: Support multi-column sorting
46527
-
46528
- if(state) {
46529
- field = state["field"] || "";
46530
- var colIndex = this._stp.getSortedColumnIndex(0);
46531
- var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
46532
- this._sorter.setContext("colIndex", colIndex);
46533
- this._sorter.setContext("colDef", colDef);
46989
+ var objs = this._stp.getSortedColumns();
46990
+
46991
+ this._sorter.reset();
46992
+ if(Array.isArray(objs)) {
46993
+ var sortCount = objs.length;
46994
+ for(var i = 0; i < sortCount; ++i) {
46995
+ var obj = objs[i];
46996
+ var field = obj["field"] || "";
46997
+ var colIndex = obj["colIndex"];
46998
+ var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
46999
+
47000
+ var rowSorting = false;
47001
+ var sortLogic = null;
47002
+ if(colDef) {
47003
+ field = colDef.getField(); // WARNING: Field and logic could be out of sync
47004
+ rowSorting = colDef.isRowSorting();
47005
+ sortLogic = colDef.getSorter();
47006
+ }
47007
+ // TODO: get sortLogic from DataView
47008
+ // if(!sortLogic && field) {
47009
+ // sortLogic = state["sortLogic"];
47010
+ // }
46534
47011
 
46535
- if(colDef) {
46536
- field = colDef.getField(); // WARNING: Field and logic could be out of sync
46537
- sortLogic = colDef.getSorter();
46538
- rowSorting = colDef.isRowSorting();
47012
+ this._sorter.addColumnContext(field, sortLogic, rowSorting, obj["sortOrder"], colIndex, colDef);
46539
47013
  }
46540
47014
  }
46541
- if(!sortLogic && field) {
46542
- sortLogic = state["sortLogic"];
46543
- }
46544
47015
 
46545
- this._sorter.setField(field);
46546
- this._sorter.setSortLogic(sortLogic);
46547
- this._columnSorter = this._sorter.getSorter(rowSorting);
47016
+ this._columnSorter = this._sorter.getSorter();
46548
47017
  };
46549
47018
  /** @private
46550
47019
  * @param {RowDefinition} rowDefA
@@ -47445,7 +47914,7 @@ var _fieldInfo = {
47445
47914
  "words2": {type: "string", min: 3, max: 10},
47446
47915
  "words3": {type: "string", min: 5, max: 15},
47447
47916
  "sentence": {type: "string", min: 8, max: 20},
47448
- "id": {type: "function", generate: _generateId},
47917
+ "id": {type: "function", hash: 0, generate: _generateId},
47449
47918
  "companyName": {type: "set", members: jet_DataSet.companyName },
47450
47919
  "industry": {type: "set", members: jet_DataSet.industry },
47451
47920
  "market": {type: "set", members: jet_DataSet.market },
@@ -47465,14 +47934,16 @@ var getFieldInfo = function(field) {
47465
47934
  * @param {Object|Function} options
47466
47935
  */
47467
47936
  var addFieldInfo = function(field, options) {
47468
- var opt = options;
47469
- if(typeof options === "function") {
47470
- opt = {
47471
- type: "function",
47472
- generate: options
47473
- };
47937
+ if(field) {
47938
+ var opt = options;
47939
+ if(typeof options === "function") {
47940
+ opt = {
47941
+ type: "function",
47942
+ generate: options
47943
+ };
47944
+ }
47945
+ _fieldInfo[field] = opt; // WARNING: This could replace existing info
47474
47946
  }
47475
- _fieldInfo[field] = opt;
47476
47947
  };
47477
47948
 
47478
47949
  /** Return pseudo random number in the range of 0 to 1 (exclusive of 1)
@@ -47814,8 +48285,9 @@ var _generate2DArray = function(fields, options, seed) {
47814
48285
  */
47815
48286
  var _hash = function(str) {
47816
48287
  var sum = 0;
47817
- for(var i = str.length; --i >= 0;) {
47818
- sum += str.charCodeAt(i) * (i + 0.9);
48288
+ var i = str ? str.length : 0;
48289
+ while(--i >= 0) {
48290
+ sum += str.charCodeAt(i) * (i + 0.9879);
47819
48291
  }
47820
48292
  return sum;
47821
48293
  };
@@ -47827,35 +48299,34 @@ var _hash = function(str) {
47827
48299
  */
47828
48300
  var _generateFieldData = function(field, options, seed) {
47829
48301
  var fInfo = getFieldInfo(field);
48302
+ if(!fInfo.type) {
48303
+ fInfo.type = "number";
48304
+ addFieldInfo(field, fInfo);
48305
+ }
48306
+ if(fInfo.fixedValue){
48307
+ fInfo.value = value;
48308
+ return fInfo;
48309
+ }
48310
+ if(seed != null) {
48311
+ if(fInfo.hash == null) {
48312
+ fInfo.hash = _hash(field);
48313
+ }
48314
+ seed += fInfo.hash; // Make each field unique for the same seed
48315
+ }
48316
+
47830
48317
  var min = fInfo.min != null ? fInfo.min : 100; // WARNING: Default values are non-standard values
47831
48318
  var max = fInfo.max != null ? fInfo.max : 10000;
47832
- var prec = fInfo.prec != null ? fInfo.prec : 0;
47833
48319
  var value;
47834
48320
 
47835
- if(fInfo.fixedValue){
47836
- value = fInfo.fixedValue;
47837
- } else if(!fInfo.type) { // Unknown type
47838
- if(seed != null) {
47839
- if(field) {
47840
- if(!fInfo.hash) {
47841
- fInfo.hash = _hash(field);
47842
- addFieldInfo(field, fInfo); // WARNING: modify global state
47843
- }
47844
- seed += fInfo.hash;
47845
- }
47846
- }
47847
- value = randNumber(min, max, prec, seed);
47848
- } else if(fInfo.type === "string") {
48321
+ if(fInfo.type === "string") {
47849
48322
  if(fInfo.min != null || fInfo.max != null) {
47850
- if(seed != null) {
47851
- if(!fInfo.hash) {
47852
- fInfo.hash = _hash(field);
47853
- }
47854
- seed += fInfo.hash;
47855
- }
47856
48323
  value = randString(min, max, seed);
47857
48324
  } else {
47858
- value = options.text || "";
48325
+ if(options) {
48326
+ value = options.text || "";
48327
+ } else {
48328
+ value = "";
48329
+ }
47859
48330
  }
47860
48331
  } else if(fInfo.type === "set") {
47861
48332
  value = randMember(fInfo.members, seed);
@@ -47872,7 +48343,8 @@ var _generateFieldData = function(field, options, seed) {
47872
48343
  } else if(fInfo.type === "function") {
47873
48344
  fInfo.field = field;
47874
48345
  value = fInfo.generate(fInfo, seed);
47875
- } else { // Default is number
48346
+ } else { // Default is number for all unknown type
48347
+ var prec = fInfo.prec != null ? fInfo.prec : 0;
47876
48348
  value = randNumber(min, max, prec, seed);
47877
48349
  }
47878
48350
  fInfo.value = value;
@@ -49979,7 +50451,7 @@ CellPainter.themeReady = null;
49979
50451
  * var fn = CellPainter.parse("[CF_BID] >= 10 && [CF_BID] <= 100");
49980
50452
  * window.console.log(fn(25));
49981
50453
  */
49982
- CellPainter.parse = Util["f" /* parseCondition */];
50454
+ CellPainter.parse = Util["h" /* parseCondition */];
49983
50455
 
49984
50456
 
49985
50457
  /** @public */
@@ -50077,25 +50549,17 @@ CellPainter.prototype.clearHeatMap = function() {
50077
50549
  /** @public */
50078
50550
  CellPainter.prototype.applyThemeColor = function() {
50079
50551
  var colors = ElfUtil.getColors();
50080
- var cond = this._conditions[0]; // Heatmap, color text condition must be the first
50081
- if(cond) {
50082
- if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) { // Heatmap uses grid color to blend the result color
50552
+ if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) { // Heatmap uses grid color to blend the result color
50553
+ var cond = this._conditions[0]; // Heatmap, color text condition must be the first
50554
+ if(cond) {
50083
50555
  if(cond["textMode"]) {
50084
50556
  cond["baseColor"] = colors["baseText"];
50085
50557
  } else {
50086
50558
  cond["baseColor"] = colors["baseGrid"];
50087
50559
  }
50088
- }
50089
- if(cond["useThemeColor"]) { // Only heatmap and colorText painters use theme color
50090
- if(this._coloringType === CellPainter.ColoringTypes.HEATMAP || this._coloringType === CellPainter.ColoringTypes.TEXT) {
50091
- var up, down;
50092
- if(this._coloringType === CellPainter.ColoringTypes.TEXT && cond["field"] === "CF_TICK") {
50093
- up = colors["tickUp"];
50094
- down = colors["tickDown"];
50095
- } else {
50096
- up = colors["up"];
50097
- down = colors["down"];
50098
- }
50560
+ if(cond["useThemeColor"]) {
50561
+ var up = colors["up"];
50562
+ var down = colors["down"];
50099
50563
  var level = (colors["level"] === colors["baseText"]) ? "" : colors["level"];
50100
50564
  CellPainter._setUpDownColors(cond, up, down, level);
50101
50565
  }
@@ -50214,34 +50678,36 @@ CellPainter.prototype.addHeatmapWithTheme = function(field, midPoint, opt_textMo
50214
50678
  /** @private
50215
50679
  * @param {Function} expression
50216
50680
  * @param {string} field
50217
- * @param {string} upColor
50218
- * @param {string} downColor
50219
- * @param {string} levelColor
50681
+ * @param {string=} upClass CSS class name
50682
+ * @param {string=} downClass CSS class name
50683
+ * @param {string=} levelClass CSS class name
50220
50684
  * @return {!Object}
50221
50685
  */
50222
- CellPainter.prototype._addColorText = function(expression, field, upColor, downColor, levelColor) {
50686
+ CellPainter.prototype._addColorText = function(expression, field, upClass, downClass, levelClass) {
50223
50687
  this._setColoringType(CellPainter.ColoringTypes.TEXT);
50224
50688
 
50225
50689
  var condition = {};
50226
50690
  condition["field"] = field;
50227
50691
  condition["expression"] = expression.bind(null, field);
50228
- CellPainter._setUpDownColors(condition, upColor, downColor, levelColor);
50692
+ condition["upClass"] = upClass;
50693
+ condition["downClass"] = downClass;
50694
+ condition["levelClass"] = levelClass;
50229
50695
 
50230
50696
  this._addCondition(condition);
50231
50697
  return condition;
50232
50698
  };
50233
50699
  /** @public
50234
50700
  * @param {string} field
50235
- * @param {string} upColor
50236
- * @param {string} downColor
50237
- * @param {string} levelColor
50701
+ * @param {string=} upClass CSS class name
50702
+ * @param {string=} downClass CSS class name
50703
+ * @param {string=} levelClass CSS class name
50238
50704
  * @return {!Object}
50239
50705
  */
50240
- CellPainter.prototype.addColorText = function(field, upColor, downColor, levelColor) {
50706
+ CellPainter.prototype.addColorText = function(field, upClass, downClass, levelClass) {
50241
50707
  return this._addColorText(
50242
50708
  TickFields[field] ? CellPainter._tickColorTextCondition : CellPainter._colorTextCondition,
50243
50709
  field,
50244
- upColor, downColor, levelColor
50710
+ upClass, downClass, levelClass
50245
50711
  );
50246
50712
  };
50247
50713
  /** @public
@@ -50249,14 +50715,7 @@ CellPainter.prototype.addColorText = function(field, upColor, downColor, levelCo
50249
50715
  * @return {!Object}
50250
50716
  */
50251
50717
  CellPainter.prototype.addColorTextWithTheme = function(field) {
50252
- var colors = ElfUtil.themeColors;
50253
- var condition = this.addColorText(field,
50254
- colors["up"],
50255
- colors["down"],
50256
- (colors["level"] === colors["baseText"]) ? "" : colors["level"]
50257
- );
50258
-
50259
- condition["useThemeColor"] = true;
50718
+ var condition = this.addColorText(field, "positive", "negative", "neutral");
50260
50719
  return condition;
50261
50720
  };
50262
50721
  /** @public
@@ -50358,14 +50817,16 @@ CellPainter.prototype.renderForPrinting = function(cell, rowData, min, max) {
50358
50817
  return;
50359
50818
  }
50360
50819
  var styles = this._getStyles(rowData, min, max);
50361
- var cssClass = styles["cssClass"];
50362
- if (cssClass) {
50363
- if (cell._coloringCssClass !== cssClass) {
50364
- cell.classList.remove(cell._coloringCssClass);
50365
- cell._coloringCssClass = null;
50820
+ var cssClass = styles["cssClass"]; // Can be an empty string
50821
+ if (cssClass != null) { // Predefined colors mode
50822
+ if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
50823
+ elem.classList.remove(elem._coloringCssClass);
50824
+ elem._coloringCssClass = null;
50825
+ }
50826
+ if (cssClass) {
50827
+ elem.classList.add(cssClass);
50828
+ elem._coloringCssClass = cssClass;
50366
50829
  }
50367
- cell.classList.add(cssClass);
50368
- cell._coloringCssClass = cssClass;
50369
50830
  } else {
50370
50831
  if (cell._coloringCssClass) {
50371
50832
  cell.classList.remove(cell._coloringCssClass);
@@ -50498,14 +50959,17 @@ CellPainter._cellRestorer = function(scope) {
50498
50959
  }
50499
50960
 
50500
50961
  var styles = this._getStyles(rowData, min, max);
50501
- var cssClass = styles["cssClass"];
50502
- if (cssClass) {
50962
+ var cssClass = styles["cssClass"]; // Can be an empty string
50963
+ if (cssClass != null) { // Predefined colors mode
50503
50964
  if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
50504
50965
  elem.classList.remove(elem._coloringCssClass);
50505
50966
  elem._coloringCssClass = null;
50506
50967
  }
50507
- elem.classList.add(cssClass);
50508
- elem._coloringCssClass = cssClass;
50968
+ if (cssClass) {
50969
+ elem.classList.add(cssClass);
50970
+ elem._coloringCssClass = cssClass;
50971
+ }
50972
+ // Remove blinking color
50509
50973
  elem.style.backgroundColor = "";
50510
50974
  elem.style.color = "";
50511
50975
  } else {
@@ -50560,13 +51024,14 @@ CellPainter.prototype._getStyles = function(rowData, min, max) {
50560
51024
  }
50561
51025
  } else if(this._coloringType === CellPainter.ColoringTypes.TEXT) {
50562
51026
  if(ret > 0) {
50563
- CellPainter._colorObj["color"] = curCond["upColor"];
51027
+ curCond["cssClass"] = curCond["upClass"];
50564
51028
  } else if(ret < 0) {
50565
- CellPainter._colorObj["color"] = curCond["downColor"];
51029
+ curCond["cssClass"] = curCond["downClass"];
50566
51030
  } else {
50567
- CellPainter._colorObj["color"] = this._levelColorDisabled ? "" : curCond["levelColor"];
51031
+ curCond["cssClass"] = this._levelColorDisabled ? "" : curCond["levelClass"];
50568
51032
  }
50569
- return CellPainter._colorObj;
51033
+ curCond["cssClass"] = curCond["cssClass"] || "";
51034
+ return curCond;
50570
51035
  }
50571
51036
 
50572
51037
  // Expected return value is {
@@ -50626,7 +51091,7 @@ CellPainter.blackAndWhite = function (triplet) {
50626
51091
  * @param {string} rgbCode
50627
51092
  * @return {string} resultColor E.g. "#10FF0D"
50628
51093
  */
50629
- CellPainter.rgb2Hex = Util["h" /* rgb2Hex */]; // For backward compatability
51094
+ CellPainter.rgb2Hex = Util["j" /* rgb2Hex */]; // For backward compatability
50630
51095
 
50631
51096
  /** @public
50632
51097
  * @function
@@ -50742,6 +51207,10 @@ CellPainter.clearCellStyle = function(cell, styles) {
50742
51207
  // WARNING: Scope is not removed from the this._scopes collection to speed things up
50743
51208
  }
50744
51209
 
51210
+ if(elem._coloringCssClass) {
51211
+ elem.classList.remove(elem._coloringCssClass);
51212
+ }
51213
+
50745
51214
  styles = styles || CellPainter.supportedStyles;
50746
51215
  for(var i = styles.length; --i >= 0;) {
50747
51216
  elem.style[styles[i]] = ""; // WARNING: Very slow
@@ -50755,22 +51224,24 @@ CellPainter.clearCellStyle = function(cell, styles) {
50755
51224
  * @param {boolean=} withContrast
50756
51225
  */
50757
51226
  CellPainter._setUpDownColors = function(scp, upColor, downColor, levelColor, withContrast) {
51227
+ scp["upColor"] = upColor;
50758
51228
  if(upColor != null) {
50759
- scp["upColor"] = upColor;
50760
51229
  if(withContrast) {
50761
51230
  scp["contrastUpColor"] = CellPainter.getOppositeColor(upColor);
50762
51231
  }
50763
51232
  //scp["rgbUp"] = CellPainter.hex2Rgb(upColor);
50764
51233
  }
51234
+
51235
+ scp["downColor"] = downColor;
50765
51236
  if(downColor != null) {
50766
- scp["downColor"] = downColor;
50767
51237
  if(withContrast) {
50768
51238
  scp["contrastDownColor"] = CellPainter.getOppositeColor(downColor);
50769
51239
  }
50770
51240
  //scp["rgbDown"] = CellPainter.hex2Rgb(downColor);
50771
51241
  }
51242
+
51243
+ scp["levelColor"] = levelColor;
50772
51244
  if(levelColor != null) {
50773
- scp["levelColor"] = levelColor;
50774
51245
  if(withContrast) {
50775
51246
  scp["contrastLevelColor"] = CellPainter.getOppositeColor(levelColor);
50776
51247
  }
@@ -50864,14 +51335,16 @@ CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
50864
51335
  }
50865
51336
 
50866
51337
  var styles = this._getStyles(rowData, min, max);
50867
- var cssClass = styles["cssClass"];
50868
- if (cssClass) {
50869
- if (elem._coloringCssClass !== cssClass) {
51338
+ var cssClass = styles["cssClass"]; // Can be an empty string
51339
+ if (cssClass != null) { // Predefined colors mode
51340
+ if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
50870
51341
  elem.classList.remove(elem._coloringCssClass);
50871
51342
  elem._coloringCssClass = null;
50872
51343
  }
50873
- elem.classList.add(cssClass);
50874
- elem._coloringCssClass = cssClass;
51344
+ if (cssClass) {
51345
+ elem.classList.add(cssClass);
51346
+ elem._coloringCssClass = cssClass;
51347
+ }
50875
51348
  } else {
50876
51349
  if (elem._coloringCssClass) {
50877
51350
  elem.classList.remove(elem._coloringCssClass);