@refinitiv-ui/efx-grid 6.0.34 → 6.0.36

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 (47) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.js +50 -40
  2. package/lib/core/dist/core.css +1 -1
  3. package/lib/core/dist/core.js +248 -8
  4. package/lib/core/dist/core.min.js +1 -1
  5. package/lib/core/es6/data/DataCache.js +20 -1
  6. package/lib/core/es6/data/DataTable.d.ts +2 -0
  7. package/lib/core/es6/data/DataTable.js +18 -1
  8. package/lib/core/es6/data/DataView.d.ts +2 -0
  9. package/lib/core/es6/data/DataView.js +11 -0
  10. package/lib/core/es6/grid/Core.d.ts +12 -0
  11. package/lib/core/es6/grid/Core.js +88 -3
  12. package/lib/core/es6/grid/ILayoutGrid.js +4 -0
  13. package/lib/core/es6/grid/LayoutGrid.d.ts +4 -0
  14. package/lib/core/es6/grid/LayoutGrid.js +95 -3
  15. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +6 -0
  16. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +6 -0
  17. package/lib/core/es6/tr-grid-theme.js +1 -1
  18. package/lib/grid/index.js +1 -1
  19. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  20. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  21. package/lib/grid/themes/halo/efx-grid.less +1 -1
  22. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  23. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  24. package/lib/rt-grid/dist/rt-grid.js +367 -148
  25. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  26. package/lib/rt-grid/es6/Grid.js +37 -31
  27. package/lib/rt-grid/es6/RowDefSorter.d.ts +5 -5
  28. package/lib/rt-grid/es6/RowDefSorter.js +165 -71
  29. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +66 -0
  30. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +3 -0
  31. package/lib/tr-grid-column-stack/es6/ColumnStack.js +566 -607
  32. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +1 -1
  33. package/lib/tr-grid-range-bar/es6/RangeBar.d.ts +4 -1
  34. package/lib/tr-grid-range-bar/es6/RangeBar.js +99 -39
  35. package/lib/tr-grid-row-dragging/es6/RowDragging.js +14 -3
  36. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +3 -2
  37. package/lib/tr-grid-util/es6/DragUI.js +7 -3
  38. package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +7 -1
  39. package/lib/tr-grid-util/es6/GroupDefinitions.js +39 -3
  40. package/lib/tr-grid-util/es6/jet/DataGenerator.js +36 -33
  41. package/lib/types/es6/ColumnStack.d.ts +2 -0
  42. package/lib/types/es6/Core/data/DataTable.d.ts +3 -1
  43. package/lib/types/es6/Core/data/DataView.d.ts +2 -0
  44. package/lib/types/es6/Core/grid/Core.d.ts +12 -0
  45. package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +5 -5
  46. package/lib/versions.json +8 -8
  47. package/package.json +1 -1
@@ -920,7 +920,7 @@ ConditionalColoringPlugin._mergeUpdates = function(e) {
920
920
  * @return {string} prettified CSS string
921
921
  */
922
922
  ConditionalColoringPlugin.prototype._prepareStyles = function(colors) {
923
- var prefix = ".tr-grid." + ConditionalColoringPlugin._controlClass + " .cell";
923
+ var prefix = ".tr-grid." + ConditionalColoringPlugin._controlClass + " .column.conditionally-colored .cell";
924
924
  var css = [];
925
925
  var ss, styles, value;
926
926
  for (var className in colors) {
@@ -15,7 +15,10 @@ declare namespace RangeBarPlugin {
15
15
  end?: number|null,
16
16
  low?: string|null,
17
17
  high?: string|null,
18
- last?: string|null
18
+ last?: string|null,
19
+ vwap?: string|null,
20
+ close?: string|null,
21
+ tick?: string|null
19
22
  };
20
23
 
21
24
  type Options = {
@@ -17,6 +17,9 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
17
17
  * @property {string=} low="" Field used as minimum range
18
18
  * @property {string=} high="" Field used as maximum range
19
19
  * @property {string=} last="" Field used as current absolute value (white bar)
20
+ * @property {string=} vwap="" Field used as volume weighted average price (VWAP)
21
+ * @property {string=} close="" Field used as close price
22
+ * @property {string=} tick="" Field used as tick color
20
23
  */
21
24
 
22
25
  /** @typedef {Object} RangeBarPlugin~Options
@@ -26,15 +29,15 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
26
29
  // TODO: promote "valueLabel" option, that provide the user can show valueLabel in ef-led-gauge (default is false)
27
30
  // @property {boolean=} valueLabel=false If disabled, it will be show text label in top of ef-led-gaguge
28
31
 
29
- /** Used for tranfrom value from raw value to normalize value
32
+ /** Used for tranfrom value from raw value to normalize value (Percent value between -100 to 100)
30
33
  * @private
31
34
  * @param {number} low
32
- * @param {number} last
35
+ * @param {number} current
33
36
  * @param {number} high
34
37
  * @return {number}
35
38
  */
36
- var _normalizeValue = function _normalizeValue(low, last, high) {
37
- return (low - last) * 200 / (low - high) - 100;
39
+ var _normalizeValue = function _normalizeValue(low, current, high) {
40
+ return (low - current) * 200 / (low - high) - 100;
38
41
  };
39
42
 
40
43
  /** Used for convert the rangeBarOption and rowData into an object that has the properties of low, last, and high.
@@ -43,26 +46,37 @@ var _normalizeValue = function _normalizeValue(low, last, high) {
43
46
  * @param {Object} rowData
44
47
  * @return {Object}
45
48
  */
46
- var _getLowLastHighValue = function _getLowLastHighValue(rBarOpt, rowData) {
47
- var low, high, last;
49
+ var _getRangeBarData = function _getRangeBarData(rBarOpt, rowData) {
50
+ var low, high, last, close, vwap, tick;
48
51
  if (rBarOpt.field) {
49
- // Doesn't defined low,last,high
52
+ // Doesn't defined range bar data, use field instead
50
53
  low = rBarOpt.start;
51
54
  last = rowData[rBarOpt.field];
52
55
  high = rBarOpt.end;
53
56
  } else {
54
- // Defined low,last,high case
57
+ // Defined range bar data
55
58
  low = rowData[rBarOpt.low];
56
59
  last = rowData[rBarOpt.last];
57
60
  high = rowData[rBarOpt.high];
61
+ close = rowData[rBarOpt.close];
62
+ vwap = rowData[rBarOpt.vwap];
63
+ tick = rowData[rBarOpt.tick];
58
64
  }
59
65
  return {
60
66
  low: low,
61
67
  last: last,
62
- high: high
68
+ high: high,
69
+ close: close,
70
+ vwap: vwap,
71
+ tick: tick
63
72
  };
64
73
  };
65
74
 
75
+ /** @type {Array<string>}
76
+ * @constant
77
+ */
78
+ var TICK_COLOR_MAPPING = ["var(--color-scheme-neutral)", "var(--color-scheme-tickup)", "var(--color-scheme-tickdown)"]; // ["level", "up", "down"]
79
+
66
80
  /** @constructor
67
81
  * @extends {GridPlugin}
68
82
  */
@@ -253,6 +267,15 @@ RangeBarPlugin.prototype.getColumnConfigObject = function (colIndex, out_obj) {
253
267
  if (opt.high != null) {
254
268
  rangeBar.high = opt.high;
255
269
  }
270
+ if (opt.close != null) {
271
+ rangeBar.close = opt.close;
272
+ }
273
+ if (opt.vwap != null) {
274
+ rangeBar.vwap = opt.vwap;
275
+ }
276
+ if (opt.tick != null) {
277
+ rangeBar.tick = opt.tick;
278
+ }
256
279
  return out_obj;
257
280
  };
258
281
 
@@ -285,7 +308,7 @@ RangeBarPlugin.prototype.getValue = function (colRef, rowRef) {
285
308
  if (!rowData) {
286
309
  return null;
287
310
  }
288
- return _getLowLastHighValue(rBarOpt, rowData);
311
+ return _getRangeBarData(rBarOpt, rowData);
289
312
  };
290
313
 
291
314
  /** @public
@@ -310,16 +333,16 @@ RangeBarPlugin.prototype.getTooltipText = function (colRef, rowRef) {
310
333
  if (typeof rowRef === "string") {
311
334
  rowRef = dv.getRowIndex(rowRef);
312
335
  }
313
- if (rowRef == "" || rowRef < 0) {
336
+ if (rowRef < 0) {
314
337
  return "";
315
338
  }
316
339
  var rowData = this._getRow(dv, rowRef);
317
340
  if (!rowData) {
318
341
  return "";
319
342
  }
320
- var lowLastHigh = _getLowLastHighValue(rBarOpt, rowData);
343
+ var rangeBarValues = _getRangeBarData(rBarOpt, rowData);
321
344
  if (this._tooltip) {
322
- var textTooltip = this._calculateTooltip(rBarOpt, lowLastHigh);
345
+ var textTooltip = this._calculateTooltip(rBarOpt, rangeBarValues);
323
346
  return textTooltip;
324
347
  }
325
348
  return "";
@@ -327,13 +350,16 @@ RangeBarPlugin.prototype.getTooltipText = function (colRef, rowRef) {
327
350
 
328
351
  /** @private
329
352
  * @param {RangeBarPlugin~RangeDefinition} rBarOpt range
330
- * @param {!Object} lowLastHigh
353
+ * @param {!Object} rangeBarValues
331
354
  * @return {string} tooltip string value
332
355
  */
333
- RangeBarPlugin.prototype._calculateTooltip = function (rBarOpt, lowLastHigh) {
334
- var low = lowLastHigh.low;
335
- var last = lowLastHigh.last;
336
- var high = lowLastHigh.high;
356
+ RangeBarPlugin.prototype._calculateTooltip = function (rBarOpt, rangeBarValues) {
357
+ var low = rangeBarValues.low;
358
+ var last = rangeBarValues.last;
359
+ var high = rangeBarValues.high;
360
+ var vwap = rangeBarValues.vwap;
361
+ var close = rangeBarValues.close;
362
+ var priceGraph = rBarOpt.priceGraph;
337
363
  var textTooltip;
338
364
  if (rBarOpt["field"]) {
339
365
  // doesn't provide low,last,high case
@@ -343,7 +369,13 @@ RangeBarPlugin.prototype._calculateTooltip = function (rBarOpt, lowLastHigh) {
343
369
  var lowValue = low != null ? low : '--';
344
370
  var lastValue = last != null ? last : '--';
345
371
  var highValue = high != null ? high : '--';
346
- textTooltip = 'Low: ' + lowValue + " " + 'Last: ' + lastValue + " " + 'High: ' + highValue;
372
+ if (priceGraph) {
373
+ var vwapValue = vwap != null ? vwap : '--';
374
+ var closeValue = close != null ? close : '--';
375
+ textTooltip = 'Low: ' + lowValue + " " + 'Last: ' + lastValue + " " + 'High: ' + highValue + " " + 'VWAP: ' + vwapValue + " " + 'Close: ' + closeValue + " ";
376
+ } else {
377
+ textTooltip = 'Low: ' + lowValue + " " + 'Last: ' + lastValue + " " + 'High: ' + highValue;
378
+ }
347
379
  }
348
380
  return textTooltip;
349
381
  };
@@ -375,6 +407,10 @@ RangeBarPlugin.prototype._calculateTooltip = function (rBarOpt, lowLastHigh) {
375
407
  RangeBarPlugin.prototype._setColumnRangeBar = function (colIndex, columnOptions) {
376
408
  var rDef = columnOptions["rangeBar"];
377
409
  if (rDef) {
410
+ if (rDef["vwap"] || rDef["close"] || rDef["tick"]) {
411
+ rDef["priceGraph"] = true; // activate price graph mode
412
+ }
413
+
378
414
  var colData = this._newColumnData(colIndex);
379
415
  if (rDef === true || typeof rDef["field"] === "string") {
380
416
  // The start and end properties were overwritten by the extension, so the value will be returned from the get configuration even if the user does not set it (minor issue).
@@ -423,16 +459,17 @@ RangeBarPlugin.prototype._onPostSectionBinding = function (e) {
423
459
  if (!rBarOpt) {
424
460
  continue;
425
461
  }
462
+ var priceGraph = rBarOpt["priceGraph"];
426
463
  for (var r = fromR; r < toR; ++r) {
427
464
  var cell = section.getCell(c, r, false);
428
465
  if (!cell) {
429
466
  continue;
430
467
  }
431
468
  var rowData = this._getRowData(dataRows[r]);
432
- var lowLastHigh = _getLowLastHighValue(rBarOpt, rowData);
433
- var low = lowLastHigh.low;
434
- var last = lowLastHigh.last;
435
- var high = lowLastHigh.high;
469
+ var rangeBarData = _getRangeBarData(rBarOpt, rowData);
470
+ var low = rangeBarData.low;
471
+ var last = rangeBarData.last;
472
+ var high = rangeBarData.high;
436
473
  var content = cell.getContent();
437
474
  var rangeBar = content ? content._rangeBar : null;
438
475
  if (!rangeBar) {
@@ -442,7 +479,7 @@ RangeBarPlugin.prototype._onPostSectionBinding = function (e) {
442
479
  content = rangeBar;
443
480
  }
444
481
  if (this._tooltip) {
445
- var textTooltip = this._calculateTooltip(rBarOpt, lowLastHigh);
482
+ var textTooltip = this._calculateTooltip(rBarOpt, rangeBarData);
446
483
  cell.setTooltip(textTooltip); // WARNING: this may be confuse with auto-tooltip extension
447
484
  }
448
485
 
@@ -464,22 +501,45 @@ RangeBarPlugin.prototype._onPostSectionBinding = function (e) {
464
501
 
465
502
  // Clear the current range for apply a new one.
466
503
  rangeBar.range.length = 0;
504
+ if (priceGraph) {
505
+ var close = rangeBarData.close;
506
+ var vwap = rangeBarData.vwap;
507
+ var vwapNormalize = _normalizeValue(low, vwap, high);
508
+ var rangeColor;
509
+ if (close > last) {
510
+ rangeColor = "var(--color-scheme-tickdown)";
511
+ } else {
512
+ rangeColor = "var(--color-scheme-tickup)";
513
+ }
514
+ var leftSegmentValue = _normalizeValue(low, close, high);
515
+ var rangeValue;
516
+ if (lastNormalize < leftSegmentValue) {
517
+ rangeValue = [lastNormalize, leftSegmentValue];
518
+ } else {
519
+ rangeValue = [leftSegmentValue, lastNormalize];
520
+ }
521
+ rangeBar.range = rangeValue;
522
+ rangeBar.topValue = lastNormalize;
523
+ rangeBar.bottomValue = vwapNormalize;
524
+ rangeBar.style.setProperty("--range-color", rangeColor);
525
+ rangeBar.style.setProperty("--bottom-selected-color", "var(--neutral-color)");
526
+ rangeBar.style.setProperty("--top-selected-color", TICK_COLOR_MAPPING[rangeBarData.tick]);
527
+ rangeBar.style.setProperty("--clash-color", "var(--color-scheme-secondary)");
528
+ } else {
529
+ // applied range when the last value out of range, by set new low/high with last value
530
+ if (last < low) {
531
+ var lowNormalize = _normalizeValue(last, low, high);
532
+ rangeBar.range = [lastNormalize, lowNormalize];
533
+ } else if (last > high) {
534
+ var highNormalize = _normalizeValue(low, high, last);
535
+ rangeBar.range = [highNormalize, lastNormalize];
536
+ }
537
+ // else {} // It is not necessary to apply a range in the case of equal low and high values
467
538
 
468
- // applied range when the last value out of range, by set new low/high with last value
469
- if (last < low) {
470
- lastNormalize = _normalizeValue(last, last, high);
471
- var lowNormalize = _normalizeValue(last, low, high);
472
- rangeBar.range = [lastNormalize, lowNormalize];
473
- } else if (last > high) {
474
- lastNormalize = _normalizeValue(low, last, last);
475
- var highNormalize = _normalizeValue(low, high, last);
476
- rangeBar.range = [highNormalize, lastNormalize];
477
- }
478
- // else {} // It is not necessary to apply a range in the case of equal low or high values
479
-
480
- rangeBar.topValue = lastNormalize;
481
- if (this.valueLabel) {
482
- rangeBar.topLabel = last;
539
+ rangeBar.topValue = lastNormalize;
540
+ if (this.valueLabel) {
541
+ rangeBar.topLabel = last;
542
+ }
483
543
  }
484
544
  cell.setContent(content);
485
545
  }
@@ -906,9 +906,12 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
906
906
  var srcRowTypes = [];
907
907
  var conRowType = "";
908
908
  var api = this.getGridApi();
909
+ if(api && !api.getRowType) {
910
+ api = null;
911
+ }
909
912
  for(i = 0; i < srcCount; ++i) {
910
913
  var srcIndex = srcRowIndices[i];
911
- var rowType = api.getRowType(srcIndex);
914
+ var rowType = api ? api.getRowType(srcIndex) : "CONTENT";
912
915
  srcRowIds[i] = srcDv.getRowId(srcIndex);
913
916
  srcRowTypes[i] = rowType;
914
917
  if(conRowType) {
@@ -919,7 +922,10 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
919
922
  conRowType = rowType;
920
923
  }
921
924
  }
922
- var destRowType = api.getRowType(destRowIndex); // TODO: this has to be get from destGrid
925
+ if(!conRowType) {
926
+ conRowType = "CONTENT";
927
+ }
928
+ var destRowType = api ? api.getRowType(destRowIndex) : ""; // TODO: this has to be get from destGrid
923
929
  var destRowId = destDv.getRowId(destRowIndex);
924
930
  var parentRowId, childRowIds;
925
931
 
@@ -966,7 +972,8 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
966
972
  }
967
973
  } else if(conRowType === "GROUP_MEMBER") {
968
974
  if(srcCount === 1) {
969
- parentRowId = rsp.getSegmentParentRowId(srcRowIds[0]);
975
+ var srcRowId = srcRowIds[0];
976
+ parentRowId = rsp.getSegmentParentRowId(srcRowId);
970
977
  childRowIds = rsp.getSegmentChildIds(parentRowId);
971
978
  var childCount = childRowIds ? childRowIds.length : 0;
972
979
  var endOfSegment = srcDv.getRowIndex(parentRowId) + childCount + 1;
@@ -976,6 +983,10 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
976
983
  var destParentRowId = rsp.getSegmentParentRowId(destRowId);
977
984
  if(parentRowId === destParentRowId) {
978
985
  movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
986
+ } else { // Moving row between two segments
987
+ rsp.removeSegmentChild(parentRowId, srcRowId);
988
+ rsp.addSegmentChild(destParentRowId, srcRowId);
989
+ movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
979
990
  }
980
991
  } else if(_isNormalRowType(destRowType)) { // move member out of existing segment
981
992
  rsp.removeSegmentChild(parentRowId, srcRowIds[0]);
@@ -320,11 +320,12 @@ RowColoringPlugin.prototype.setPredefinedColors = function (predefinedColors) {
320
320
  * @param {Object} predefinedColors Predefined color object map
321
321
  */
322
322
  RowColoringPlugin.prototype._injectStyles = function (predefinedColors) {
323
- var prefix = ".tr-grid." + RowColoringPlugin._controlClass + " .tr-lg .cell";
323
+ var prefix1 = ".tr-grid." + RowColoringPlugin._controlClass + " .section .column .cell";
324
+ var prefix2 = ".tr-grid." + RowColoringPlugin._controlClass + " .section .cover-layer .cell";
324
325
  var css = [];
325
326
  var ss, styles, value;
326
327
  for (var className in predefinedColors) {
327
- css.push(prefix + "." + className);
328
+ css.push(prefix1 + "." + className + ", " + prefix2 + "." + className);
328
329
  ss = [];
329
330
  styles = predefinedColors[className];
330
331
  value = styles["backgroundColor"];
@@ -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
  }
@@ -18,6 +18,8 @@ declare class GroupDefinitions {
18
18
 
19
19
  public getGroups(): (any)[];
20
20
 
21
+ public getGroupIds(): (string)[];
22
+
21
23
  public getGroupMap(): { [key: string]: any };
22
24
 
23
25
  public cloneGroupMap(): { [key: string]: any };
@@ -36,6 +38,8 @@ declare class GroupDefinitions {
36
38
 
37
39
  public getParentId(childId: string, groupLevel?: number|null): string;
38
40
 
41
+ public removeAllGroups(): boolean;
42
+
39
43
  public setGroups(groupDefs?: (any)[]|null): void;
40
44
 
41
45
  public addGroup(groupDef: any): string;
@@ -46,7 +50,7 @@ declare class GroupDefinitions {
46
50
 
47
51
  public hasGroupChild(parentId: string, childId: string): boolean;
48
52
 
49
- public addGroupChild(parentId: string, childId: string): boolean;
53
+ public addGroupChild(parentId: string, childId: string, position?: number|null): boolean;
50
54
 
51
55
  public removeGroupChild(parentId: string, childId?: string|null): boolean;
52
56
 
@@ -56,6 +60,8 @@ declare class GroupDefinitions {
56
60
 
57
61
  public setGroupChildren(groupId: string, newChildList: (string)[]|null): boolean;
58
62
 
63
+ public getGroupName(groupId: string): string;
64
+
59
65
  public setGroupName(groupId: string, groupName: string): boolean;
60
66
 
61
67
  }
@@ -187,6 +187,13 @@ GroupDefinitions.prototype.getGroups = function () {
187
187
  }
188
188
  return groupDefs;
189
189
  };
190
+ /** Get array of all existing group ids
191
+ * @public
192
+ * @return {!Array.<string>}
193
+ */
194
+ GroupDefinitions.prototype.getGroupIds = function () {
195
+ return Object.keys(this._groupMap);
196
+ };
190
197
  /** @public
191
198
  * @return {!Object.<string, Object>}
192
199
  */
@@ -293,7 +300,18 @@ GroupDefinitions.prototype.getParentId = function (childId, groupLevel) {
293
300
  return parentId || "";
294
301
  };
295
302
 
296
-
303
+ /** Remove all existing group definitions
304
+ * @public
305
+ * @return {boolean}
306
+ */
307
+ GroupDefinitions.prototype.removeAllGroups = function () {
308
+ for(var groupId in this._groupMap) { // eslint-disable-line
309
+ this._groupMap = {};
310
+ this._childToParent = {};
311
+ return true;
312
+ }
313
+ return false;
314
+ };
297
315
  /** Remove all existing group definitions and replace them with the given definitions.
298
316
  * @public
299
317
  * @param {Array.<Object>=} groupDefs Use null or empty array to remove all existing groups
@@ -438,9 +456,10 @@ GroupDefinitions.prototype.hasGroupChild = function (parentId, childId) {
438
456
  /** @public
439
457
  * @param {string} parentId Group id
440
458
  * @param {string} childId
459
+ * @param {number=} position
441
460
  * @return {boolean}
442
461
  */
443
- GroupDefinitions.prototype.addGroupChild = function (parentId, childId) {
462
+ GroupDefinitions.prototype.addGroupChild = function (parentId, childId, position) {
444
463
  var groupDef = this._groupMap[parentId];
445
464
 
446
465
  if(childId && groupDef) {
@@ -453,7 +472,11 @@ GroupDefinitions.prototype.addGroupChild = function (parentId, childId) {
453
472
  if(childDef) {
454
473
  childDef.parentId = parentId;
455
474
  }
456
- chdr.push(childId);
475
+ if(position != null && position >= 0) {
476
+ chdr.splice(position, 0, childId);
477
+ } else {
478
+ chdr.push(childId);
479
+ }
457
480
  return true;
458
481
  }
459
482
  }
@@ -562,6 +585,18 @@ GroupDefinitions.prototype.setGroupChildren = function (groupId, newChildList) {
562
585
  }
563
586
  return false;
564
587
  };
588
+
589
+ /** @public
590
+ * @param {string} groupId
591
+ * @return {string}
592
+ */
593
+ GroupDefinitions.prototype.getGroupName = function (groupId) {
594
+ var groupDef = this._groupMap[groupId];
595
+ if(groupDef) {
596
+ return groupDef.name || "";
597
+ }
598
+ return "";
599
+ };
565
600
  /** @public
566
601
  * @param {string} groupId
567
602
  * @param {string} groupName
@@ -578,5 +613,6 @@ GroupDefinitions.prototype.setGroupName = function (groupId, groupName) {
578
613
 
579
614
  return false;
580
615
  };
616
+
581
617
  export default GroupDefinitions;
582
618
  export { GroupDefinitions };
@@ -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;
@@ -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;
@@ -1,5 +1,6 @@
1
1
  import Ext from "../../../../tr-grid-util/es6/Ext.js";
2
2
  import GroupDefinitions from "../../../../tr-grid-util/es6/GroupDefinitions.js"; // eslint-disable-line
3
+ import { isEmptyObject } from "../../../../tr-grid-util/es6/Util.js";
3
4
  import ElementWrapper from "./components/ElementWrapper.js";
4
5
  import ILayoutGrid from "./ILayoutGrid.js"; // eslint-disable-line
5
6
  import LayoutGrid from "./LayoutGrid.js";
@@ -32,6 +33,13 @@ declare namespace Core {
32
33
  dataSource: DataView|null
33
34
  };
34
35
 
36
+ type BatchInfo = {
37
+ reset?: string|null,
38
+ insertion?: string|null,
39
+ removal?: string|null,
40
+ moving?: string|null
41
+ };
42
+
35
43
  type CellReference = Core.MouseInfo|ElementWrapper|Element|null;
36
44
 
37
45
  type ColumnOptions = {
@@ -395,6 +403,10 @@ declare class Core extends ElementWrapper {
395
403
 
396
404
  public getColumnGroupChildIds(groupId: string): (string)[]|null;
397
405
 
406
+ public startBatch(batchType: string): boolean;
407
+
408
+ public stopBatch(batchType: string): boolean;
409
+
398
410
  public getColumnId(colIndex: number): string;
399
411
 
400
412
  public getColumnIds(): (string)[];