@refinitiv-ui/efx-grid 6.0.12 → 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 (42) 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/grid/lib/efx-grid.js +1 -1
  15. package/lib/row-segmenting/es6/RowSegmenting.d.ts +2 -0
  16. package/lib/row-segmenting/es6/RowSegmenting.js +26 -3
  17. package/lib/rt-grid/dist/rt-grid.js +1144 -158
  18. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  19. package/lib/rt-grid/es6/ColumnDefinition.d.ts +6 -1
  20. package/lib/rt-grid/es6/ColumnDefinition.js +29 -0
  21. package/lib/rt-grid/es6/Grid.d.ts +2 -0
  22. package/lib/rt-grid/es6/Grid.js +53 -0
  23. package/lib/rt-grid/es6/RowDefinition.js +22 -2
  24. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
  25. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +194 -366
  26. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +24 -4
  27. package/lib/tr-grid-column-stack/es6/ColumnStack.js +177 -52
  28. package/lib/tr-grid-util/es6/RowPainter.d.ts +2 -1
  29. package/lib/tr-grid-util/es6/RowPainter.js +7 -1
  30. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -0
  31. package/lib/tr-grid-util/es6/jet/mockDataAPI.js +191 -52
  32. package/lib/types/es6/ColumnGrouping.d.ts +1 -0
  33. package/lib/types/es6/ColumnStack.d.ts +24 -4
  34. package/lib/types/es6/Core/data/DataTable.d.ts +18 -3
  35. package/lib/types/es6/Core/data/DataView.d.ts +8 -1
  36. package/lib/types/es6/Core/data/Segment.d.ts +36 -11
  37. package/lib/types/es6/Core/data/SegmentCollection.d.ts +15 -1
  38. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +6 -1
  39. package/lib/types/es6/RealtimeGrid/Grid.d.ts +2 -0
  40. package/lib/types/es6/RowSegmenting.d.ts +2 -0
  41. package/lib/versions.json +4 -4
  42. package/package.json +1 -1
@@ -41,7 +41,8 @@ declare namespace ColumnDefinition {
41
41
  keepModel?: boolean|null,
42
42
  stationary?: boolean|null,
43
43
  leftPinned?: boolean|null,
44
- rightPinned?: boolean|null
44
+ rightPinned?: boolean|null,
45
+ info?: any
45
46
  };
46
47
 
47
48
  }
@@ -142,6 +143,10 @@ declare class ColumnDefinition {
142
143
 
143
144
  public clearUserModel(): void;
144
145
 
146
+ public setColumnInfo(obj: any): void;
147
+
148
+ public getColumnInfo(): any;
149
+
145
150
  }
146
151
 
147
152
  declare const COL_DEF: string;
@@ -48,6 +48,7 @@ import Engine from "../../tr-grid-util/es6/formula/Engine.js";
48
48
  * @property {boolean=} stationary=false If enabled, the column order cannot be changed (i.e., this column and any column to its left cannot be moved)
49
49
  * @property {boolean=} leftPinned=false If enabled, the column will not be part of the scrollable area and is pinned to the left side
50
50
  * @property {boolean=} rightPinned=false If enabled, the column will not be part of the scrollable area and is pinned to the right side
51
+ * @property {Object=} info=null Store additional information
51
52
  */
52
53
 
53
54
  /** mapping of field type to javascript type
@@ -240,6 +241,10 @@ ColumnDefinition.prototype._textSelect = false;
240
241
  * @private
241
242
  */
242
243
  ColumnDefinition.prototype._userModel = null;
244
+ /** @type {Object}
245
+ * @private
246
+ */
247
+ ColumnDefinition.prototype._info = null;
243
248
  //#endregion Private Members
244
249
 
245
250
 
@@ -399,6 +404,11 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
399
404
  this._textSelect = val;
400
405
  }
401
406
 
407
+ val = columnOption["info"];
408
+ if(val) {
409
+ this._info = val;
410
+ }
411
+
402
412
  this._userModel = columnOption;
403
413
  };
404
414
 
@@ -674,6 +684,10 @@ ColumnDefinition.prototype.getClasses = function() {
674
684
  ColumnDefinition.prototype.getConfigObject = function(colOptions) {
675
685
  var obj = colOptions || {};
676
686
 
687
+ if(this._info){
688
+ obj["info"] = this._info;
689
+ }
690
+
677
691
  if(this._field !== "" && !this._field.match(/^COLUMN_/)) {
678
692
  obj["field"] = this._field;
679
693
  }
@@ -1012,5 +1026,20 @@ ColumnDefinition.prototype.clearUserModel = function() {
1012
1026
  this._userModel = null;
1013
1027
  };
1014
1028
 
1029
+ /** @public
1030
+ * @param {Object} obj
1031
+ */
1032
+ ColumnDefinition.prototype.setColumnInfo = function(obj) {
1033
+ this._info = obj;
1034
+ };
1035
+
1036
+ /** @public
1037
+ * @return {Object}
1038
+ */
1039
+ ColumnDefinition.prototype.getColumnInfo = function() {
1040
+ return this._info;
1041
+ };
1042
+
1043
+
1015
1044
  export {ColumnDefinition, COL_DEF};
1016
1045
  export default ColumnDefinition;
@@ -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