@refinitiv-ui/efx-grid 6.0.13 → 6.0.15

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-format-dialog/index.d.ts +2 -1
  2. package/lib/column-format-dialog/index.js +2 -1
  3. package/lib/column-selection-dialog/index.d.ts +2 -1
  4. package/lib/column-selection-dialog/index.js +2 -1
  5. package/lib/core/dist/core.js +1220 -161
  6. package/lib/core/dist/core.min.js +1 -1
  7. package/lib/core/es6/data/DataCache.js +1 -1
  8. package/lib/core/es6/data/DataTable.d.ts +18 -3
  9. package/lib/core/es6/data/DataTable.js +203 -17
  10. package/lib/core/es6/data/DataView.d.ts +8 -1
  11. package/lib/core/es6/data/DataView.js +30 -2
  12. package/lib/core/es6/data/Segment.d.ts +37 -12
  13. package/lib/core/es6/data/Segment.js +584 -60
  14. package/lib/core/es6/data/SegmentCollection.d.ts +16 -2
  15. package/lib/core/es6/data/SegmentCollection.js +238 -80
  16. package/lib/core/es6/grid/Core.js +1 -1
  17. package/lib/filter-dialog/index.d.ts +2 -1
  18. package/lib/filter-dialog/index.js +2 -1
  19. package/lib/grid/index.d.ts +2 -1
  20. package/lib/grid/index.js +3 -2
  21. package/lib/row-segmenting/es6/RowSegmenting.d.ts +2 -0
  22. package/lib/row-segmenting/es6/RowSegmenting.js +26 -3
  23. package/lib/rt-grid/dist/rt-grid.js +1194 -158
  24. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  25. package/lib/rt-grid/es6/Grid.d.ts +4 -0
  26. package/lib/rt-grid/es6/Grid.js +75 -0
  27. package/lib/rt-grid/es6/RowDefinition.d.ts +4 -0
  28. package/lib/rt-grid/es6/RowDefinition.js +79 -2
  29. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
  30. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +194 -366
  31. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +10 -3
  32. package/lib/tr-grid-column-stack/es6/ColumnStack.js +93 -36
  33. package/lib/tr-grid-util/es6/RowPainter.d.ts +2 -1
  34. package/lib/tr-grid-util/es6/RowPainter.js +7 -1
  35. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -0
  36. package/lib/tr-grid-util/es6/jet/mockDataAPI.js +191 -52
  37. package/lib/types/es6/ColumnGrouping.d.ts +1 -0
  38. package/lib/types/es6/ColumnStack.d.ts +10 -3
  39. package/lib/types/es6/Core/data/DataTable.d.ts +18 -3
  40. package/lib/types/es6/Core/data/DataView.d.ts +8 -1
  41. package/lib/types/es6/Core/data/Segment.d.ts +36 -11
  42. package/lib/types/es6/Core/data/SegmentCollection.d.ts +15 -1
  43. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +6 -1
  44. package/lib/types/es6/RealtimeGrid/Grid.d.ts +2 -0
  45. package/lib/types/es6/RowSegmenting.d.ts +2 -0
  46. package/lib/versions.json +4 -4
  47. package/package.json +15 -2
@@ -193,6 +193,8 @@ declare class Grid extends EventDispatcher {
193
193
 
194
194
  public setRic(rowRef: Grid.RowReference|null, str: string): void;
195
195
 
196
+ public unlinkChain(rowRef: Grid.RowReference|null): void;
197
+
196
198
  public setRowContent(rowRef: Grid.RowReference|null, str: string): void;
197
199
 
198
200
  public toggleRowExpansion(rid: string|number|null, force?: boolean|null): void;
@@ -271,6 +273,8 @@ declare class Grid extends EventDispatcher {
271
273
 
272
274
  public toggleChain(rowRef: Grid.RowReference|null): void;
273
275
 
276
+ public setClassification(rowRef: Grid.RowReference|null, fields: (string)[]|null): boolean;
277
+
274
278
  public focus(): void;
275
279
 
276
280
  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
@@ -2242,6 +2245,28 @@ Grid.prototype.setRic = function(rowRef, str) {
2242
2245
  }
2243
2246
  }
2244
2247
  };
2248
+ /** Unlink the chain and its constituents. When the chain is expanded,
2249
+ * the chain row and its members are converted from autogenerated to
2250
+ * regular real-time rows. Only the chain row will be transformed to
2251
+ * a conventional real-time row if the chain is collapsed.
2252
+ * All converted rows will continue to have their data updated.
2253
+ *
2254
+ * @public
2255
+ * @param {Grid~RowReference} rowRef
2256
+ */
2257
+ Grid.prototype.unlinkChain = function(rowRef) {
2258
+ var rowDef = this._getRowDefinition(rowRef);
2259
+ if(!rowDef) {
2260
+ return;
2261
+ }
2262
+
2263
+ if(!rowDef.isChain()) {
2264
+ return;
2265
+ }
2266
+
2267
+ rowDef.unlinkChain();
2268
+ };
2269
+
2245
2270
  /** Alias to setRic
2246
2271
  * @public
2247
2272
  * @function
@@ -2857,6 +2882,7 @@ Grid.prototype._updateStreamingData = function() {
2857
2882
  }
2858
2883
 
2859
2884
  if(this._dt) {
2885
+ this._dt.classifySegments();
2860
2886
  this._dt.dispatchGlobalChange();
2861
2887
  }
2862
2888
  };
@@ -2978,6 +3004,20 @@ Grid.prototype.toggleChain = function(rowRef) {
2978
3004
  rowDef.toggleChain();
2979
3005
  }
2980
3006
  };
3007
+ /**
3008
+ * @public
3009
+ * @param {Grid~RowReference} rowRef
3010
+ * @param {Array.<string>} fields
3011
+ * @return {boolean}
3012
+ */
3013
+ Grid.prototype.setClassification = function(rowRef, fields) {
3014
+ var rowDef = this._getRowDefinition(rowRef);
3015
+ if(rowDef) {
3016
+ return this._dt.setSegmentClassification(rowDef.getRowId(), fields);
3017
+ }
3018
+ return false;
3019
+ };
3020
+
2981
3021
  /** @description Focus grid element without moving window scrollbar
2982
3022
  * @public
2983
3023
  */
@@ -3082,6 +3122,41 @@ Grid.prototype._onDataComposed = function(e) {
3082
3122
 
3083
3123
  this._recalculateFormulas(e);
3084
3124
  };
3125
+ /** @private
3126
+ * @param {Object} e
3127
+ */
3128
+ Grid.prototype._onSubSegmentChanged = function(e) {
3129
+ var insertionList = /** @type{Array.<Segment>} */(e["insertionList"]);
3130
+ var removalList = /** @type{Array.<string>} */(e["removalList"]);
3131
+ var removedRows = /** @type{Object} */(e["removedRows"]);
3132
+
3133
+ var i;
3134
+ var removalCount = removalList.length;
3135
+ var rowDef = null;
3136
+ for(i = 0; i < removalCount; i++) {
3137
+ var rid = removalList[i];
3138
+ var removedRow = removedRows[rid];
3139
+ if(removedRow) {
3140
+ rowDef = removedRow[ROW_DEF];
3141
+ if(rowDef) {
3142
+ rowDef.dispose();
3143
+ removedRow[ROW_DEF] = null;
3144
+ }
3145
+ }
3146
+ }
3147
+
3148
+ var insertionCount = insertionList.length;
3149
+ for(i = 0; i < insertionCount; i++) {
3150
+ var segment = insertionList[i];
3151
+ // var parentId = segment.getParentId();
3152
+ var segmentId = segment.getId();
3153
+ rowDef = new RowDefinition({
3154
+ "segmentId": segmentId
3155
+ });
3156
+ rowDef.setDataSource(this._dc);
3157
+ rowDef.registerToView(this._dv);
3158
+ }
3159
+ };
3085
3160
 
3086
3161
  /** @private
3087
3162
  * @param {Object=} e
@@ -91,6 +91,10 @@ declare class RowDefinition {
91
91
 
92
92
  public static deregisterFromView(rowIds: (string)[]|null, rowDef: RowDefinition|null): (string)[]|null;
93
93
 
94
+ public _toRealTimeRow(): void;
95
+
96
+ public unlinkChain(): void;
97
+
94
98
  public collapseChain(): boolean;
95
99
 
96
100
  public expandChain(): boolean;
@@ -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,11 +759,68 @@ 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;
746
766
  };
767
+
768
+ /** Used to convert autogenerated row to regular real-time row
769
+ * @public
770
+ */
771
+ RowDefinition.prototype._toRealTimeRow = function() {
772
+ if(!this._ric) { // Empty row
773
+ return;
774
+ }
775
+ if(this.isRowHeader()) {
776
+ return;
777
+ }
778
+
779
+ this._realTimeField = true;
780
+ this._dataId = this._rowId + this._ric; // JET/RTK will generate data id to be rowId (given from this rowDef) + ric;
781
+
782
+ this._autoGenerated = false;
783
+ this._parent = null;
784
+ this._depthLevel = 0;
785
+
786
+ this.subscribeForUpdates();
787
+ };
788
+
789
+ /** @public
790
+ */
791
+ RowDefinition.prototype.unlinkChain = function() {
792
+ if(!this._isChain) {
793
+ return;
794
+ }
795
+
796
+ if(this.isChainExpanded()) {
797
+ var rowDefs = this.getDescendants();
798
+ var len = rowDefs.length;
799
+ for(var i = 0; i < len; i++) {
800
+ rowDefs[i]._toRealTimeRow();
801
+ }
802
+ }
803
+
804
+ this.unsubscribeForUpdates();
805
+
806
+ var view = this._view;
807
+ if(view) {
808
+ var rid = this.getRowId();
809
+ var segment = view.getSegment(rid);
810
+ if(segment) {
811
+ segment.setClassification(null);
812
+ }
813
+ view.setSegmentSeparator(rid, false);
814
+ }
815
+
816
+ this._isChain = this._expanded = false;
817
+ this._chainRic = "";
818
+ this._userInput = this._ric;
819
+ this._children = null;
820
+
821
+ this.subscribeForUpdates();
822
+ };
823
+
747
824
  /** @public
748
825
  * @return {boolean} Returns true if there is a change in view
749
826
  */
@@ -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