@refinitiv-ui/efx-grid 6.0.32 → 6.0.33

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 (30) hide show
  1. package/lib/core/dist/core.js +86 -11
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/grid/Core.d.ts +4 -0
  4. package/lib/core/es6/grid/Core.js +27 -6
  5. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +1 -0
  6. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +29 -5
  7. package/lib/grid/index.js +1 -1
  8. package/lib/rt-grid/dist/rt-grid.js +521 -179
  9. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  10. package/lib/rt-grid/es6/Grid.js +14 -13
  11. package/lib/rt-grid/es6/RowDefinition.js +1 -1
  12. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -0
  13. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +58 -30
  14. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +2 -0
  15. package/lib/tr-grid-column-stack/es6/ColumnStack.js +35 -12
  16. package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +2 -0
  17. package/lib/tr-grid-util/es6/GroupDefinitions.js +15 -0
  18. package/lib/tr-grid-util/es6/Util.d.ts +3 -0
  19. package/lib/tr-grid-util/es6/Util.js +15 -0
  20. package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +1 -1
  21. package/lib/tr-grid-util/es6/jet/CollectionDict.js +12 -2
  22. package/lib/tr-grid-util/es6/jet/MockQuotes2.js +170 -47
  23. package/lib/types/es6/ColumnGrouping.d.ts +4 -0
  24. package/lib/types/es6/ColumnSelection.d.ts +2 -0
  25. package/lib/types/es6/ColumnStack.d.ts +2 -0
  26. package/lib/types/es6/Core/grid/util/SelectionList.d.ts +6 -2
  27. package/lib/types/es6/RowDragging.d.ts +23 -1
  28. package/lib/types/es6/StatisticsRow.d.ts +25 -25
  29. package/lib/versions.json +3 -3
  30. package/package.json +1 -1
@@ -217,6 +217,7 @@ MockSubscriptions.prototype.removeSubscription = function(subId) {
217
217
  child["parent"] = null;
218
218
  }
219
219
  sub["children"] = null;
220
+ sub["ricList"] = null;
220
221
  }
221
222
  };
222
223
  /** @public
@@ -283,9 +284,9 @@ MockSubscriptions.prototype.start = function() {
283
284
  /** @public */
284
285
  MockSubscriptions.prototype.stop = function() {
285
286
  this._working = false;
286
- if(this._timerId >= 0) {
287
+ if(this._timerId) {
287
288
  window.clearTimeout(this._timerId);
288
- this._timerId = -1;
289
+ this._timerId = 0;
289
290
  }
290
291
  };
291
292
 
@@ -418,26 +419,55 @@ MockSubscriptions.prototype._addSymbol = function(ric, asChain, subId) {
418
419
  sub["ric"] = ric;
419
420
  sub["chain"] = asChain;
420
421
  sub["id"] = subId;
421
- sub["dataId"] = subId + sub["ric"];
422
+ sub["dataId"] = subId + ric;
422
423
  this._subMap[subId] = sub; // Collect all user subscriptions
423
- this._dataMap.addItem(sub["ric"], sub);
424
+ this._dataMap.addItem(ric, sub);
425
+ var subs = this._dataMap.getItems(ric);
426
+ var subCount = subs.length;
427
+
428
+ this._dispatch("subscriptionAdded", {"subs": [sub]});
429
+
430
+ var childSub = null;
431
+ var childCount = 0;
432
+ var i;
424
433
  if(asChain) {
425
- sub["children"] = [];
426
- var childCount = MockSubscriptions.simpleDigest(ric) % 10 + 4;
427
- for(var i = 0; i < childCount; ++i) {
428
- // Note that constituents should have no subscription object. They should share the same subscription as their parent. Hence we does not register it to the _subMap
429
- var childSub = {};
430
- childSub["ric"] = "Child_" + String.fromCharCode(65 + i);
431
- childSub["id"] = subId; // Child shares the same sub id as its chain parent
432
- childSub["dataId"] = subId + childSub["ric"];
433
- childSub["parent"] = sub; // This does not exist in real subscription
434
- sub["children"].push(childSub);
435
-
436
- this._dataMap.addItem(_joinSubKeys(sub, childSub), childSub);
434
+ // Note that constituents should have no subscription object. They should share the same subscription as their parent. Hence we does not register it to the _subMap
435
+ if(subCount === 1) { // The first chain detected
436
+ sub["children"] = [];
437
+ childCount = MockSubscriptions.simpleDigest(ric) % 10 + 4;
438
+ for(i = 0; i < childCount; ++i) {
439
+ childSub = {};
440
+ childSub["ric"] = "Child_" + String.fromCharCode(65 + i);
441
+ childSub["id"] = subId; // Child shares the same sub id as its chain parent
442
+ childSub["dataId"] = subId + childSub["ric"];
443
+ childSub["parent"] = sub; // This does not exist in real subscription
444
+ sub["children"].push(childSub);
445
+
446
+ this._dataMap.addItem(_joinSubKeys(sub, childSub), childSub);
447
+ }
448
+ } else {
449
+ var firstSub = subs[0];
450
+ var constituents = firstSub["children"];
451
+ childCount = constituents.length;
452
+ sub["children"] = new Array(childCount);
453
+
454
+ for(i = 0; i < childCount; ++i) {
455
+ childSub = {};
456
+ childSub["ric"] = constituents[i]["ric"];
457
+ childSub["id"] = subId; // Child shares the same sub id as its chain parent
458
+ childSub["dataId"] = subId + childSub["ric"];
459
+ childSub["parent"] = sub; // This does not exist in real subscription
460
+ sub["children"][i] = childSub;
461
+
462
+ this._dataMap.addItem(_joinSubKeys(sub, childSub), childSub);
463
+ }
464
+ }
465
+ }
466
+ if(subCount > 1) { // Duplicate RIC/CHAIN detected
467
+ if(this._working) {
468
+ setTimeout(this._updateDuplicateSymbol.bind(this, ric), 10);
437
469
  }
438
470
  }
439
-
440
- this._dispatch("subscriptionAdded", {"subs": [sub]});
441
471
 
442
472
  this._connect();
443
473
  return subId;
@@ -457,14 +487,15 @@ MockSubscriptions.simpleDigest = function(str) {
457
487
 
458
488
  /** @private */
459
489
  MockSubscriptions.prototype._connect = function() {
460
- if(!this._working || this._timerId >= 0) { return; }
461
- var delay = this._dataGen.randInt(this._minInterval, this._maxInterval);
462
- this._timerId = window.setTimeout(this._onSubscriptionResponse, delay);
490
+ if(this._working && !this._timerId) {
491
+ var delay = this._dataGen.randInt(this._minInterval, this._maxInterval);
492
+ this._timerId = window.setTimeout(this._onSubscriptionResponse, delay);
493
+ }
463
494
  };
464
495
 
465
496
  /** @private */
466
497
  MockSubscriptions.prototype._onSubscriptionResponse = function() {
467
- this._timerId = -1;
498
+ this._timerId = 0;
468
499
 
469
500
  var keys = this._dataMap.getAllKeys(); // list of all rics
470
501
  var len = keys ? keys.length : 0;
@@ -478,34 +509,14 @@ MockSubscriptions.prototype._onSubscriptionResponse = function() {
478
509
  var maxRow = (this._percentageDataUpdate + 0.02) * len;
479
510
  maxRow = maxRow < len ? maxRow : len; // not more than all rows
480
511
  var numRows = this._dataGen.randInt(minRow, maxRow);
512
+ var fields = this._fields;
481
513
 
482
514
  for(var i = 0; i < numRows; i++) {
483
515
  var key = keys[this._dataGen.randIndex(len)]; // WARNING: Same sub could be picked more than once
484
- var subs = this._dataMap.getItems(key);
485
-
486
- var sub = subs[0];
487
- var ric = sub.ric;
488
- var prevData = sub.prevData;
489
-
490
- var values = {};
491
- var options = {
492
- text: ric,
493
- prefix: sub["parent"] ? sub["parent"]["ric"] : ""
494
- };
495
- for(var field in this._fields){
496
- var data = this._dataGen.generateQuoteData(field, options);
497
- if(prevData) {
498
- if(data.changeOnly) {
499
- if(prevData[field] === data.value) {
500
- continue;
501
- }
502
- }
503
- prevData[field] = data.value;
504
- }
516
+ var subs = this._dataMap.getItems(key); // Get all subs with the same RIC
505
517
 
506
- values[field] = data.value;
507
- values[field + "_FORMATTED"] = data.formattedValue;
508
- }
518
+ var sub = subs[0]; // Only the first sub is need to generate data
519
+ var values = this._generateQuoteData(sub, fields);
509
520
 
510
521
  var jLen = subs.length;
511
522
  for(var j = 0; j < jLen; ++j) {
@@ -517,6 +528,109 @@ MockSubscriptions.prototype._onSubscriptionResponse = function() {
517
528
  };
518
529
  /** @private
519
530
  * @param {Object} sub
531
+ * @param {Object} fields
532
+ * @return {!Object}
533
+ */
534
+ MockSubscriptions.prototype._generateQuoteData = function(sub, fields) {
535
+ var ric = sub.ric;
536
+ var prevData = sub.prevData;
537
+
538
+ var values = {};
539
+ var options = {
540
+ text: ric,
541
+ prefix: sub["parent"] ? sub["parent"]["ric"] : "" // prefix for constituents
542
+ };
543
+ for(var field in fields){
544
+ var data = this._dataGen.generateQuoteData(field, options);
545
+ var formattedField = field + "_FORMATTED";
546
+ if(prevData) {
547
+ if(data.changeOnly) {
548
+ if(prevData[field] === data.value) {
549
+ continue;
550
+ }
551
+ }
552
+ prevData[field] = data.value;
553
+ prevData[formattedField] = data.formattedValue;
554
+ }
555
+
556
+ values[field] = data.value;
557
+ values[formattedField] = data.formattedValue;
558
+ }
559
+ return values;
560
+ };
561
+
562
+
563
+ /** @private
564
+ * @param {Object} parentSub
565
+ * @param {string} ric
566
+ * @return {Object}
567
+ */
568
+ MockSubscriptions.prototype._getChildSubByRic = function(parentSub, ric) {
569
+ var children = parentSub["children"];
570
+ if(children) {
571
+ var childCount = children.length;
572
+ for(var i = 0; i < childCount; ++i) {
573
+ var child = children[i];
574
+ if(child["ric"] === ric) {
575
+ return child;
576
+ }
577
+ }
578
+ }
579
+ return null;
580
+ };
581
+ /** @private
582
+ * @param {string} ric
583
+ */
584
+ MockSubscriptions.prototype._updateDuplicateSymbol = function(ric) {
585
+ var subs = this._dataMap.getItems(ric);
586
+ if(!subs) {
587
+ return;
588
+ }
589
+ var subCount = subs.length;
590
+ if(subCount < 2) {
591
+ return;
592
+ }
593
+ var firstSub = subs[0];
594
+ var prevData = firstSub["prevData"];
595
+ var isChain = firstSub["chain"] ? true : false;
596
+ var i;
597
+ if(prevData) {
598
+ for(i = 1; i < subCount; ++i) {
599
+ var sub = subs[i];
600
+ if(!sub["prevData"]) {
601
+ this._dispatchDataChanged(sub, prevData);
602
+ }
603
+ }
604
+ }
605
+
606
+
607
+ if(!isChain) {
608
+ return;
609
+ }
610
+ var ricList = firstSub["ricList"];
611
+ if(!ricList) {
612
+ return;
613
+ }
614
+ var childCount = ricList.length;
615
+
616
+ for(i = 1; i < subCount; ++i) {
617
+ var sub2 = subs[i];
618
+ var ricList2 = sub2["ricList"];
619
+ var childCount2 = ricList2 ? ricList2.length : 0;
620
+ for(var j = childCount2; j < childCount; ++j) {
621
+ var childRic = ricList[j];
622
+ var childSub = this._getChildSubByRic(firstSub, childRic);
623
+ var childSub2 = this._getChildSubByRic(sub2, childRic);
624
+ if(childSub && childSub2) {
625
+ if(childSub["prevData"]) {
626
+ this._dispatchDataChanged(childSub2, childSub["prevData"]);
627
+ }
628
+ }
629
+ }
630
+ }
631
+ };
632
+ /** @private
633
+ * @param {Object} sub
520
634
  * @param {Object} dataUpdates
521
635
  */
522
636
  MockSubscriptions.prototype._dispatchDataChanged = function(sub, dataUpdates) {
@@ -536,6 +650,15 @@ MockSubscriptions.prototype._dispatchDataChanged = function(sub, dataUpdates) {
536
650
  values["STATUS_FORMATTED"] = this._statusMap["1"];
537
651
  values["SUB_ID"] = sub["id"];
538
652
  copyValues(values, prevData);
653
+
654
+ var parentSub = sub.parent;
655
+ if(parentSub) { // This is the first time constituent have the data
656
+ var ricList = parentSub["ricList"];
657
+ if(!ricList) {
658
+ ricList = parentSub["ricList"] = [];
659
+ }
660
+ parentSub["ricList"].push(sub["ric"]);
661
+ }
539
662
  }
540
663
  this._dispatch("dataChanged", evtArg);
541
664
  };
@@ -593,7 +716,7 @@ MockSubscriptions.prototype._working = false;
593
716
  /** @type {number}
594
717
  * @private
595
718
  */
596
- MockSubscriptions.prototype._timerId = -1;
719
+ MockSubscriptions.prototype._timerId = 0;
597
720
 
598
721
  /** @type {number}
599
722
  * @private
@@ -37,6 +37,8 @@ declare class ColumnGroupingPlugin extends GridPlugin {
37
37
 
38
38
  public getConfigObject(gridOptions?: any): any;
39
39
 
40
+ public renderGroups(): void;
41
+
40
42
  public addColumnToGroup(column: any, groupId: string, colIndex: number): void;
41
43
 
42
44
  public addGroup(groupDef: ColumnGroupingPlugin.GroupDefinition|null): string;
@@ -55,6 +57,8 @@ declare class ColumnGroupingPlugin extends GridPlugin {
55
57
 
56
58
  public setGroupChildren(groupId: string, newChildList: (string)[]|null): boolean;
57
59
 
60
+ public setGroupName(groupId: string, groupName: string): void;
61
+
58
62
  public getGroupChildren(groupId: string): (string)[]|null;
59
63
 
60
64
  public getChildColumnIndices(groupId: string): (number)[]|null;
@@ -70,6 +70,8 @@ declare class ColumnSelectionPlugin extends GridPlugin {
70
70
 
71
71
  public getActiveGrid(): any;
72
72
 
73
+ public dispatchSelectionChanged(): void;
74
+
73
75
  }
74
76
 
75
77
  export default ColumnSelectionPlugin;
@@ -119,6 +119,8 @@ declare class ColumnStackPlugin extends GridPlugin {
119
119
 
120
120
  public getActiveColumnField(stackId: string): string;
121
121
 
122
+ public getActiveColumnIndex(stackId: string): number;
123
+
122
124
  public addStackChild(stackId: string, colRef: number|string|null): void;
123
125
 
124
126
  public removeStackChild(stackId: string, colRef: number|string|null): void;
@@ -12,6 +12,8 @@ declare class SelectionList {
12
12
 
13
13
  public deselect(at: number): boolean;
14
14
 
15
+ public deselectFrom(at: number): boolean;
16
+
15
17
  public toggleSelection(at: number): void;
16
18
 
17
19
  public singularlySelect(at: number): boolean;
@@ -36,13 +38,15 @@ declare class SelectionList {
36
38
 
37
39
  public getLastSelectedIndex(): number;
38
40
 
39
- public getAllSelections(): (number)[]|null;
41
+ public getAllSelections(): (number)[];
42
+
43
+ public getConnectedRanges(from?: number|null, to?: number|null): (number)[][];
40
44
 
41
45
  public getSelectionMap(): (boolean)[]|null;
42
46
 
43
47
  public clearAllSelections(): number;
44
48
 
45
- public copyFrom(srcSelections: SelectionList|null, fromSrcIndex: number, offsetIndex: number, forLength: number): void;
49
+ public copyFrom(srcSelections: SelectionList|null, fromSrcIndex: number, offset: number, forLength: number): void;
46
50
 
47
51
  }
48
52
 
@@ -39,7 +39,7 @@ declare class RowDraggingPlugin extends GridPlugin {
39
39
 
40
40
  public getConfigObject(out_obj?: any): any;
41
41
 
42
- public startDrag(startRef: any, opt_suppressEvent?: boolean|null): void;
42
+ public startDrag(startRef?: any): void;
43
43
 
44
44
  public stopDrag(): void;
45
45
 
@@ -53,6 +53,28 @@ declare class RowDraggingPlugin extends GridPlugin {
53
53
 
54
54
  public disableUIs(disabled?: boolean|null): void;
55
55
 
56
+ public allowDrag(allowed?: boolean|null): void;
57
+
58
+ public allowDrop(allowed?: boolean|null): void;
59
+
60
+ public setDragContent(content: any): void;
61
+
62
+ public getDragBox(): Element|null;
63
+
64
+ public getDragSource(): string;
65
+
66
+ public isDragging(): boolean;
67
+
68
+ public disableDragging(disabled?: boolean|null): void;
69
+
70
+ public enableJETDragAndDrop(enabled?: boolean|null): void;
71
+
72
+ public getJETDragContent(): any;
73
+
74
+ public setJETDragContent(content: any): void;
75
+
76
+ public setJETDragContent(content: any): void;
77
+
56
78
  }
57
79
 
58
80
  export default RowDraggingPlugin;
@@ -4,42 +4,42 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
4
4
  declare namespace StatisticsRowPlugin {
5
5
 
6
6
  type Options = {
7
- rows?: any[],
8
- invalidText?: string,
9
- noColoring?: boolean,
10
- noFormatting?: boolean,
11
- postCalculation?: ((...params: any[]) => any),
12
- postRendering?: ((...params: any[]) => any)
7
+ rows?: any[]|null,
8
+ invalidText?: string|null,
9
+ noColoring?: boolean|null,
10
+ noFormatting?: boolean|null,
11
+ postCalculation?: ((...params: any[]) => any)|null,
12
+ postRendering?: ((...params: any[]) => any)|null
13
13
  };
14
14
 
15
15
  type ColumnOptions = {
16
- statistics?: (boolean|string)
16
+ statistics?: (boolean|string)|null
17
17
  };
18
18
 
19
19
  type RowOptions = {
20
- placement?: string,
21
- statistic?: string,
22
- label?: string,
23
- id?: string
20
+ placement?: string|null,
21
+ statistic?: string|null,
22
+ label?: string|null,
23
+ id?: string|null
24
24
  };
25
25
 
26
- type RowReference = string|number;
26
+ type RowReference = string|number|null;
27
27
 
28
28
  type Stats = {
29
- field?: string,
30
- label?: boolean,
31
- count?: number,
32
- sum?: number,
33
- average?: number,
34
- min?: number,
35
- max?: number
29
+ field?: string|null,
30
+ label?: boolean|null,
31
+ count?: number|null,
32
+ sum?: number|null,
33
+ average?: number|null,
34
+ min?: number|null,
35
+ max?: number|null
36
36
  };
37
37
 
38
38
  }
39
39
 
40
40
  declare class StatisticsRowPlugin extends GridPlugin {
41
41
 
42
- constructor(options?: StatisticsRowPlugin.Options);
42
+ constructor(options?: StatisticsRowPlugin.Options|null);
43
43
 
44
44
  public getName(): string;
45
45
 
@@ -51,15 +51,15 @@ declare class StatisticsRowPlugin extends GridPlugin {
51
51
 
52
52
  public getConfigObject(gridOptions?: any): any;
53
53
 
54
- public setStatisticsRows(rows: (StatisticsRowPlugin.RowOptions)[]): void;
54
+ public setStatisticsRows(rows: (StatisticsRowPlugin.RowOptions)[]|null): void;
55
55
 
56
- public getStatisticsRows(): (StatisticsRowPlugin.RowOptions)[];
56
+ public getStatisticsRows(): (StatisticsRowPlugin.RowOptions)[]|null;
57
57
 
58
- public setStatisticsRow(rowRef: StatisticsRowPlugin.RowReference, options: StatisticsRowPlugin.RowOptions): boolean;
58
+ public setStatisticsRow(rowRef: StatisticsRowPlugin.RowReference|null, options: StatisticsRowPlugin.RowOptions|null): boolean;
59
59
 
60
- public addStatisticsRow(options: StatisticsRowPlugin.RowOptions): void;
60
+ public addStatisticsRow(options: StatisticsRowPlugin.RowOptions|null): void;
61
61
 
62
- public removeStatisticsRow(rowRef: StatisticsRowPlugin.RowReference): void;
62
+ public removeStatisticsRow(rowRef: StatisticsRowPlugin.RowReference|null): void;
63
63
 
64
64
  }
65
65
 
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.92",
2
+ "tr-grid-util": "1.3.95",
3
3
  "@grid/column-dragging": "1.0.11",
4
4
  "@grid/row-segmenting": "1.0.23",
5
5
  "@grid/statistics-row": "1.0.14",
@@ -9,10 +9,10 @@
9
9
  "tr-grid-checkbox": "1.0.60",
10
10
  "tr-grid-column-fitter": "1.0.39",
11
11
  "tr-grid-column-formatting": "0.9.34",
12
- "tr-grid-column-grouping": "1.0.46",
12
+ "tr-grid-column-grouping": "1.0.47",
13
13
  "tr-grid-column-resizing": "1.0.28",
14
14
  "tr-grid-column-selection": "1.0.27",
15
- "tr-grid-column-stack": "1.0.54",
15
+ "tr-grid-column-stack": "1.0.55",
16
16
  "tr-grid-conditional-coloring": "1.0.58",
17
17
  "tr-grid-content-wrap": "1.0.20",
18
18
  "tr-grid-contextmenu": "1.0.38",
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.32"
69
+ "version": "6.0.33"
70
70
  }