@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
@@ -237,25 +237,17 @@ CellPainter.prototype.clearHeatMap = function() {
237
237
  /** @public */
238
238
  CellPainter.prototype.applyThemeColor = function() {
239
239
  var colors = ElfUtil.getColors();
240
- var cond = this._conditions[0]; // Heatmap, color text condition must be the first
241
- if(cond) {
242
- if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) { // Heatmap uses grid color to blend the result color
240
+ if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) { // Heatmap uses grid color to blend the result color
241
+ var cond = this._conditions[0]; // Heatmap, color text condition must be the first
242
+ if(cond) {
243
243
  if(cond["textMode"]) {
244
244
  cond["baseColor"] = colors["baseText"];
245
245
  } else {
246
246
  cond["baseColor"] = colors["baseGrid"];
247
247
  }
248
- }
249
- if(cond["useThemeColor"]) { // Only heatmap and colorText painters use theme color
250
- if(this._coloringType === CellPainter.ColoringTypes.HEATMAP || this._coloringType === CellPainter.ColoringTypes.TEXT) {
251
- var up, down;
252
- if(this._coloringType === CellPainter.ColoringTypes.TEXT && cond["field"] === "CF_TICK") {
253
- up = colors["tickUp"];
254
- down = colors["tickDown"];
255
- } else {
256
- up = colors["up"];
257
- down = colors["down"];
258
- }
248
+ if(cond["useThemeColor"]) {
249
+ var up = colors["up"];
250
+ var down = colors["down"];
259
251
  var level = (colors["level"] === colors["baseText"]) ? "" : colors["level"];
260
252
  CellPainter._setUpDownColors(cond, up, down, level);
261
253
  }
@@ -374,34 +366,36 @@ CellPainter.prototype.addHeatmapWithTheme = function(field, midPoint, opt_textMo
374
366
  /** @private
375
367
  * @param {Function} expression
376
368
  * @param {string} field
377
- * @param {string} upColor
378
- * @param {string} downColor
379
- * @param {string} levelColor
369
+ * @param {string=} upClass CSS class name
370
+ * @param {string=} downClass CSS class name
371
+ * @param {string=} levelClass CSS class name
380
372
  * @return {!Object}
381
373
  */
382
- CellPainter.prototype._addColorText = function(expression, field, upColor, downColor, levelColor) {
374
+ CellPainter.prototype._addColorText = function(expression, field, upClass, downClass, levelClass) {
383
375
  this._setColoringType(CellPainter.ColoringTypes.TEXT);
384
376
 
385
377
  var condition = {};
386
378
  condition["field"] = field;
387
379
  condition["expression"] = expression.bind(null, field);
388
- CellPainter._setUpDownColors(condition, upColor, downColor, levelColor);
380
+ condition["upClass"] = upClass;
381
+ condition["downClass"] = downClass;
382
+ condition["levelClass"] = levelClass;
389
383
 
390
384
  this._addCondition(condition);
391
385
  return condition;
392
386
  };
393
387
  /** @public
394
388
  * @param {string} field
395
- * @param {string} upColor
396
- * @param {string} downColor
397
- * @param {string} levelColor
389
+ * @param {string=} upClass CSS class name
390
+ * @param {string=} downClass CSS class name
391
+ * @param {string=} levelClass CSS class name
398
392
  * @return {!Object}
399
393
  */
400
- CellPainter.prototype.addColorText = function(field, upColor, downColor, levelColor) {
394
+ CellPainter.prototype.addColorText = function(field, upClass, downClass, levelClass) {
401
395
  return this._addColorText(
402
396
  TickFields[field] ? CellPainter._tickColorTextCondition : CellPainter._colorTextCondition,
403
397
  field,
404
- upColor, downColor, levelColor
398
+ upClass, downClass, levelClass
405
399
  );
406
400
  };
407
401
  /** @public
@@ -409,14 +403,7 @@ CellPainter.prototype.addColorText = function(field, upColor, downColor, levelCo
409
403
  * @return {!Object}
410
404
  */
411
405
  CellPainter.prototype.addColorTextWithTheme = function(field) {
412
- var colors = ElfUtil.themeColors;
413
- var condition = this.addColorText(field,
414
- colors["up"],
415
- colors["down"],
416
- (colors["level"] === colors["baseText"]) ? "" : colors["level"]
417
- );
418
-
419
- condition["useThemeColor"] = true;
406
+ var condition = this.addColorText(field, "positive", "negative", "neutral");
420
407
  return condition;
421
408
  };
422
409
  /** @public
@@ -518,14 +505,16 @@ CellPainter.prototype.renderForPrinting = function(cell, rowData, min, max) {
518
505
  return;
519
506
  }
520
507
  var styles = this._getStyles(rowData, min, max);
521
- var cssClass = styles["cssClass"];
522
- if (cssClass) {
523
- if (cell._coloringCssClass !== cssClass) {
524
- cell.classList.remove(cell._coloringCssClass);
525
- cell._coloringCssClass = null;
508
+ var cssClass = styles["cssClass"]; // Can be an empty string
509
+ if (cssClass != null) { // Predefined colors mode
510
+ if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
511
+ elem.classList.remove(elem._coloringCssClass);
512
+ elem._coloringCssClass = null;
513
+ }
514
+ if (cssClass) {
515
+ elem.classList.add(cssClass);
516
+ elem._coloringCssClass = cssClass;
526
517
  }
527
- cell.classList.add(cssClass);
528
- cell._coloringCssClass = cssClass;
529
518
  } else {
530
519
  if (cell._coloringCssClass) {
531
520
  cell.classList.remove(cell._coloringCssClass);
@@ -658,14 +647,17 @@ CellPainter._cellRestorer = function(scope) {
658
647
  }
659
648
 
660
649
  var styles = this._getStyles(rowData, min, max);
661
- var cssClass = styles["cssClass"];
662
- if (cssClass) {
650
+ var cssClass = styles["cssClass"]; // Can be an empty string
651
+ if (cssClass != null) { // Predefined colors mode
663
652
  if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
664
653
  elem.classList.remove(elem._coloringCssClass);
665
654
  elem._coloringCssClass = null;
666
655
  }
667
- elem.classList.add(cssClass);
668
- elem._coloringCssClass = cssClass;
656
+ if (cssClass) {
657
+ elem.classList.add(cssClass);
658
+ elem._coloringCssClass = cssClass;
659
+ }
660
+ // Remove blinking color
669
661
  elem.style.backgroundColor = "";
670
662
  elem.style.color = "";
671
663
  } else {
@@ -720,13 +712,14 @@ CellPainter.prototype._getStyles = function(rowData, min, max) {
720
712
  }
721
713
  } else if(this._coloringType === CellPainter.ColoringTypes.TEXT) {
722
714
  if(ret > 0) {
723
- CellPainter._colorObj["color"] = curCond["upColor"];
715
+ curCond["cssClass"] = curCond["upClass"];
724
716
  } else if(ret < 0) {
725
- CellPainter._colorObj["color"] = curCond["downColor"];
717
+ curCond["cssClass"] = curCond["downClass"];
726
718
  } else {
727
- CellPainter._colorObj["color"] = this._levelColorDisabled ? "" : curCond["levelColor"];
719
+ curCond["cssClass"] = this._levelColorDisabled ? "" : curCond["levelClass"];
728
720
  }
729
- return CellPainter._colorObj;
721
+ curCond["cssClass"] = curCond["cssClass"] || "";
722
+ return curCond;
730
723
  }
731
724
 
732
725
  // Expected return value is {
@@ -902,6 +895,10 @@ CellPainter.clearCellStyle = function(cell, styles) {
902
895
  // WARNING: Scope is not removed from the this._scopes collection to speed things up
903
896
  }
904
897
 
898
+ if(elem._coloringCssClass) {
899
+ elem.classList.remove(elem._coloringCssClass);
900
+ }
901
+
905
902
  styles = styles || CellPainter.supportedStyles;
906
903
  for(var i = styles.length; --i >= 0;) {
907
904
  elem.style[styles[i]] = ""; // WARNING: Very slow
@@ -915,22 +912,24 @@ CellPainter.clearCellStyle = function(cell, styles) {
915
912
  * @param {boolean=} withContrast
916
913
  */
917
914
  CellPainter._setUpDownColors = function(scp, upColor, downColor, levelColor, withContrast) {
915
+ scp["upColor"] = upColor;
918
916
  if(upColor != null) {
919
- scp["upColor"] = upColor;
920
917
  if(withContrast) {
921
918
  scp["contrastUpColor"] = CellPainter.getOppositeColor(upColor);
922
919
  }
923
920
  //scp["rgbUp"] = CellPainter.hex2Rgb(upColor);
924
921
  }
922
+
923
+ scp["downColor"] = downColor;
925
924
  if(downColor != null) {
926
- scp["downColor"] = downColor;
927
925
  if(withContrast) {
928
926
  scp["contrastDownColor"] = CellPainter.getOppositeColor(downColor);
929
927
  }
930
928
  //scp["rgbDown"] = CellPainter.hex2Rgb(downColor);
931
929
  }
930
+
931
+ scp["levelColor"] = levelColor;
932
932
  if(levelColor != null) {
933
- scp["levelColor"] = levelColor;
934
933
  if(withContrast) {
935
934
  scp["contrastLevelColor"] = CellPainter.getOppositeColor(levelColor);
936
935
  }
@@ -1024,14 +1023,16 @@ CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
1024
1023
  }
1025
1024
 
1026
1025
  var styles = this._getStyles(rowData, min, max);
1027
- var cssClass = styles["cssClass"];
1028
- if (cssClass) {
1029
- if (elem._coloringCssClass !== cssClass) {
1026
+ var cssClass = styles["cssClass"]; // Can be an empty string
1027
+ if (cssClass != null) { // Predefined colors mode
1028
+ if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
1030
1029
  elem.classList.remove(elem._coloringCssClass);
1031
1030
  elem._coloringCssClass = null;
1032
1031
  }
1033
- elem.classList.add(cssClass);
1034
- elem._coloringCssClass = cssClass;
1032
+ if (cssClass) {
1033
+ elem.classList.add(cssClass);
1034
+ elem._coloringCssClass = cssClass;
1035
+ }
1035
1036
  } else {
1036
1037
  if (elem._coloringCssClass) {
1037
1038
  elem.classList.remove(elem._coloringCssClass);
@@ -62,8 +62,9 @@ DragUI.applyThemeColor = function(grid) {
62
62
  */
63
63
  DragUI.prototype.onThemeLoaded = function(colors) {
64
64
  if(!DragUI._styles) {
65
+ var ElfVersion = ElfUtil.getElfVersion();
65
66
  var cursor = "grabbing";
66
- if (ElfUtil.getElfVersion() < 3) {
67
+ if (ElfVersion < 3) {
67
68
  cursor = "move";
68
69
  }
69
70
  var styles = [ // Main Styles without theme
@@ -135,7 +136,8 @@ DragUI.prototype.onThemeLoaded = function(colors) {
135
136
  "--grid-insertion-icon-bgcolor: #39c46e;",
136
137
  "--grid-insertion-icon-color: #1A1A1A;",
137
138
  "--grid-void-icon-bgcolor: #F5475B;",
138
- "--grid-void-icon-color: #FFFFFF;"
139
+ "--grid-void-icon-color: #FFFFFF;",
140
+ "--grid-title-icon-color: var(--grid-guideline-color);" // v3 fallback
139
141
  ],
140
142
  ".mouse-dragging .cell:hover", [ // for change mouse cursor when hover header while dragging
141
143
  "cursor: " + cursor + " !important;"
@@ -149,10 +151,12 @@ DragUI.prototype.onThemeLoaded = function(colors) {
149
151
  ".tr-dragging, .tr-dragging *", [
150
152
  "-webkit-touch-callout: none;",
151
153
  ".user-select(none);"
154
+ ],
155
+ ".tr-dragbox", [
156
+ "background-color: unset;" // v3 fallback
152
157
  ]
153
158
  ];
154
159
  var guidelineColor = "#ff9933";
155
- var ElfVersion = ElfUtil.getElfVersion();
156
160
  if(colors.primary) {
157
161
  guidelineColor = colors.primary;
158
162
  }
@@ -189,8 +189,12 @@ FieldFormatter.prototype.getOptions = function(options) { // serialize
189
189
  options["field"] = this._field;
190
190
  options["formatType"] = this._userFormatType ? this._userFormatType : this._formatType; // WARNING: Beware of case sensitivity
191
191
  if(toDateTimeType(options["formatType"]) == DATE_TIME){
192
- options["dateTimeFormat"] = this._dateTimeFormat;
193
- options["useUTCTime"] = (this._timeZone == "GMT");
192
+ if(this._dateTimeFormat !== "") {
193
+ options["dateTimeFormat"] = this._dateTimeFormat;
194
+ }
195
+ if(this._timeZone !== "GMT") {
196
+ options["useUTCTime"] = false;
197
+ } // useUTCTime by default, otherwise is use local
194
198
  }
195
199
  return options;
196
200
  };
@@ -242,25 +242,37 @@ NumberFormatter.prototype.getOptions = function(options) { // serialize
242
242
 
243
243
  var formatType = options["formatType"];
244
244
 
245
- options["precisionEnabled"] = this._precisionEnabled;
246
- options["decimalPlaces"] = this._precision;
247
- options["plusSign"] = this._plusSignEnabled;
248
- options["separator"] = this._separatorEnabled;
245
+ if(this._precisionEnabled !== true) {
246
+ options["precisionEnabled"] = this._precisionEnabled; // Default in init
247
+ }
248
+
249
+ if(this._precision !== 2) {
250
+ options["decimalPlaces"] = this._precision;
251
+ }
252
+
253
+ if(this._plusSignEnabled !== false) {
254
+ options["plusSign"] = this._plusSignEnabled;
255
+ }
256
+
257
+ if(this._separatorEnabled !== false) {
258
+ options["separator"] = this._separatorEnabled;
259
+ }
249
260
 
250
261
  if(formatType === "scaled" || formatType === "scaledvalue") {
251
262
  var su = "";
252
263
  if(this._scaler == "b") {
253
264
  su = "billion";
254
- } else if(this._scaler == "m") {
255
- su = "million";
256
- }
257
- options["scalingUnit"] = su;
265
+ options["scalingUnit"] = su;
266
+ } // We didn't return default value (million) for clean up getConfigObject
258
267
  }
259
268
 
260
269
  if(formatType === "percent") {
261
- options["percentSign"] = this._percentSignEnabled;
262
- options["mutiplyBy100"] = this._multiplyBy100Enabled;
263
- options["multiplyBy100"] = this._multiplyBy100Enabled;
270
+ if(this._percentSignEnabled !== true) {
271
+ options["percentSign"] = this._percentSignEnabled;
272
+ }
273
+ if(this._multiplyBy100Enabled !== false) {
274
+ options["multiplyBy100"] = this._multiplyBy100Enabled;
275
+ }
264
276
  }
265
277
  return options;
266
278
  };
@@ -24,6 +24,8 @@ declare function arrayToObject(data?: any[]|null, fields?: (string)[]|null): any
24
24
 
25
25
  declare function extendProperty(obj: any, extender: any, propName: string): void;
26
26
 
27
+ declare function deepEqual(obj1: any, obj2: any): boolean;
28
+
27
29
  declare function extendArrayProperty(obj: any, propName: string, ary: any): any[]|null;
28
30
 
29
31
  declare function parseCondition(expression: string|((...params: any[]) => any)|null): ((...params: any[]) => any)|null;
@@ -52,6 +54,7 @@ export {
52
54
  extendObject,
53
55
  cloneObject,
54
56
  isEmptyObject,
57
+ deepEqual,
55
58
  arrayToObject,
56
59
  extendProperty,
57
60
  extendArrayProperty,
@@ -200,6 +200,58 @@ var extendProperty = function (obj, extender, propName) {
200
200
  }
201
201
  }
202
202
  };
203
+
204
+
205
+ /** 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.
206
+ * @public
207
+ * @param {*} obj1
208
+ * @param {*} obj2
209
+ * @return {boolean}
210
+ */
211
+ var deepEqual = function (obj1, obj2) {
212
+
213
+ if(obj1 === obj2) {
214
+ return true;
215
+ }
216
+
217
+ if (typeof obj1 !== typeof obj2) {
218
+ return false;
219
+ }
220
+
221
+ if (typeof obj1 === "object") {
222
+
223
+ // We need to split array and object for performance reason
224
+ if(Array.isArray(obj1)) {
225
+ if(obj1.length !== obj2.length) {
226
+ return false;
227
+ }
228
+
229
+ for (var i = 0; i < obj1.length; i++) {
230
+ 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.
231
+ return false;
232
+ }
233
+ }
234
+
235
+ } else {
236
+
237
+ if (Object.keys(obj1).length !== Object.keys(obj2).length) {
238
+ return false;
239
+ }
240
+
241
+ for (var key in obj1) {
242
+ if (!deepEqual(obj1[key], obj2[key])) {
243
+ return false;
244
+ }
245
+ }
246
+ }
247
+
248
+
249
+ return true;
250
+ }
251
+
252
+ return false;
253
+
254
+ };
203
255
  /** Array.push() is much faster than Array.concat(). The downside is the parameters must be an array, whereas concat() has no such requirement. <br>
204
256
  * This method excels in extending known array property in an object.
205
257
  * @public
@@ -527,6 +579,7 @@ export {
527
579
  extendObject,
528
580
  cloneObject,
529
581
  isEmptyObject,
582
+ deepEqual,
530
583
  arrayToObject,
531
584
  extendProperty,
532
585
  extendArrayProperty,
@@ -83,7 +83,7 @@ var _fieldInfo = {
83
83
  "words2": {type: "string", min: 3, max: 10},
84
84
  "words3": {type: "string", min: 5, max: 15},
85
85
  "sentence": {type: "string", min: 8, max: 20},
86
- "id": {type: "function", generate: _generateId},
86
+ "id": {type: "function", hash: 0, generate: _generateId},
87
87
  "companyName": {type: "set", members: DataSet.companyName },
88
88
  "industry": {type: "set", members: DataSet.industry },
89
89
  "market": {type: "set", members: DataSet.market },
@@ -103,14 +103,16 @@ var getFieldInfo = function(field) {
103
103
  * @param {Object|Function} options
104
104
  */
105
105
  var addFieldInfo = function(field, options) {
106
- var opt = options;
107
- if(typeof options === "function") {
108
- opt = {
109
- type: "function",
110
- generate: options
111
- };
106
+ if(field) {
107
+ var opt = options;
108
+ if(typeof options === "function") {
109
+ opt = {
110
+ type: "function",
111
+ generate: options
112
+ };
113
+ }
114
+ _fieldInfo[field] = opt; // WARNING: This could replace existing info
112
115
  }
113
- _fieldInfo[field] = opt;
114
116
  };
115
117
 
116
118
  /** Return pseudo random number in the range of 0 to 1 (exclusive of 1)
@@ -452,8 +454,9 @@ var _generate2DArray = function(fields, options, seed) {
452
454
  */
453
455
  var _hash = function(str) {
454
456
  var sum = 0;
455
- for(var i = str.length; --i >= 0;) {
456
- sum += str.charCodeAt(i) * (i + 0.9);
457
+ var i = str ? str.length : 0;
458
+ while(--i >= 0) {
459
+ sum += str.charCodeAt(i) * (i + 0.9879);
457
460
  }
458
461
  return sum;
459
462
  };
@@ -465,35 +468,34 @@ var _hash = function(str) {
465
468
  */
466
469
  var _generateFieldData = function(field, options, seed) {
467
470
  var fInfo = getFieldInfo(field);
471
+ if(!fInfo.type) {
472
+ fInfo.type = "number";
473
+ addFieldInfo(field, fInfo);
474
+ }
475
+ if(fInfo.fixedValue){
476
+ fInfo.value = value;
477
+ return fInfo;
478
+ }
479
+ if(seed != null) {
480
+ if(fInfo.hash == null) {
481
+ fInfo.hash = _hash(field);
482
+ }
483
+ seed += fInfo.hash; // Make each field unique for the same seed
484
+ }
485
+
468
486
  var min = fInfo.min != null ? fInfo.min : 100; // WARNING: Default values are non-standard values
469
487
  var max = fInfo.max != null ? fInfo.max : 10000;
470
- var prec = fInfo.prec != null ? fInfo.prec : 0;
471
488
  var value;
472
489
 
473
- if(fInfo.fixedValue){
474
- value = fInfo.fixedValue;
475
- } else if(!fInfo.type) { // Unknown type
476
- if(seed != null) {
477
- if(field) {
478
- if(!fInfo.hash) {
479
- fInfo.hash = _hash(field);
480
- addFieldInfo(field, fInfo); // WARNING: modify global state
481
- }
482
- seed += fInfo.hash;
483
- }
484
- }
485
- value = randNumber(min, max, prec, seed);
486
- } else if(fInfo.type === "string") {
490
+ if(fInfo.type === "string") {
487
491
  if(fInfo.min != null || fInfo.max != null) {
488
- if(seed != null) {
489
- if(!fInfo.hash) {
490
- fInfo.hash = _hash(field);
491
- }
492
- seed += fInfo.hash;
493
- }
494
492
  value = randString(min, max, seed);
495
493
  } else {
496
- value = options.text || "";
494
+ if(options) {
495
+ value = options.text || "";
496
+ } else {
497
+ value = "";
498
+ }
497
499
  }
498
500
  } else if(fInfo.type === "set") {
499
501
  value = randMember(fInfo.members, seed);
@@ -510,7 +512,8 @@ var _generateFieldData = function(field, options, seed) {
510
512
  } else if(fInfo.type === "function") {
511
513
  fInfo.field = field;
512
514
  value = fInfo.generate(fInfo, seed);
513
- } else { // Default is number
515
+ } else { // Default is number for all unknown type
516
+ var prec = fInfo.prec != null ? fInfo.prec : 0;
514
517
  value = randNumber(min, max, prec, seed);
515
518
  }
516
519
  fInfo.value = value;
@@ -137,6 +137,8 @@ declare class ColumnStackPlugin extends GridPlugin {
137
137
 
138
138
  public isStackHidden(stackId: string): boolean|null|null;
139
139
 
140
+ public moveStack(stackId: string, destCol?: (number|string)|null): boolean;
141
+
140
142
  }
141
143
 
142
144
  export default ColumnStackPlugin;
@@ -13,16 +13,16 @@ declare namespace ConditionalColoringPlugin {
13
13
 
14
14
  type ColumnOptions = {
15
15
  conditions?: (ConditionalColoringPlugin.Condition)[]|null,
16
- colorText?: (string|boolean)|null,
17
- tickColor?: (string|boolean)|null,
18
- blinking?: (ConditionalColoringPlugin.Blinking|boolean)|null,
16
+ colorText?: (string|boolean|ConditionalColoringPlugin.ColorText)|null,
17
+ tickColor?: (string|boolean|ConditionalColoringPlugin.ColorText)|null,
18
+ blinking?: (string|boolean|ConditionalColoringPlugin.Blinking)|null,
19
19
  field?: string|null
20
20
  };
21
21
 
22
22
  type ConditionalColoringOptions = {
23
23
  conditions?: (ConditionalColoringPlugin.Condition)[]|null,
24
- colorText?: (string|boolean)|null,
25
- tickColor?: (string|boolean)|null,
24
+ colorText?: (string|boolean|ConditionalColoringPlugin.ColorText)|null,
25
+ tickColor?: (string|boolean|ConditionalColoringPlugin.ColorText)|null,
26
26
  field?: string|null
27
27
  };
28
28
 
@@ -41,6 +41,13 @@ declare namespace ConditionalColoringPlugin {
41
41
  level?: (string|boolean)|null
42
42
  };
43
43
 
44
+ type ColorText = {
45
+ field?: string|null,
46
+ upClass?: string|null,
47
+ downClass?: string|null,
48
+ levelClass?: string|null
49
+ };
50
+
44
51
  }
45
52
 
46
53
  declare class ConditionalColoringPlugin extends GridPlugin {
@@ -70,6 +70,8 @@ declare class DataTable extends DataCache {
70
70
 
71
71
  public setColumnSortingLogic(cid: string, func: DataTable.SortLogic|null): void;
72
72
 
73
+ public getColumnSortingLogic(cid?: string|null): DataTable.SortLogic|null;
74
+
73
75
  public freeze(bool?: boolean|null): boolean;
74
76
 
75
77
  public unfreeze(bool?: boolean|null): boolean;
@@ -90,7 +92,7 @@ declare class DataTable extends DataCache {
90
92
 
91
93
  public getSegmentParentRowId(rid: string): string;
92
94
 
93
- public getSegmentValues(rids?: (string)[]|null): (number)[]|null;
95
+ public getSegmentValues(rids?: (string)[]|null, partial?: boolean|null): (number)[]|null;
94
96
 
95
97
  public fillSegment(segmentId: string): void;
96
98
 
@@ -80,6 +80,8 @@ declare class DataView extends EventDispatcher {
80
80
 
81
81
  public setColumnSortingLogic(cid: string, func: DataTable.SortLogic|null): void;
82
82
 
83
+ public getColumnSortingLogic(cid?: string|null): DataTable.SortLogic|null;
84
+
83
85
  public isSorting(): boolean;
84
86
 
85
87
  public hideRow(rId: string|number|null, hidden?: boolean|null): void;
@@ -59,6 +59,8 @@ declare class Segment extends EventDispatcher {
59
59
 
60
60
  public getOrder(): number;
61
61
 
62
+ public getLastOrder(): number;
63
+
62
64
  public setOrder(val: number): void;
63
65
 
64
66
  public log(lines: (string)[]|null): (string)[]|null;
@@ -8,7 +8,7 @@ declare class SegmentCollection extends EventDispatcher {
8
8
 
9
9
  public dispose(): void;
10
10
 
11
- public addSegment(rid: string): boolean;
11
+ public addSegment(rid: string, childRids?: (string)[]|null): boolean;
12
12
 
13
13
  public addSegments(rids: (string)[]|null): boolean;
14
14
 
@@ -56,8 +56,6 @@ declare class SegmentCollection extends EventDispatcher {
56
56
 
57
57
  public calcSegmentOrder(rids: (string)[]|null): void;
58
58
 
59
- public getSegmentValues(rids: (string)[]): (number)[]|null;
60
-
61
59
  public logStructure(): string;
62
60
 
63
61
  public logRowIdMap(): string;
@@ -339,8 +339,12 @@ declare class Core extends ElementWrapper {
339
339
 
340
340
  public enableRowVirtualization(opt_enabled: boolean): void;
341
341
 
342
+ public isRowVirtualizationEnabled(): boolean;
343
+
342
344
  public enableColumnVirtualization(opt_enabled?: boolean|null): void;
343
345
 
346
+ public isColumnVirtualizationEnabled(): boolean;
347
+
344
348
  public setRowScrollingStep(rowCount: number): void;
345
349
 
346
350
  public getVMouseWheelHandler(): ((...params: any[]) => any)|null;
@@ -4,6 +4,7 @@ import Core from "../Core.js";
4
4
  import ILayoutGrid from "../ILayoutGrid.js";
5
5
  import ElementWrapper from "../components/ElementWrapper.js";
6
6
  import DataTable from "../../data/DataTable.js";
7
+ import { isEmptyObject } from "../../../../../tr-grid-util/es6/Util.js";
7
8
 
8
9
  declare namespace SortableTitlePlugin {
9
10
 
@@ -7,12 +7,12 @@ declare namespace HeatMapPlugin {
7
7
 
8
8
  type ColumnOptions = {
9
9
  field: string,
10
- heatMap?: HeatMapPlugin.Heatmap
10
+ heatMap?: HeatMapPlugin.Heatmap|null
11
11
  };
12
12
 
13
13
  type Heatmap = {
14
- midPoint?: number,
15
- mode?: string
14
+ midPoint?: number|null,
15
+ mode?: string|null
16
16
  };
17
17
 
18
18
  }