@refinitiv-ui/efx-grid 6.0.139 → 6.0.141

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/lib/core/dist/core.js +99 -28
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/data/DataTable.d.ts +5 -1
  4. package/lib/core/es6/data/DataTable.js +38 -8
  5. package/lib/core/es6/data/DataView.d.ts +2 -0
  6. package/lib/core/es6/data/DataView.js +8 -0
  7. package/lib/core/es6/data/Segment.d.ts +1 -1
  8. package/lib/core/es6/data/Segment.js +16 -4
  9. package/lib/core/es6/data/SegmentCollection.d.ts +2 -0
  10. package/lib/core/es6/data/SegmentCollection.js +21 -10
  11. package/lib/core/es6/grid/Core.js +1 -1
  12. package/lib/core/es6/grid/components/Cell.js +9 -3
  13. package/lib/core/es6/grid/components/ElementWrapper.d.ts +2 -0
  14. package/lib/core/es6/grid/components/ElementWrapper.js +6 -2
  15. package/lib/grid/index.js +1 -1
  16. package/lib/row-segmenting/es6/RowSegmenting.d.ts +8 -1
  17. package/lib/row-segmenting/es6/RowSegmenting.js +88 -23
  18. package/lib/rt-grid/dist/rt-grid.js +607 -566
  19. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  20. package/lib/rt-grid/es6/Grid.js +37 -14
  21. package/lib/rt-grid/es6/RowDefinition.d.ts +1 -1
  22. package/lib/rt-grid/es6/RowDefinition.js +11 -3
  23. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +1 -1
  24. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +2 -3
  25. package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +2 -0
  26. package/lib/tr-grid-util/es6/jet/MockQuotes2.js +38 -8
  27. package/lib/types/es6/ConditionalColoring.d.ts +1 -1
  28. package/lib/types/es6/Core/data/DataTable.d.ts +5 -1
  29. package/lib/types/es6/Core/data/DataView.d.ts +2 -0
  30. package/lib/types/es6/Core/data/Segment.d.ts +1 -1
  31. package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
  32. package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +2 -0
  33. package/lib/types/es6/RowFiltering.d.ts +2 -1
  34. package/lib/versions.json +3 -3
  35. package/package.json +1 -1
@@ -617,6 +617,10 @@ Grid.prototype._topSection = true;
617
617
  * @private
618
618
  */
619
619
  Grid.prototype._focusingArgs = null;
620
+ /** @type {boolean}
621
+ * @private
622
+ */
623
+ Grid.prototype._hasNewUpdates = false;
620
624
 
621
625
  /** @public
622
626
  */
@@ -2381,8 +2385,12 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
2381
2385
  }
2382
2386
  }
2383
2387
  let rowDef = new RowDefinition(rowOption);
2388
+
2389
+ if(rowDef.setDataSource(this._dc, this._subs)) { // This could also subscribe chain index/ric to JET/RTK
2390
+ this._hasNewUpdates = true; // Mark data table for cleaning it up later
2391
+ }
2384
2392
  rowDef.registerToView(this._dv, this._getRowId(rowRef));
2385
- rowDef.setDataSource(this._dc, this._subs); // This could also subscribe chain index/ric to JET/RTK
2393
+
2386
2394
  this._initDuplicateRicData(rowDef);
2387
2395
 
2388
2396
  if(rowOption && rowOption["hidden"]) {
@@ -3763,11 +3771,21 @@ Grid.prototype._registerConstituents = function(rowDef) {
3763
3771
  * @param {Object} e
3764
3772
  */
3765
3773
  Grid.prototype._onDataChanged = function(e) {
3766
- if(this._dt && e && e["rid"] && e["changes"]) {
3767
- let rowDef = this._getRowDefinitionById(e["rid"]);
3768
- if(rowDef) {
3769
- if(rowDef.addUpdate(e["changes"])) { // This is the only place that update array can grow. It is used for blinking data.
3770
- this._dt._hasNewUpdates = true; // Mark data table for cleaning it up later
3774
+ if(!this._dt) {
3775
+ return;
3776
+ }
3777
+ if(e) {
3778
+ if(e["initialChanges"] && !this._dt.hasSegmentClassification()) {
3779
+ return;
3780
+ }
3781
+
3782
+ // TODO: Insertion should also be addressed here.
3783
+ if(e["rid"] && e["changes"]) {
3784
+ let rowDef = this._getRowDefinitionById(e["rid"]);
3785
+ if(rowDef) {
3786
+ if(rowDef.addUpdate(e["changes"])) { // This is the only place that update array can grow. It is used for blinking data.
3787
+ this._hasNewUpdates = true; // Mark data table for cleaning it up later
3788
+ }
3771
3789
  }
3772
3790
  }
3773
3791
  }
@@ -3776,10 +3794,8 @@ Grid.prototype._onDataChanged = function(e) {
3776
3794
  return;
3777
3795
  }
3778
3796
 
3779
- if(this._dt) {
3780
- this._dt.classifySegments();
3781
- this._dt.dispatchGlobalChange();
3782
- }
3797
+ this._dt.classifySegments();
3798
+ this._dt.dispatchGlobalChange();
3783
3799
  };
3784
3800
 
3785
3801
  /** @private
@@ -3841,9 +3857,10 @@ Grid.prototype._asyncClearDataUpdates = function() {
3841
3857
  /** @private
3842
3858
  */
3843
3859
  Grid.prototype._clearDataUpdates = function() {
3844
- if(!this._dt || !this._dt._hasNewUpdates) {
3860
+ if(!this._dt || !this._hasNewUpdates) {
3845
3861
  return;
3846
3862
  }
3863
+ this._hasNewUpdates = false;
3847
3864
  let rowIds = this._dt.getAllRowIds(true); // Use shallow copy for speed
3848
3865
  for(let i = rowIds.length; --i >= 0;) {
3849
3866
  let rowData = this._dt.getRowData(rowIds[i]);
@@ -4001,7 +4018,11 @@ Grid.prototype._onFormulaDataRequired = function(e) {
4001
4018
  Grid.prototype._onDataComposed = function(e) {
4002
4019
  let values = e["changes"];
4003
4020
  if(!values) {
4004
- return; // Cannot do data composition if there is no change in data
4021
+ if(e["initialChanges"]) {
4022
+ values = e["changes"] = e["initialChanges"]; // Need to keep e["changes"] for backward compatibility.
4023
+ } else {
4024
+ return; // Cannot do data composition if there is no change in data
4025
+ }
4005
4026
  }
4006
4027
 
4007
4028
  if(!e["rowData"]) {
@@ -4009,7 +4030,7 @@ Grid.prototype._onDataComposed = function(e) {
4009
4030
  }
4010
4031
 
4011
4032
  let rowId = e["rid"];
4012
- let rowDef = this._getRowDefinitionById(rowId);
4033
+ let rowDef = e["rowDef"] || this._getRowDefinitionById(rowId);
4013
4034
  if(!rowDef) {
4014
4035
  rowDef = this._constituentMap ? this._constituentMap[rowId] : null; // Row def could be in pending for adding to view
4015
4036
  if(!rowDef) {
@@ -4079,8 +4100,10 @@ Grid.prototype._onSubSegmentChanged = function(e) {
4079
4100
  rowDef = new RowDefinition({
4080
4101
  "segmentId": segmentId // WARNING: This could cause row id duplication
4081
4102
  });
4103
+ if(rowDef.setDataSource(this._dc)) { // auto generated row does not require a subscription
4104
+ this._hasNewUpdates = true; // Mark data table for cleaning it up later
4105
+ }
4082
4106
  rowDef.registerToView(this._dv);
4083
- rowDef.setDataSource(this._dc); // auto generated row does not require a subscription
4084
4107
  }
4085
4108
  };
4086
4109
 
@@ -48,7 +48,7 @@ declare class RowDefinition {
48
48
 
49
49
  public getType(): string;
50
50
 
51
- public setDataSource(dataSource: DataCache|null, subs?: any): void;
51
+ public setDataSource(dataSource: DataCache|null, subs?: any): boolean;
52
52
 
53
53
  public getDataSource(): DataCache|null;
54
54
 
@@ -603,20 +603,28 @@ RowDefinition.prototype.getType = function() {
603
603
  * @public
604
604
  * @param {DataCache} dataSource
605
605
  * @param {Object=} subs Quotes2 subscription object
606
+ * @return {boolean} Returns true if there is an data update
606
607
  */
607
608
  RowDefinition.prototype.setDataSource = function(dataSource, subs) {
608
609
  this._dc = dataSource || null;
609
-
610
+ let dataUpdated = false;
610
611
  if(this._dc) {
611
- this.setRowData({}); // Trigger data change
612
612
  if(this._staticValues) {
613
- this.setRowData(this._staticValues); // Trigger dataComposed and add updates
613
+ let rowData = _cloneObject(this._staticValues);
614
+ dataUpdated = this.addUpdate(rowData);
615
+ this._dc.setRowData(this._rowId, rowData, {
616
+ "rowDef": this, // The _onDataChanged and _onDataComposed handlers cannot get rowDef from DT because row does not register to view yet.
617
+ "initialChanges": this.getUpdates() // Used by _onDataComposed to keep backward compatibility.
618
+ }); // Trigger dataComposed and add updates
619
+ } else {
620
+ this._dc.setRowData(this._rowId, {});
614
621
  }
615
622
  }
616
623
 
617
624
  this._subs = subs || null;
618
625
  // This will work for runtime row insertion, but not for first initilization.
619
626
  this.subscribeForUpdates();
627
+ return dataUpdated;
620
628
  };
621
629
  /** @public
622
630
  * @return {DataCache} dataSource
@@ -1,6 +1,6 @@
1
1
  import {Ext} from '../../tr-grid-util/es6/Ext.js';
2
2
  import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
3
- import {extendObject, injectCss, prettifyCss, isEmptyObject} from '../../tr-grid-util/es6/Util.js';
3
+ import {extendObject, injectCss, prettifyCss} from '../../tr-grid-util/es6/Util.js';
4
4
  import {CellPainter} from '../../tr-grid-util/es6/CellPainter.js';
5
5
  import {FilterBuilder} from '../../tr-grid-util/es6/FilterBuilder.js';
6
6
  import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
@@ -1,6 +1,6 @@
1
1
  import {Ext} from '../../tr-grid-util/es6/Ext.js';
2
2
  import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
3
- import {extendObject, injectCss, prettifyCss, isEmptyObject} from '../../tr-grid-util/es6/Util.js';
3
+ import {extendObject, injectCss, prettifyCss} from '../../tr-grid-util/es6/Util.js';
4
4
  import {CellPainter} from '../../tr-grid-util/es6/CellPainter.js';
5
5
  import {FilterBuilder} from '../../tr-grid-util/es6/FilterBuilder.js';
6
6
  import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
@@ -1200,7 +1200,6 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
1200
1200
  }
1201
1201
 
1202
1202
  let prevDataRow, prevDataRows = host._prevDataRows;
1203
- let isPrevRowExisted = !isEmptyObject(prevDataRows);
1204
1203
  let api = this.getGridApi();
1205
1204
  for (r = fromR; r < toR; ++r) {
1206
1205
  rid = dv.getRowId(r);
@@ -1260,7 +1259,7 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
1260
1259
  }
1261
1260
  }
1262
1261
  } else {
1263
- if(isPrevRowExisted && insertedRow){
1262
+ if(insertedRow){
1264
1263
  blinking = true;
1265
1264
  bgBlinking = painter.flash(cell, this._insertionBlinking, dataRow);
1266
1265
  }
@@ -29,6 +29,8 @@ declare class MockSubscriptions {
29
29
 
30
30
  public setPercentageDataUpdate(percent?: number|null): void;
31
31
 
32
+ public setPercentageOrderChanged(percent?: number|null): void;
33
+
32
34
  public setSeed(seed: number): void;
33
35
 
34
36
  public addRic(ric: string, subId?: string|null): string|null|null;
@@ -152,6 +152,10 @@ MockSubscriptions.prototype._maxInterval = 850;
152
152
  */
153
153
  MockSubscriptions.prototype._percentageDataUpdate = 0.1; // 10% by default
154
154
  /** @private
155
+ * @type {number}
156
+ */
157
+ MockSubscriptions.prototype._percentageOrderChange = 1; // 100%
158
+ /** @private
155
159
  * @type {boolean}
156
160
  */
157
161
  MockSubscriptions.prototype._constituentCache = false;
@@ -184,6 +188,11 @@ MockSubscriptions.prototype.config = function(options) {
184
188
  this._percentageDataUpdate = num / 100;
185
189
  }
186
190
 
191
+ num = options.percentageOrderChange;
192
+ if(typeof num === "number") {
193
+ this._percentageOrderChange = num / 100;
194
+ }
195
+
187
196
  let value = options.constituentCache;
188
197
  if(value != null) {
189
198
  this._constituentCache = value;
@@ -212,6 +221,15 @@ MockSubscriptions.prototype.setPercentageDataUpdate = function(percent) {
212
221
  }
213
222
  };
214
223
 
224
+ /** @public
225
+ * @param {number=} percent
226
+ */
227
+ MockSubscriptions.prototype.setPercentageOrderChanged = function(percent) {
228
+ if(typeof percent === "number") {
229
+ this._percentageOrderChange = Math.round(percent / 100);
230
+ }
231
+ };
232
+
215
233
  /** @public
216
234
  * @param {number} seed
217
235
  */
@@ -499,7 +517,7 @@ MockSubscriptions.prototype._addSymbol = function(ric, asChain, subId) {
499
517
  childSub["CHILD_ORDER"] = i;
500
518
  this._dataMap.addItem(_joinSubKeys(sub, childSub), childSub);
501
519
  }
502
- } else {
520
+ } else { // Duplicate chain
503
521
  let firstSub = subs[0];
504
522
  let constituents = firstSub["children"];
505
523
  childCount = constituents.length;
@@ -547,7 +565,6 @@ MockSubscriptions.prototype._connect = function() {
547
565
  }
548
566
  };
549
567
 
550
- /** @private */
551
568
  MockSubscriptions.prototype._onSubscriptionResponse = function() {
552
569
  this._timerId = 0;
553
570
 
@@ -565,20 +582,22 @@ MockSubscriptions.prototype._onSubscriptionResponse = function() {
565
582
  let numRows = this._dataGen.randInt(minRow, maxRow);
566
583
  let fields = this._fields;
567
584
 
585
+ let updateCount = 0;
586
+ let childOrderChange;
568
587
  for(let i = 0; i < numRows; i++) {
588
+ // find key to random subs (key is subId)
569
589
  let key = keys[this._dataGen.randIndex(len)]; // WARNING: Same sub could be picked more than once
570
590
  let subs = this._dataMap.getItems(key); // Get all subs with the same RIC
571
591
 
572
592
  let sub = subs[0]; // Only the first sub is need to generate data
593
+ let values, j, jLen;
573
594
  let subParent = sub.parent;
574
- let updatePosition = this._dataGen.randBoolean(); // Flag for change CHILD_ORDER position
595
+ let updatePosition = this._dataGen.randInt(0, 100) < this._percentageOrderChange * 100 ? true : false; // Random chance to change dynamic chain position (2% to change)
575
596
 
576
- let values, j, jLen;
577
597
  if(_isDynamicChain(key) && subParent && updatePosition) { // subParent in header of dynamic chain is behavior like a normal ric
578
- // TODO: support rate of ordering is changed
579
598
  let children = subParent.children;
580
599
 
581
- children = _shuffleArray(children);
600
+ children = _shuffleArray(children); // Random swap children in array
582
601
  let childrenLen = children.length;
583
602
  let subIndex = children.indexOf(sub);
584
603
  sub["CHILD_ORDER"] = subIndex;
@@ -600,22 +619,33 @@ MockSubscriptions.prototype._onSubscriptionResponse = function() {
600
619
  });
601
620
  }
602
621
  }
603
- this._dispatchPostUpdate({ childOrderChange: true });
622
+ childOrderChange = true;
604
623
  }
605
624
 
606
625
  } else {
607
626
  values = this._generateQuoteData(sub, fields);
608
- jLen = subs.length;
627
+ jLen = subs.length; // Duplicate ric or chain
609
628
  for(j = 0; j < jLen; ++j) { // It could be same ric and it need to dispatch with same ric number
610
629
  let childOrder = subs[j]["CHILD_ORDER"];
611
630
  if(childOrder != null) { // Children of chain will have a CHILD_ORDER
612
631
  values["CHILD_ORDER"] = childOrder;
613
632
  }
614
633
  this._dispatchDataChanged(subs[j], values);
634
+ updateCount++;
615
635
  }
616
636
  }
617
637
  }
618
638
 
639
+ let postObj = {};
640
+ if(childOrderChange != null) {
641
+ postObj["childOrderChange"] = childOrderChange;
642
+ }
643
+ if(updateCount != null) {
644
+ postObj["updateCount"] = updateCount;
645
+ }
646
+
647
+ this._dispatchPostUpdate(postObj);
648
+
619
649
  this._connect();
620
650
  };
621
651
 
@@ -1,6 +1,6 @@
1
1
  import {Ext} from '../../tr-grid-util/es6/Ext.js';
2
2
  import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
3
- import {extendObject, injectCss, prettifyCss, isEmptyObject} from '../../tr-grid-util/es6/Util.js';
3
+ import {extendObject, injectCss, prettifyCss} from '../../tr-grid-util/es6/Util.js';
4
4
  import {CellPainter} from '../../tr-grid-util/es6/CellPainter.js';
5
5
  import {FilterBuilder} from '../../tr-grid-util/es6/FilterBuilder.js';
6
6
  import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
@@ -88,6 +88,8 @@ declare class DataTable extends DataCache {
88
88
 
89
89
  public hasSegmentation(): boolean;
90
90
 
91
+ public hasSegmentClassification(): boolean;
92
+
91
93
  public isSegmentSeparator(rid: string): boolean;
92
94
 
93
95
  public getSegment(rid: string): Segment|null;
@@ -132,6 +134,8 @@ declare class DataTable extends DataCache {
132
134
 
133
135
  public requestClassifying(): void;
134
136
 
137
+ public setSegmentDefaultCollapsing(bool: boolean): boolean;
138
+
135
139
  public dispatchGlobalChange(suppressEvent?: boolean|null): void;
136
140
 
137
141
  public static getSortingDefinitions(): void;
@@ -144,7 +148,7 @@ declare function prevFrozen(ary: (any)[][], opt_cidList?: (string)[]|null, opt_r
144
148
 
145
149
  declare function cid(): null;
146
150
 
147
- declare function removalList(sortingDefs: (any[])[]|null): boolean;
151
+ declare function removalList(bool: boolean): boolean;
148
152
 
149
153
  declare function logic(a: number, b: number, order: number, sortingDefs: (any[])[]|null): number;
150
154
 
@@ -304,6 +304,8 @@ declare class DataView extends EventDispatcher {
304
304
 
305
305
  public setSegmentClassification(segmentRef: string|number|null, fields: string|(string)[]|null): boolean;
306
306
 
307
+ public setSegmentDefaultCollapsing(bool: boolean): boolean;
308
+
307
309
  public getWrapSize(): number;
308
310
 
309
311
  public getWrappedViews(): (WrappedView)[]|null;
@@ -65,7 +65,7 @@ declare class Segment extends EventDispatcher {
65
65
 
66
66
  public setOrder(val: number): void;
67
67
 
68
- public log(lines: (string)[]|null): (string)[]|null;
68
+ public log(lines?: (string)[]|null): (string)[];
69
69
 
70
70
  }
71
71
 
@@ -70,6 +70,8 @@ declare class SegmentCollection extends EventDispatcher {
70
70
 
71
71
  public classify(rows: { [key: string]: any }|null): boolean;
72
72
 
73
+ public setDefaultCollapsing(bool: boolean): boolean;
74
+
73
75
  }
74
76
 
75
77
  export default SegmentCollection;
@@ -51,6 +51,8 @@ declare class ElementWrapper extends EventDispatcher {
51
51
 
52
52
  public getAttribute(str: string): string;
53
53
 
54
+ public hasAttribute(str: string): boolean;
55
+
54
56
  public setAttribute(str: string, val: string): void;
55
57
 
56
58
  public setAttributes(json: any): void;
@@ -38,7 +38,8 @@ declare namespace RowFilteringPlugin {
38
38
  additionalItems?: any[]|null,
39
39
  compactMode?: boolean|null,
40
40
  blankValues?: (boolean|string)|null,
41
- dateTimeFormat?: string|null
41
+ dateTimeFormat?: string|null,
42
+ showOnlyFilteredItems?: boolean|null
42
43
  };
43
44
 
44
45
  type FilterEntry = {
package/lib/versions.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
- "tr-grid-util": "1.3.168",
2
+ "tr-grid-util": "1.3.169",
3
3
  "tr-grid-printer": "1.0.18",
4
4
  "@grid/column-dragging": "1.0.21",
5
- "@grid/row-segmenting": "2.0.0",
5
+ "@grid/row-segmenting": "2.0.1",
6
6
  "@grid/statistics-row": "1.0.17",
7
7
  "@grid/zoom": "1.0.13",
8
8
  "tr-grid-auto-tooltip": "1.1.9",
@@ -14,7 +14,7 @@
14
14
  "tr-grid-column-resizing": "1.0.29",
15
15
  "tr-grid-column-selection": "1.0.33",
16
16
  "tr-grid-column-stack": "1.0.76",
17
- "tr-grid-conditional-coloring": "1.0.73",
17
+ "tr-grid-conditional-coloring": "1.0.74",
18
18
  "tr-grid-content-wrap": "1.0.20",
19
19
  "tr-grid-contextmenu": "1.0.44",
20
20
  "tr-grid-filter-input": "0.9.43",
package/package.json CHANGED
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "version": "6.0.139"
72
+ "version": "6.0.141"
73
73
  }