@refinitiv-ui/efx-grid 6.0.13 → 6.0.14

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 (39) hide show
  1. package/lib/core/dist/core.js +1209 -160
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/data/DataCache.js +1 -1
  4. package/lib/core/es6/data/DataTable.d.ts +18 -3
  5. package/lib/core/es6/data/DataTable.js +203 -17
  6. package/lib/core/es6/data/DataView.d.ts +8 -1
  7. package/lib/core/es6/data/DataView.js +30 -2
  8. package/lib/core/es6/data/Segment.d.ts +36 -11
  9. package/lib/core/es6/data/Segment.js +575 -59
  10. package/lib/core/es6/data/SegmentCollection.d.ts +15 -1
  11. package/lib/core/es6/data/SegmentCollection.js +236 -80
  12. package/lib/core/es6/grid/Core.js +1 -1
  13. package/lib/grid/index.js +1 -1
  14. package/lib/row-segmenting/es6/RowSegmenting.d.ts +2 -0
  15. package/lib/row-segmenting/es6/RowSegmenting.js +26 -3
  16. package/lib/rt-grid/dist/rt-grid.js +1115 -158
  17. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  18. package/lib/rt-grid/es6/Grid.d.ts +2 -0
  19. package/lib/rt-grid/es6/Grid.js +53 -0
  20. package/lib/rt-grid/es6/RowDefinition.js +22 -2
  21. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
  22. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +194 -366
  23. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +10 -3
  24. package/lib/tr-grid-column-stack/es6/ColumnStack.js +93 -36
  25. package/lib/tr-grid-util/es6/RowPainter.d.ts +2 -1
  26. package/lib/tr-grid-util/es6/RowPainter.js +7 -1
  27. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -0
  28. package/lib/tr-grid-util/es6/jet/mockDataAPI.js +191 -52
  29. package/lib/types/es6/ColumnGrouping.d.ts +1 -0
  30. package/lib/types/es6/ColumnStack.d.ts +10 -3
  31. package/lib/types/es6/Core/data/DataTable.d.ts +18 -3
  32. package/lib/types/es6/Core/data/DataView.d.ts +8 -1
  33. package/lib/types/es6/Core/data/Segment.d.ts +36 -11
  34. package/lib/types/es6/Core/data/SegmentCollection.d.ts +15 -1
  35. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +6 -1
  36. package/lib/types/es6/RealtimeGrid/Grid.d.ts +2 -0
  37. package/lib/types/es6/RowSegmenting.d.ts +2 -0
  38. package/lib/versions.json +4 -4
  39. package/package.json +1 -1
@@ -271,6 +271,8 @@ declare class Grid extends EventDispatcher {
271
271
 
272
272
  public toggleChain(rowRef: Grid.RowReference|null): void;
273
273
 
274
+ public setClassification(rowRef: Grid.RowReference|null, fields: (string)[]|null): boolean;
275
+
274
276
  public focus(): void;
275
277
 
276
278
  public requestRowRefresh(): void;
@@ -230,6 +230,7 @@ var Grid = function(placeholder, config) {
230
230
 
231
231
  t._onDataChanged = t._onDataChanged.bind(t);
232
232
  t._onDataComposed = t._onDataComposed.bind(t);
233
+ t._onSubSegmentChanged = t._onSubSegmentChanged.bind(t);
233
234
  t._recalculateFormulas = t._recalculateFormulas.bind(t);
234
235
  t._updateStreamingData = t._updateStreamingData.bind(t);
235
236
  t.updateColumnTitle = t.updateColumnTitle.bind(t);
@@ -293,6 +294,8 @@ var Grid = function(placeholder, config) {
293
294
 
294
295
  t._dt = new DataTable();
295
296
  t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
297
+ t._dt.setClassificationSource(t._dc);
298
+ t._dt.listen("subSegmentChanged", t._onSubSegmentChanged);
296
299
  t._dv = new DataView(t._dt);
297
300
  t._dv.listen("pageIndexChanged", t._dispatch.bind(t, "pageIndexChanged"));
298
301
  t._dv.listen("pageCountChanged", t._dispatch.bind(t, "pageCountChanged")); // TODO: When implementing filtered row, it may need to implement the conflator
@@ -2857,6 +2860,7 @@ Grid.prototype._updateStreamingData = function() {
2857
2860
  }
2858
2861
 
2859
2862
  if(this._dt) {
2863
+ this._dt.classifySegments();
2860
2864
  this._dt.dispatchGlobalChange();
2861
2865
  }
2862
2866
  };
@@ -2978,6 +2982,20 @@ Grid.prototype.toggleChain = function(rowRef) {
2978
2982
  rowDef.toggleChain();
2979
2983
  }
2980
2984
  };
2985
+ /**
2986
+ * @public
2987
+ * @param {Grid~RowReference} rowRef
2988
+ * @param {Array.<string>} fields
2989
+ * @return {boolean}
2990
+ */
2991
+ Grid.prototype.setClassification = function(rowRef, fields) {
2992
+ var rowDef = this._getRowDefinition(rowRef);
2993
+ if(rowDef) {
2994
+ return this._dt.setSegmentClassification(rowDef.getRowId(), fields);
2995
+ }
2996
+ return false;
2997
+ };
2998
+
2981
2999
  /** @description Focus grid element without moving window scrollbar
2982
3000
  * @public
2983
3001
  */
@@ -3082,6 +3100,41 @@ Grid.prototype._onDataComposed = function(e) {
3082
3100
 
3083
3101
  this._recalculateFormulas(e);
3084
3102
  };
3103
+ /** @private
3104
+ * @param {Object} e
3105
+ */
3106
+ Grid.prototype._onSubSegmentChanged = function(e) {
3107
+ var insertionList = /** @type{Array.<Segment>} */(e["insertionList"]);
3108
+ var removalList = /** @type{Array.<string>} */(e["removalList"]);
3109
+ var removedRows = /** @type{Object} */(e["removedRows"]);
3110
+
3111
+ var i;
3112
+ var removalCount = removalList.length;
3113
+ var rowDef = null;
3114
+ for(i = 0; i < removalCount; i++) {
3115
+ var rid = removalList[i];
3116
+ var removedRow = removedRows[rid];
3117
+ if(removedRow) {
3118
+ rowDef = removedRow[ROW_DEF];
3119
+ if(rowDef) {
3120
+ rowDef.dispose();
3121
+ removedRow[ROW_DEF] = null;
3122
+ }
3123
+ }
3124
+ }
3125
+
3126
+ var insertionCount = insertionList.length;
3127
+ for(i = 0; i < insertionCount; i++) {
3128
+ var segment = insertionList[i];
3129
+ // var parentId = segment.getParentId();
3130
+ var segmentId = segment.getId();
3131
+ rowDef = new RowDefinition({
3132
+ "segmentId": segmentId
3133
+ });
3134
+ rowDef.setDataSource(this._dc);
3135
+ rowDef.registerToView(this._dv);
3136
+ }
3137
+ };
3085
3138
 
3086
3139
  /** @private
3087
3140
  * @param {Object=} e
@@ -27,6 +27,13 @@ var ROW_DEF = "ROW_DEF";
27
27
  */
28
28
  var RowDefinition = function(rowOptions) {
29
29
  this._changes = {};
30
+ if(rowOptions && rowOptions["segmentId"]) {
31
+ this._dataId = this._rowId = rowOptions["segmentId"];
32
+ this._autoGenerated = true;
33
+ this._subSegment = true;
34
+ return;
35
+ }
36
+
30
37
  this._rowId = "_" + RowDefinition._runningId++ + "_";
31
38
  this._dataId = this._rowId;
32
39
 
@@ -95,6 +102,10 @@ RowDefinition.prototype._expanded = false;
95
102
  * @private
96
103
  */
97
104
  RowDefinition.prototype._autoGenerated = false;
105
+ /** @type {boolean}
106
+ * @private
107
+ */
108
+ RowDefinition.prototype._subSegment = false;
98
109
  /** @type {Object.<string, *>}
99
110
  * @private
100
111
  */
@@ -658,7 +669,16 @@ RowDefinition.prototype.registerToView = function(view, rowId) {
658
669
  }
659
670
  this._view = view;
660
671
 
661
- var rowData = {};
672
+ var rowData = null;
673
+ if(this._subSegment) {
674
+ rowData = this._view.getRowData(this.getRowId());
675
+ if(rowData) {
676
+ rowData[ROW_DEF] = this; // no event trigger
677
+ }
678
+ return;
679
+ }
680
+
681
+ rowData = {};
662
682
  rowData[ROW_DEF] = this;
663
683
 
664
684
  var newRowId = this._view.insertRow(rowId, rowData, this.getRowId());
@@ -739,7 +759,7 @@ RowDefinition.prototype.addConstituent = function(ric) {
739
759
  var rowId = this.getRowId();
740
760
  var rowIndex = this._view.getRowIndex(rowId) + this.getChildCount(); // Children must be directly under its parent
741
761
  childDef.registerToView(this._view, this._view.getRowId(rowIndex));
742
- this._view.addSegmentChild(rowId, childDef.getRowId());
762
+ this._view.addSegmentChild(rowId, childDef.getRowId(), childDef.getDataId());
743
763
  }
744
764
 
745
765
  return newChild ? childDef : null;
@@ -1,4 +1,5 @@
1
1
  import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
+ import { cloneObject } from "../../tr-grid-util/es6/Util.js";
2
3
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
3
4
  import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
4
5