@refinitiv-ui/efx-grid 6.0.33 → 6.0.34

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 (55) hide show
  1. package/lib/core/dist/core.js +112 -36
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/data/DataTable.d.ts +1 -1
  4. package/lib/core/es6/data/DataTable.js +9 -8
  5. package/lib/core/es6/data/DataView.js +1 -1
  6. package/lib/core/es6/data/Segment.d.ts +2 -0
  7. package/lib/core/es6/data/Segment.js +16 -0
  8. package/lib/core/es6/data/SegmentCollection.d.ts +1 -3
  9. package/lib/core/es6/data/SegmentCollection.js +25 -18
  10. package/lib/core/es6/grid/Core.js +1 -1
  11. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +7 -7
  12. package/lib/grid/index.js +1 -1
  13. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  14. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  15. package/lib/grid/themes/halo/efx-grid.less +2 -0
  16. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  17. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  18. package/lib/rt-grid/dist/rt-grid.js +425 -153
  19. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  20. package/lib/rt-grid/es6/ColumnDefinition.js +13 -8
  21. package/lib/rt-grid/es6/DataConnector.js +3 -2
  22. package/lib/rt-grid/es6/Grid.d.ts +3 -1
  23. package/lib/rt-grid/es6/Grid.js +116 -15
  24. package/lib/rt-grid/es6/RowDefinition.d.ts +7 -2
  25. package/lib/rt-grid/es6/RowDefinition.js +48 -10
  26. package/lib/rt-grid/es6/SnapshotFiller.d.ts +1 -0
  27. package/lib/rt-grid/es6/SnapshotFiller.js +1 -11
  28. package/lib/tr-grid-column-stack/es6/ColumnStack.js +21 -10
  29. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +12 -5
  30. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +128 -42
  31. package/lib/tr-grid-heat-map/es6/HeatMap.d.ts +3 -3
  32. package/lib/tr-grid-heat-map/es6/HeatMap.js +13 -2
  33. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +2 -1
  34. package/lib/tr-grid-row-dragging/es6/RowDragging.js +142 -17
  35. package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +20 -20
  36. package/lib/tr-grid-textformatting/es6/TextFormatting.js +37 -138
  37. package/lib/tr-grid-util/es6/CellPainter.d.ts +1 -1
  38. package/lib/tr-grid-util/es6/CellPainter.js +56 -55
  39. package/lib/tr-grid-util/es6/FieldFormatter.js +6 -2
  40. package/lib/tr-grid-util/es6/NumberFormatter.js +23 -11
  41. package/lib/tr-grid-util/es6/Util.d.ts +3 -0
  42. package/lib/tr-grid-util/es6/Util.js +53 -0
  43. package/lib/types/es6/ConditionalColoring.d.ts +12 -5
  44. package/lib/types/es6/Core/data/Segment.d.ts +2 -0
  45. package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -3
  46. package/lib/types/es6/Core/grid/Core.d.ts +4 -0
  47. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +1 -0
  48. package/lib/types/es6/HeatMap.d.ts +3 -3
  49. package/lib/types/es6/RealtimeGrid/Grid.d.ts +3 -1
  50. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +7 -2
  51. package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +1 -0
  52. package/lib/types/es6/RowDragging.d.ts +2 -1
  53. package/lib/types/es6/TextFormatting.d.ts +20 -20
  54. package/lib/versions.json +6 -6
  55. 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
 
@@ -12288,9 +12379,9 @@ DataTable.prototype.addSegmentChild = function(segmentId, rid, dataId) {
12288
12379
  if(this._segments) {
12289
12380
  var dirty = this._segments.addSegmentChild(segmentId, rid, dataId);
12290
12381
  if(dirty) {
12291
- if(this._sort(null)) {
12292
- this._dispatchPositionChange();
12293
- }
12382
+ this._sort(null);
12383
+ this._dispatchPositionChange(); // Force rerendering, even if there is no position change
12384
+
12294
12385
  this.requestClassifying();
12295
12386
  return true;
12296
12387
  }
@@ -12307,9 +12398,9 @@ DataTable.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
12307
12398
  if(this._segments) {
12308
12399
  var dirty = this._segments.addSegmentChildren(segmentId, rids, dataIds);
12309
12400
  if(dirty) {
12310
- if(this._sort(null)) {
12311
- this._dispatchPositionChange();
12312
- }
12401
+ this._sort(null);
12402
+ this._dispatchPositionChange(); // Force rerendering, even if there is no position change
12403
+
12313
12404
  this.requestClassifying();
12314
12405
  return true;
12315
12406
  }
@@ -13062,6 +13153,7 @@ DataTable._proto = DataTable.prototype;
13062
13153
  /** @typedef {Object} RowDefinition~Options
13063
13154
  * @description RowDefinition options
13064
13155
  * @property {string=} ric="" RIC for real-time fields. Prefixing 0# to the ric is equivalent to specifying asChain property.
13156
+ * @property {string=} permId="" Organization PermId to be used instead of ric for private company.
13065
13157
  * @property {(Array|Object)=} values=null Values for static data
13066
13158
  * @property {Array.<string>=} fields=null Field that corresponds to the given static values
13067
13159
  * @property {boolean=} asChain=false The given ric will be treated as a chain
@@ -13143,6 +13235,10 @@ RowDefinition.prototype._ric = ""; // Contains no 0#
13143
13235
  /** @type {string}
13144
13236
  * @private
13145
13237
  */
13238
+ RowDefinition.prototype._permId = "";
13239
+ /** @type {string}
13240
+ * @private
13241
+ */
13146
13242
  RowDefinition.prototype._displayText = "";
13147
13243
  /** @type {string|null}
13148
13244
  * @private
@@ -13268,13 +13364,20 @@ RowDefinition.prototype.initialize = function(rowOptions) {
13268
13364
 
13269
13365
  var val = rowOptions["ric"];
13270
13366
  if(val != null) {
13271
- this.setContent(/** @type{string} */(val)); // this._dataId is modified
13367
+ this._ric = val;
13368
+ }
13369
+ val = rowOptions["permId"];
13370
+ if(val != null) {
13371
+ this._permId = val;
13272
13372
  }
13373
+ if(this._ric || this._permId){
13374
+ this.setContent(this._ric, this._permId); // this._dataId is modified
13375
+ }
13376
+
13273
13377
  val = rowOptions["chainRic"];
13274
13378
  if(val != null) {
13275
13379
  this._chainRic = val;
13276
13380
  }
13277
-
13278
13381
  val = rowOptions["values"];
13279
13382
  // eslint-disable-next-line no-undefined
13280
13383
  if(val !== undefined) {
@@ -13328,10 +13431,11 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
13328
13431
  }
13329
13432
  };
13330
13433
  /** @public
13331
- * @param {string} userInput
13434
+ * @param {string} userInput RIC
13435
+ * @param {string=} permId=null Organization PermId, which use for getting ADC data for private company
13332
13436
  * @return {boolean} True if there is any change otherwise false
13333
13437
  */
13334
- RowDefinition.prototype.setContent = function(userInput) {
13438
+ RowDefinition.prototype.setContent = function(userInput, permId) {
13335
13439
  if(this._autoGenerated) { // AutoGenerated RowDefinition cannot be changed by user input
13336
13440
  return false;
13337
13441
  }
@@ -13342,7 +13446,15 @@ RowDefinition.prototype.setContent = function(userInput) {
13342
13446
  userInput += "";
13343
13447
  }
13344
13448
 
13345
- if(this._userInput === userInput) {
13449
+ var dirty = (this._userInput !== userInput);
13450
+ if(this._permId !== permId){
13451
+ this._permId = permId || "";
13452
+ if(!userInput){
13453
+ this._displayText = this._permId;
13454
+ dirty = true;
13455
+ }
13456
+ }
13457
+ if(!dirty) {
13346
13458
  return false;
13347
13459
  }
13348
13460
 
@@ -13369,7 +13481,7 @@ RowDefinition.prototype.setContent = function(userInput) {
13369
13481
  this._displayText = this._ric; // No 0#
13370
13482
  }
13371
13483
 
13372
- this._dataId = this._rowId + this._ric; // JET/RTK will generate data id to be rowId (given from this rowDef) + ric;
13484
+ this._dataId = this._rowId + this.getSymbol(); // JET/RTK will generate data id to be rowId (given from this rowDef) + ric;
13373
13485
 
13374
13486
  // This will work for runtime ric modification, but not for first initilization.
13375
13487
  if(!this.subscribeForUpdates()) {
@@ -13397,6 +13509,11 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
13397
13509
  obj["ric"] = val;
13398
13510
  }
13399
13511
 
13512
+ val = this._permId;
13513
+ if(val) {
13514
+ obj["permId"] = val;
13515
+ }
13516
+
13400
13517
  val = this._chainRic;
13401
13518
  if(val) {
13402
13519
  obj["chainRic"] = val;
@@ -13642,6 +13759,18 @@ RowDefinition.prototype.getRic = function() {
13642
13759
  /** @public
13643
13760
  * @return {string}
13644
13761
  */
13762
+ RowDefinition.prototype.getPermId = function() {
13763
+ return this._permId;
13764
+ };
13765
+ /** @public
13766
+ * @return {string}
13767
+ */
13768
+ RowDefinition.prototype.getSymbol = function() {
13769
+ return this._ric || this._permId;
13770
+ };
13771
+ /** @public
13772
+ * @return {string}
13773
+ */
13645
13774
  RowDefinition.prototype.getDisplayText = function() {
13646
13775
  if(this._label != null) { // Empty string is allowed
13647
13776
  return this._label;
@@ -13707,7 +13836,7 @@ RowDefinition.prototype.isAutoGenerated = function() {
13707
13836
  * @return {boolean}
13708
13837
  */
13709
13838
  RowDefinition.prototype.isRealTimeRow = function() {
13710
- if(!this._ric) { // Empty row
13839
+ if(!this.getRic()) { // Empty row
13711
13840
  return false;
13712
13841
  }
13713
13842
  if(this.isRowHeader()) {
@@ -13724,7 +13853,7 @@ RowDefinition.prototype.isRealTimeRow = function() {
13724
13853
  * @return {boolean} If a subscription is made, return true.
13725
13854
  */
13726
13855
  RowDefinition.prototype.subscribeForUpdates = function() {
13727
- if(!this.isRealTimeRow()) {
13856
+ if(!this.isRealTimeRow() && !this.getPermId()) {
13728
13857
  return false;
13729
13858
  }
13730
13859
 
@@ -13738,14 +13867,14 @@ RowDefinition.prototype.subscribeForUpdates = function() {
13738
13867
  if(this.isChain()) {
13739
13868
  this._subId = subs["addChain"](this._chainRic || this._ric, this._rowId); // Some chain require 0# symbol to populate its constituents
13740
13869
  // TODO: Handle Dynamic chain such as .PG.PA
13741
- } else {
13870
+ } else if(this._ric) {
13742
13871
  this._subId = subs["addRic"](this._ric, this._rowId);
13743
13872
  }
13744
13873
 
13745
13874
  if(prevRowData) {
13746
13875
  this._dc.setRowData(this._dataId, prevRowData); // TODO: We may need to create a new object instead of prevRowData for data correctness
13747
13876
  } else {
13748
- this._dc.setRowData(this._dataId, {"X_RIC_NAME": this._ric, "ROW_DEF": this}); // Trigger data update immediately
13877
+ this._dc.setRowData(this._dataId, {"X_RIC_NAME": this.getSymbol(), "ROW_DEF": this}); // Trigger data update immediately
13749
13878
  }
13750
13879
  return true;
13751
13880
  };
@@ -15402,7 +15531,7 @@ ColumnDefinition.prototype.getAllFields = function() {
15402
15531
  * @return {boolean}
15403
15532
  */
15404
15533
  ColumnDefinition.prototype.isRealTimeField = function() {
15405
- return js_FieldDefinition.isRealTimeField(this.getField());
15534
+ return js_FieldDefinition.isRealTimeField(this.getField() || this._field);
15406
15535
  };
15407
15536
  /** @public
15408
15537
  * @return {boolean}
@@ -15593,8 +15722,9 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
15593
15722
  obj["sort"] = this._initialOrder;
15594
15723
  }
15595
15724
 
15596
- if(this._classes) {
15597
- obj["className"] = this._classes.join(" ");
15725
+ var classes = this._classes;
15726
+ if(classes && classes.length > 0) {
15727
+ obj["className"] = classes.join(" ");
15598
15728
  }
15599
15729
 
15600
15730
  if(this._textSelect) {
@@ -15612,14 +15742,18 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
15612
15742
  var core = this._eventArg["core"];
15613
15743
  var grid = this._eventArg["grid"];
15614
15744
  var colIndex = grid.getColumnIndex(this);
15615
- value = core.getColumnScalability(colIndex);
15616
- obj["scalable"] = value;
15617
15745
 
15618
- value = core.getColumnCustomLaneSize(colIndex);
15619
- obj["width"] = value;
15746
+ // The scalable, width and minWidth cannot be shifted into core as getConfigObject is accessible from colDef.
15747
+ var scalable = core.getColumnScalability(colIndex);
15748
+ var width = core.getColumnCustomLaneSize(colIndex);
15749
+
15750
+ if (scalable !== true || width !== 1) {
15751
+ obj["scalable"] = scalable;
15752
+ obj["width"] = width;
15753
+ }
15620
15754
 
15621
15755
  value = core.getMinimumColumnWidth(colIndex);
15622
- if(value !== 32) {
15756
+ if(value !== 0) {
15623
15757
  obj["minWidth"] = value;
15624
15758
  }
15625
15759
 
@@ -15976,16 +16110,6 @@ ColumnDefinition.prototype._setCoreColumnDef = function(obj) {
15976
16110
 
15977
16111
 
15978
16112
 
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
16113
 
15990
16114
  /** This class make requesting ADC field easier by encapsulating JET.Data APIs and mapping data to the row
15991
16115
  * @constructor
@@ -16305,7 +16429,7 @@ SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
16305
16429
  var updatedData = {};
16306
16430
  for (ric in ricMap) {
16307
16431
  var obj = ricMap[ric];
16308
- if (!isEmptyObject(obj)) {
16432
+ if (!Object(Util["f" /* isEmptyObject */])(obj)) {
16309
16433
  updatedData[ric] = obj;
16310
16434
  }
16311
16435
  }
@@ -16378,7 +16502,7 @@ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
16378
16502
  var updatedData = {};
16379
16503
  for (ric in ricMap) {
16380
16504
  var obj = ricMap[ric];
16381
- if (!isEmptyObject(obj)) {
16505
+ if (!Object(Util["f" /* isEmptyObject */])(obj)) {
16382
16506
  updatedData[ric] = obj;
16383
16507
  }
16384
16508
  }
@@ -16448,7 +16572,7 @@ SnapshotFiller.prototype._onRTKTimeSeriesSuccess = function (fields, serverResul
16448
16572
  var dataMapping = {};
16449
16573
  for (ric in ricMap) {
16450
16574
  var obj = ricMap[ric];
16451
- if (!isEmptyObject(obj)) {
16575
+ if (!Object(Util["f" /* isEmptyObject */])(obj)) {
16452
16576
  dataMapping[ric] = obj;
16453
16577
  }
16454
16578
  }
@@ -31837,7 +31961,7 @@ DataView.prototype._sort = function() {
31837
31961
  if(this._dt._getSegmentSeparators() || this.isSorting()) {
31838
31962
  var rids = this._rids;
31839
31963
  var dataRows = this._dt.getMultipleRowData(rids);
31840
- var segmentValues = this._dt.getSegmentValues(rids);
31964
+ var segmentValues = this._dt.getSegmentValues(rids, true); // WARNING: This does not work well for hidden/filtered rows
31841
31965
  var change = data_DataTable._performMultiLevelSorting(dataRows, this._sortingDefs, segmentValues);
31842
31966
 
31843
31967
  if(change) {
@@ -35591,7 +35715,7 @@ Core.prototype._groupDefs = null;
35591
35715
  * @return {string}
35592
35716
  */
35593
35717
  Core.getVersion = function () {
35594
- return "5.1.41";
35718
+ return "5.1.44";
35595
35719
  };
35596
35720
  /** {@link ElementWrapper#dispose}
35597
35721
  * @override
@@ -35727,10 +35851,10 @@ Core.prototype.getConfigObject = function (gridOptions) {
35727
35851
  }
35728
35852
  }
35729
35853
 
35730
- if(this._rowHighlighting) {
35731
- obj["rowHighlighting"] = true;
35732
- }
35733
- obj["columnVirtualization"] = this._colVirtualizer.isEnabled();
35854
+ // It will be overwrite in rt-grid or atlas-blotter
35855
+ obj["rowVirtualization"] = this.isRowVirtualizationEnabled();
35856
+ obj["columnVirtualization"] = this.isColumnVirtualizationEnabled();
35857
+ obj["rowHighlighting"] = this._rowHighlighting;
35734
35858
 
35735
35859
  if(this._fixFrozenTopSections) {
35736
35860
  obj["topFreezingCount"] = this._startVScrollbarIndex >= 0 ? (this._startVScrollbarIndex + 1) : false;
@@ -35743,7 +35867,13 @@ Core.prototype.getConfigObject = function (gridOptions) {
35743
35867
  if(this._rowScrollingStep) {
35744
35868
  obj["stepScroll"] = (this._rowScrollingStep === 1) ? true : this._rowScrollingStep;
35745
35869
  }
35746
- obj["autoHideScrollbar"] = this._vscrollbar.getAutoHide(); // this._hscrollbar has the same settings
35870
+
35871
+ var val = this._vscrollbar.getAutoHide();
35872
+ if(val !== true) {
35873
+ // TODO: check this._hscrollbar and this._vscrollbar can be difference config
35874
+ obj["autoHideScrollbar"] = val; // this._hscrollbar has the same settings
35875
+ }
35876
+
35747
35877
  var wheelSpeed = this._vscrollbar.getMouseWheelSpeed();
35748
35878
  if(wheelSpeed) {
35749
35879
  obj["linearWheelScrolling"] = wheelSpeed;
@@ -38716,6 +38846,14 @@ Core.prototype.enableRowVirtualization = function (opt_enabled) {
38716
38846
  this._rowVirtualizer.deactivate();
38717
38847
  }
38718
38848
  };
38849
+
38850
+ /** @public
38851
+ * @return {boolean}
38852
+ */
38853
+ Core.prototype.isRowVirtualizationEnabled = function () {
38854
+ return this._rowVirtualizer.isEnabled();
38855
+ };
38856
+
38719
38857
  /** No runtime support
38720
38858
  * @public
38721
38859
  * @param {boolean=} opt_enabled
@@ -38730,6 +38868,13 @@ Core.prototype.enableColumnVirtualization = function (opt_enabled) {
38730
38868
  }
38731
38869
  };
38732
38870
 
38871
+ /** @public
38872
+ * @return {boolean}
38873
+ */
38874
+ Core.prototype.isColumnVirtualizationEnabled = function () {
38875
+ return this._colVirtualizer.isEnabled();
38876
+ };
38877
+
38733
38878
  /** 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
38879
  * then the actual scrolling step for vertical scrollbar will be (32 * 2) = 64 pixels
38735
38880
  * @public
@@ -40746,7 +40891,7 @@ StyleLoader.chainIcon = '';
40746
40891
  /** @type {string}
40747
40892
  * @public
40748
40893
  */
40749
- StyleLoader.styles = Object(Util["g" /* prettifyCss */])([
40894
+ StyleLoader.styles = Object(Util["i" /* prettifyCss */])([
40750
40895
  ".tr-grid .chain-icon", [
40751
40896
  "cursor: pointer;"
40752
40897
  ],
@@ -40769,7 +40914,7 @@ StyleLoader.styles = Object(Util["g" /* prettifyCss */])([
40769
40914
  StyleLoader.applyStyle = function (grid) {
40770
40915
  if (grid && !grid._rowGroupingStyles) { // TODO: Support run-time theme loading
40771
40916
  grid._rowGroupingStyles = true; // Prevent loading the same style twice
40772
- Object(Util["d" /* injectCss */])(StyleLoader.styles, grid.getElement());
40917
+ Object(Util["e" /* injectCss */])(StyleLoader.styles, grid.getElement());
40773
40918
  }
40774
40919
  };
40775
40920
 
@@ -41107,7 +41252,7 @@ DataConnector.prototype.getRowDefByRic = function (ric) {
41107
41252
  * @return {boolean} True if new reference is added.
41108
41253
  */
41109
41254
  DataConnector.prototype.addRic = function (rowDef) {
41110
- var ric = rowDef ? rowDef.getRic() : "";
41255
+ var ric = rowDef ? rowDef.getSymbol() : "";
41111
41256
  if(!ric) {
41112
41257
  return false;
41113
41258
  }
@@ -41135,7 +41280,8 @@ DataConnector.prototype.addRic = function (rowDef) {
41135
41280
  */
41136
41281
  DataConnector.prototype.removeRic = function (rowDef, ric) {
41137
41282
  if(!ric) {
41138
- ric = rowDef ? rowDef.getRic() : "";
41283
+ // TODO: RIC or permId maybe change during run-time, need to check before remove RIC/permId
41284
+ ric = rowDef ? rowDef.getSymbol() : "";
41139
41285
  }
41140
41286
  if(!ric) {
41141
41287
  return;
@@ -41442,6 +41588,7 @@ RowDefSorter.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
41442
41588
 
41443
41589
 
41444
41590
 
41591
+
41445
41592
  /* eslint-enable */
41446
41593
 
41447
41594
  /** Fired when user click and before the sorting operation.
@@ -41901,7 +42048,10 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
41901
42048
  }
41902
42049
  field = opt["field"];
41903
42050
  if (field) {
41904
- col["sortBy"] = field;
42051
+ if(col["field"] !== field) {
42052
+ col["sortBy"] = field;
42053
+ } // else The default value is an empty sortBy, which refers to the same column field by default.
42054
+
41905
42055
  if (this._sortingSequenceMap && this._sortingSequenceMap[field]) {
41906
42056
  col["sortingSequence"] = this._sortingSequenceMap[field];
41907
42057
  }
@@ -41914,16 +42064,32 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
41914
42064
  extOptions = obj["sorting"] = {};
41915
42065
  }
41916
42066
 
41917
- extOptions["initialSort"] = this.getSortedColumns();
41918
- extOptions["sortableIndicator"] = this._sortableIndicator;
42067
+ var val = this.getSortedColumns();
42068
+ if(val != null) {
42069
+ extOptions["initialSort"] = val;
42070
+ }
42071
+
42072
+ val = this._sortableIndicator;
42073
+ if(val !== false) {
42074
+ extOptions["sortableIndicator"] = val;
42075
+ }
42076
+
41919
42077
  if(this._maxCount !== 1) {
41920
42078
  extOptions["multiColumn"] = this._maxCount === -1 ? true : this._maxCount;
41921
42079
  }
41922
42080
  if(this._dblClickAllowed) {
41923
42081
  extOptions["disableDoubleClickToSort"] = !this._dblClickAllowed;
41924
42082
  }
41925
- extOptions["sortableColumns"] = this._sortableColumns;
41926
- extOptions["indicatorOnly"] = !this._dataSorting;
42083
+
42084
+ val = this._sortableColumns;
42085
+ if(val !== true) {
42086
+ extOptions["sortableColumns"] = val;
42087
+ }
42088
+
42089
+ val = this._dataSorting;
42090
+ if(val !== true) {
42091
+ extOptions["indicatorOnly"] = val;
42092
+ }
41927
42093
  // extOptions["mode"] = this._mode;
41928
42094
  if(this._disabled) {
41929
42095
  extOptions["disabled"] = true;
@@ -41940,6 +42106,10 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
41940
42106
  extOptions["sortingSequence"] = sortingSeq.slice();
41941
42107
  }
41942
42108
 
42109
+ if(Object(Util["f" /* isEmptyObject */])(obj["sorting"])) {
42110
+ delete obj["sorting"];
42111
+ }
42112
+
41943
42113
  return obj;
41944
42114
  };
41945
42115
 
@@ -44220,7 +44390,7 @@ Grid.prototype.initialize = function(gridOption) {
44220
44390
  if(rows[n]["values"]) { // merge row's values, values can be object or array
44221
44391
  values = Object(Util["a" /* arrayToObject */])(rows[n]["values"], fields);
44222
44392
  data = Object(Util["a" /* arrayToObject */])(ary[n], fields);
44223
- rows[n]["values"] = Object(Util["c" /* extendObject */])(values, data);
44393
+ rows[n]["values"] = Object(Util["d" /* extendObject */])(values, data);
44224
44394
  } else {
44225
44395
  rows[n]["values"] = ary[n];
44226
44396
  }
@@ -44282,6 +44452,28 @@ Grid.prototype.getConfigObject = function (gridOptions) {
44282
44452
  grid.getConfigObject(obj);
44283
44453
  }
44284
44454
 
44455
+ // Difference from composite grid in default config
44456
+ if(obj["columnVirtualization"] === false) {
44457
+ delete obj["columnVirtualization"];
44458
+ }
44459
+
44460
+ if(obj["rowVirtualization"] === true) {
44461
+ delete obj["rowVirtualization"];
44462
+ }
44463
+
44464
+ if(obj["rowHighlighting"] === true) {
44465
+ delete obj["rowHighlighting"];
44466
+ }
44467
+
44468
+ if(obj["contentVerticalLines"] === false) { // the default value change in wrapper (atlas-blotter)
44469
+ delete obj["contentVerticalLines"];
44470
+ }
44471
+
44472
+ if(obj["borders"] === false) { // the default value change in wrapper (atlas-blotter)
44473
+ delete obj["borders"];
44474
+ }
44475
+
44476
+
44285
44477
  var i, len;
44286
44478
  len = this.getColumnCount();
44287
44479
  for (i = 0; i < len; ++i) {
@@ -44306,12 +44498,12 @@ Grid.prototype.getConfigObject = function (gridOptions) {
44306
44498
  }
44307
44499
 
44308
44500
  val = grid.getDefaultRowHeight();
44309
- if(val !== 32) {
44501
+ if(val !== 28) { // the default value change in wrapper (atlas-blotter)
44310
44502
  obj["rowHeight"] = val;
44311
44503
  }
44312
44504
 
44313
44505
  val = grid.getSection("title").getDefaultRowHeight();
44314
- if(val !== 32) {
44506
+ if(val !== 28) { // the default value change in wrapper (atlas-blotter)
44315
44507
  obj["headerRowHeight"] = val;
44316
44508
  }
44317
44509
 
@@ -44319,7 +44511,8 @@ Grid.prototype.getConfigObject = function (gridOptions) {
44319
44511
  obj["autoLayoutUpdate"] = true;
44320
44512
  }
44321
44513
 
44322
- if (this._defaultColumnOptions) {
44514
+ val = Object(Util["f" /* isEmptyObject */])(this._defaultColumnOptions);
44515
+ if (!val) { // Currently, this variable is the object, we need to check empty array for default value
44323
44516
  obj["defaultColumnOptions"] = this._defaultColumnOptions;
44324
44517
  }
44325
44518
 
@@ -44378,10 +44571,13 @@ Grid.prototype.getConfigObject = function (gridOptions) {
44378
44571
  }
44379
44572
 
44380
44573
  // TODO: The following states need to be retrieved
44381
- // rowHighlighting
44382
- // columnVirtualization
44383
44574
  // topFreezingCount, bottomFreezingCount
44384
44575
  // scrollbarParent
44576
+ // linearWheelScrolling
44577
+ // stepScroll
44578
+ // noColumnDragging
44579
+ // columnReorder
44580
+ // topSection
44385
44581
 
44386
44582
  // NOTE: no need to export synapseApiKey, ADC and RTK
44387
44583
 
@@ -44457,7 +44653,7 @@ Grid.prototype._onRicAdded = function(e) {
44457
44653
  var jLen = rowDefs ? rowDefs.length : 0;
44458
44654
  for (var j = 0; j < jLen; ++j) {
44459
44655
  var rowDef = rowDefs[j];
44460
- if (rowDef.getRic() === ric) {
44656
+ if (rowDef.getSymbol() === ric) {
44461
44657
  this._snapshot.addRic(ric); // ADC
44462
44658
  }
44463
44659
  }
@@ -44482,7 +44678,7 @@ Grid.prototype._onFieldAdded = function(e) {
44482
44678
 
44483
44679
  // ADC
44484
44680
  for (var i in rowDefs) {
44485
- this._snapshot.addRic(rowDefs[i].getRic());
44681
+ this._snapshot.addRic(rowDefs[i].getSymbol());
44486
44682
  }
44487
44683
  this._snapshot.addFields(addedFields);
44488
44684
 
@@ -44676,7 +44872,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
44676
44872
  colConfig["width"] = value;
44677
44873
 
44678
44874
  value = core.getMinimumColumnWidth(colIndex);
44679
- if(value !== 32) {
44875
+ if(value > 0) {
44680
44876
  colConfig["minWidth"] = value;
44681
44877
  }
44682
44878
 
@@ -44830,6 +45026,79 @@ Grid.prototype.setColumns = function(columns) {
44830
45026
  }
44831
45027
  }
44832
45028
  };
45029
+
45030
+
45031
+ /** Remove, add and keep column based on the given column data
45032
+ * @public
45033
+ * @param {Array.<Object>} columns Array of column options
45034
+ */
45035
+ Grid.prototype.restoreColumns = function(columns) {
45036
+ var configObj = this.getConfigObject();
45037
+ var previousColumns = configObj.columns;
45038
+
45039
+ var preColLen = previousColumns.length;
45040
+ var newColLen = columns.length;
45041
+
45042
+ var removingFields = [];
45043
+ var keepingColumns = [];
45044
+ var columnOrdering = [];
45045
+
45046
+ var i, j, found;
45047
+ // Slow, time complexity BigO(n ^ 2)
45048
+ for (i = 0; i < preColLen; i++) {
45049
+ found = false;
45050
+ for (j = 0; j < newColLen; j++) {
45051
+ if (Object(Util["c" /* deepEqual */])(previousColumns[i], columns[j])) {
45052
+ keepingColumns.push(previousColumns[i]);
45053
+ found = true;
45054
+ break;
45055
+ }
45056
+ }
45057
+ if (!found) {
45058
+ removingFields.push(previousColumns[i].field);
45059
+ }
45060
+ }
45061
+
45062
+ var sortingStates;
45063
+ var removeLen = removingFields.length;
45064
+ if(removeLen > 0 && this._stp) {
45065
+ sortingStates = this._stp.getSortingStates().slice(); // We need to clone array for avoid object reference in remove column
45066
+ }
45067
+
45068
+ this.removeColumns(removingFields);
45069
+
45070
+ var keepingLen = keepingColumns.length;
45071
+ var prevState = false;
45072
+ if(newColLen > 1) {
45073
+ prevState = this._grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
45074
+ }
45075
+ for (i = 0; i < newColLen; i++) {
45076
+ found = false;
45077
+ for (j = 0; j < keepingLen; j++) { // loop only keeping column
45078
+ if (Object(Util["c" /* deepEqual */])(columns[i], keepingColumns[j])) {
45079
+ found = true;
45080
+ 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.
45081
+ columnOrdering.push(this.getColumnId(colIndex));
45082
+ break;
45083
+ }
45084
+ }
45085
+ if (!found) {
45086
+ this.insertColumn(columns[i], i);
45087
+ columnOrdering.push(this.getColumnId(i)); // Use new insertion column index
45088
+ }
45089
+ }
45090
+
45091
+ if(newColLen > 1) {
45092
+ this._grid.freezeLayout(prevState);
45093
+ }
45094
+
45095
+ if(removeLen > 0 && this._stp) {
45096
+ this._stp.sortColumns(sortingStates);
45097
+ }
45098
+
45099
+ this._grid.reorderColumns(columnOrdering);
45100
+ };
45101
+
44833
45102
  /** Remove all existing columns and add new columns based on the given texts/fields
44834
45103
  * @public
44835
45104
  * @function
@@ -44974,10 +45243,11 @@ Grid.prototype.removeColumn = function(colRef) {
44974
45243
  this._dc.removeStaticFields([colDef.getField()]);
44975
45244
  }
44976
45245
  }
44977
- colDef.dispose();
44978
- this._grid.removeColumnAt(colIndex);
44979
45246
 
45247
+ this._grid.removeColumnAt(colIndex);
44980
45248
  this._connector.removeFields(colDef);
45249
+
45250
+ colDef.dispose(); // Dispose at the last line to avoid making properties inaccessible
44981
45251
  // TODO: Remove fields that are related to the column (e.g. fields for coloring)
44982
45252
  };
44983
45253
  /** Remove multiple columns through array. To remove all columns, use removeAllColumns() instead of this method
@@ -45323,7 +45593,7 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
45323
45593
  * @param {RowDefinition} rowDef
45324
45594
  */
45325
45595
  Grid.prototype._initDuplicateRicData = function(rowDef) {
45326
- var ric = rowDef.getRic();
45596
+ var ric = rowDef.getSymbol();
45327
45597
  var rowDefs = this._connector.getRowDefByRic(ric);
45328
45598
  if(rowDefs && rowDefs.length) {
45329
45599
  cloneRowData(rowDefs[0], rowDef);
@@ -45740,8 +46010,9 @@ Grid.prototype.setRic = function(rowRef, str, options) {
45740
46010
  this.insertRow(options, rowIndex);
45741
46011
  }
45742
46012
  } else {
45743
- var oldRic = rowDef.getRic();
45744
- if(rowDef.setContent(str)) { // The given string may not be a RIC
46013
+ var oldRic = rowDef.getSymbol();
46014
+ var permId = options["permId"] || "";
46015
+ if(rowDef.setContent(str, permId)) { // The given string may not be a RIC
45745
46016
  this._connector.removeRic(rowDef, oldRic);
45746
46017
  this._initDuplicateRicData(rowDef);
45747
46018
  this._connector.addRic(rowDef);
@@ -46062,7 +46333,7 @@ Grid.prototype.setRicData = function(ric, values) {
46062
46333
  var rowCount = rowDefs ? rowDefs.length : 0;
46063
46334
  for (var i = 0; i < rowCount; ++i) {
46064
46335
  var rowDef = rowDefs[i];
46065
- if (rowDef && rowDef.getRic() === ric) {
46336
+ if (rowDef && rowDef.getSymbol() === ric) {
46066
46337
  rowDef.setRowData(values); // TODO: Need conflator to improve performance
46067
46338
  }
46068
46339
  }
@@ -49979,7 +50250,7 @@ CellPainter.themeReady = null;
49979
50250
  * var fn = CellPainter.parse("[CF_BID] >= 10 && [CF_BID] <= 100");
49980
50251
  * window.console.log(fn(25));
49981
50252
  */
49982
- CellPainter.parse = Util["f" /* parseCondition */];
50253
+ CellPainter.parse = Util["h" /* parseCondition */];
49983
50254
 
49984
50255
 
49985
50256
  /** @public */
@@ -50077,25 +50348,17 @@ CellPainter.prototype.clearHeatMap = function() {
50077
50348
  /** @public */
50078
50349
  CellPainter.prototype.applyThemeColor = function() {
50079
50350
  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
50351
+ if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) { // Heatmap uses grid color to blend the result color
50352
+ var cond = this._conditions[0]; // Heatmap, color text condition must be the first
50353
+ if(cond) {
50083
50354
  if(cond["textMode"]) {
50084
50355
  cond["baseColor"] = colors["baseText"];
50085
50356
  } else {
50086
50357
  cond["baseColor"] = colors["baseGrid"];
50087
50358
  }
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
- }
50359
+ if(cond["useThemeColor"]) {
50360
+ var up = colors["up"];
50361
+ var down = colors["down"];
50099
50362
  var level = (colors["level"] === colors["baseText"]) ? "" : colors["level"];
50100
50363
  CellPainter._setUpDownColors(cond, up, down, level);
50101
50364
  }
@@ -50214,34 +50477,36 @@ CellPainter.prototype.addHeatmapWithTheme = function(field, midPoint, opt_textMo
50214
50477
  /** @private
50215
50478
  * @param {Function} expression
50216
50479
  * @param {string} field
50217
- * @param {string} upColor
50218
- * @param {string} downColor
50219
- * @param {string} levelColor
50480
+ * @param {string=} upClass CSS class name
50481
+ * @param {string=} downClass CSS class name
50482
+ * @param {string=} levelClass CSS class name
50220
50483
  * @return {!Object}
50221
50484
  */
50222
- CellPainter.prototype._addColorText = function(expression, field, upColor, downColor, levelColor) {
50485
+ CellPainter.prototype._addColorText = function(expression, field, upClass, downClass, levelClass) {
50223
50486
  this._setColoringType(CellPainter.ColoringTypes.TEXT);
50224
50487
 
50225
50488
  var condition = {};
50226
50489
  condition["field"] = field;
50227
50490
  condition["expression"] = expression.bind(null, field);
50228
- CellPainter._setUpDownColors(condition, upColor, downColor, levelColor);
50491
+ condition["upClass"] = upClass;
50492
+ condition["downClass"] = downClass;
50493
+ condition["levelClass"] = levelClass;
50229
50494
 
50230
50495
  this._addCondition(condition);
50231
50496
  return condition;
50232
50497
  };
50233
50498
  /** @public
50234
50499
  * @param {string} field
50235
- * @param {string} upColor
50236
- * @param {string} downColor
50237
- * @param {string} levelColor
50500
+ * @param {string=} upClass CSS class name
50501
+ * @param {string=} downClass CSS class name
50502
+ * @param {string=} levelClass CSS class name
50238
50503
  * @return {!Object}
50239
50504
  */
50240
- CellPainter.prototype.addColorText = function(field, upColor, downColor, levelColor) {
50505
+ CellPainter.prototype.addColorText = function(field, upClass, downClass, levelClass) {
50241
50506
  return this._addColorText(
50242
50507
  TickFields[field] ? CellPainter._tickColorTextCondition : CellPainter._colorTextCondition,
50243
50508
  field,
50244
- upColor, downColor, levelColor
50509
+ upClass, downClass, levelClass
50245
50510
  );
50246
50511
  };
50247
50512
  /** @public
@@ -50249,14 +50514,7 @@ CellPainter.prototype.addColorText = function(field, upColor, downColor, levelCo
50249
50514
  * @return {!Object}
50250
50515
  */
50251
50516
  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;
50517
+ var condition = this.addColorText(field, "positive", "negative", "neutral");
50260
50518
  return condition;
50261
50519
  };
50262
50520
  /** @public
@@ -50358,14 +50616,16 @@ CellPainter.prototype.renderForPrinting = function(cell, rowData, min, max) {
50358
50616
  return;
50359
50617
  }
50360
50618
  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;
50619
+ var cssClass = styles["cssClass"]; // Can be an empty string
50620
+ if (cssClass != null) { // Predefined colors mode
50621
+ if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
50622
+ elem.classList.remove(elem._coloringCssClass);
50623
+ elem._coloringCssClass = null;
50624
+ }
50625
+ if (cssClass) {
50626
+ elem.classList.add(cssClass);
50627
+ elem._coloringCssClass = cssClass;
50366
50628
  }
50367
- cell.classList.add(cssClass);
50368
- cell._coloringCssClass = cssClass;
50369
50629
  } else {
50370
50630
  if (cell._coloringCssClass) {
50371
50631
  cell.classList.remove(cell._coloringCssClass);
@@ -50498,14 +50758,17 @@ CellPainter._cellRestorer = function(scope) {
50498
50758
  }
50499
50759
 
50500
50760
  var styles = this._getStyles(rowData, min, max);
50501
- var cssClass = styles["cssClass"];
50502
- if (cssClass) {
50761
+ var cssClass = styles["cssClass"]; // Can be an empty string
50762
+ if (cssClass != null) { // Predefined colors mode
50503
50763
  if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
50504
50764
  elem.classList.remove(elem._coloringCssClass);
50505
50765
  elem._coloringCssClass = null;
50506
50766
  }
50507
- elem.classList.add(cssClass);
50508
- elem._coloringCssClass = cssClass;
50767
+ if (cssClass) {
50768
+ elem.classList.add(cssClass);
50769
+ elem._coloringCssClass = cssClass;
50770
+ }
50771
+ // Remove blinking color
50509
50772
  elem.style.backgroundColor = "";
50510
50773
  elem.style.color = "";
50511
50774
  } else {
@@ -50560,13 +50823,14 @@ CellPainter.prototype._getStyles = function(rowData, min, max) {
50560
50823
  }
50561
50824
  } else if(this._coloringType === CellPainter.ColoringTypes.TEXT) {
50562
50825
  if(ret > 0) {
50563
- CellPainter._colorObj["color"] = curCond["upColor"];
50826
+ curCond["cssClass"] = curCond["upClass"];
50564
50827
  } else if(ret < 0) {
50565
- CellPainter._colorObj["color"] = curCond["downColor"];
50828
+ curCond["cssClass"] = curCond["downClass"];
50566
50829
  } else {
50567
- CellPainter._colorObj["color"] = this._levelColorDisabled ? "" : curCond["levelColor"];
50830
+ curCond["cssClass"] = this._levelColorDisabled ? "" : curCond["levelClass"];
50568
50831
  }
50569
- return CellPainter._colorObj;
50832
+ curCond["cssClass"] = curCond["cssClass"] || "";
50833
+ return curCond;
50570
50834
  }
50571
50835
 
50572
50836
  // Expected return value is {
@@ -50626,7 +50890,7 @@ CellPainter.blackAndWhite = function (triplet) {
50626
50890
  * @param {string} rgbCode
50627
50891
  * @return {string} resultColor E.g. "#10FF0D"
50628
50892
  */
50629
- CellPainter.rgb2Hex = Util["h" /* rgb2Hex */]; // For backward compatability
50893
+ CellPainter.rgb2Hex = Util["j" /* rgb2Hex */]; // For backward compatability
50630
50894
 
50631
50895
  /** @public
50632
50896
  * @function
@@ -50742,6 +51006,10 @@ CellPainter.clearCellStyle = function(cell, styles) {
50742
51006
  // WARNING: Scope is not removed from the this._scopes collection to speed things up
50743
51007
  }
50744
51008
 
51009
+ if(elem._coloringCssClass) {
51010
+ elem.classList.remove(elem._coloringCssClass);
51011
+ }
51012
+
50745
51013
  styles = styles || CellPainter.supportedStyles;
50746
51014
  for(var i = styles.length; --i >= 0;) {
50747
51015
  elem.style[styles[i]] = ""; // WARNING: Very slow
@@ -50755,22 +51023,24 @@ CellPainter.clearCellStyle = function(cell, styles) {
50755
51023
  * @param {boolean=} withContrast
50756
51024
  */
50757
51025
  CellPainter._setUpDownColors = function(scp, upColor, downColor, levelColor, withContrast) {
51026
+ scp["upColor"] = upColor;
50758
51027
  if(upColor != null) {
50759
- scp["upColor"] = upColor;
50760
51028
  if(withContrast) {
50761
51029
  scp["contrastUpColor"] = CellPainter.getOppositeColor(upColor);
50762
51030
  }
50763
51031
  //scp["rgbUp"] = CellPainter.hex2Rgb(upColor);
50764
51032
  }
51033
+
51034
+ scp["downColor"] = downColor;
50765
51035
  if(downColor != null) {
50766
- scp["downColor"] = downColor;
50767
51036
  if(withContrast) {
50768
51037
  scp["contrastDownColor"] = CellPainter.getOppositeColor(downColor);
50769
51038
  }
50770
51039
  //scp["rgbDown"] = CellPainter.hex2Rgb(downColor);
50771
51040
  }
51041
+
51042
+ scp["levelColor"] = levelColor;
50772
51043
  if(levelColor != null) {
50773
- scp["levelColor"] = levelColor;
50774
51044
  if(withContrast) {
50775
51045
  scp["contrastLevelColor"] = CellPainter.getOppositeColor(levelColor);
50776
51046
  }
@@ -50864,14 +51134,16 @@ CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
50864
51134
  }
50865
51135
 
50866
51136
  var styles = this._getStyles(rowData, min, max);
50867
- var cssClass = styles["cssClass"];
50868
- if (cssClass) {
50869
- if (elem._coloringCssClass !== cssClass) {
51137
+ var cssClass = styles["cssClass"]; // Can be an empty string
51138
+ if (cssClass != null) { // Predefined colors mode
51139
+ if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
50870
51140
  elem.classList.remove(elem._coloringCssClass);
50871
51141
  elem._coloringCssClass = null;
50872
51142
  }
50873
- elem.classList.add(cssClass);
50874
- elem._coloringCssClass = cssClass;
51143
+ if (cssClass) {
51144
+ elem.classList.add(cssClass);
51145
+ elem._coloringCssClass = cssClass;
51146
+ }
50875
51147
  } else {
50876
51148
  if (elem._coloringCssClass) {
50877
51149
  elem.classList.remove(elem._coloringCssClass);