@refinitiv-ui/efx-grid 6.0.126 → 6.0.128

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.
@@ -7,30 +7,12 @@ declare class DataCache extends EventDispatcher {
7
7
 
8
8
  public dispose(): void;
9
9
 
10
- public setSubscriptions(subs: any): void;
11
-
12
- public getSubscriptions(): any;
13
-
14
- public addSubscription(sub: any, opt_primaryRic?: string|null, opt_values?: any): void;
15
-
16
- public removeSubscription(sub: any): void;
17
-
18
- public startAllSubscriptions(): void;
19
-
20
- public stopAllSubscriptions(): void;
21
-
22
- public getSubscription(sub_id: string): any;
23
-
24
- public getPrimaryRic(sub_id: string): string;
25
-
26
10
  public clearAllData(opt_suppressEvent?: boolean|null): void;
27
11
 
28
12
  public clearColumnData(colId: (string)[]|string|null, opt_suppressEvent?: boolean|null): void;
29
13
 
30
14
  public getData(rid: string, cid: string): any;
31
15
 
32
- public getAllRics(): { [key: string]: any }|null;
33
-
34
16
  public getAllRowIds(): (string)[]|null;
35
17
 
36
18
  public hasRowId(rid: string): boolean;
@@ -1,8 +1,7 @@
1
1
  import Ext from "../../../tr-grid-util/es6/Ext.js";
2
2
  import EventDispatcher from "../grid/event/EventDispatcher.js";
3
3
 
4
- /**
5
- * Trigger when data within the table has been changed
4
+ /** @description Trigger when data within the table has been changed
6
5
  * @event DataCache#dataChanged
7
6
  * @property {boolean} globalChange Indicates a big change. User should expect all data has been change
8
7
  * @property {string} type Type of changes. Possible values are "inserted", "removed", "updated", and undefined
@@ -10,32 +9,34 @@ import EventDispatcher from "../grid/event/EventDispatcher.js";
10
9
  * @property {Object.<string, *>} rowData Column values of the changed row in JSON object format
11
10
  */
12
11
 
13
- /**
14
- * Trigger before DataCache#dataChanged. Perform any data update during the event will NOT cause more dataChanged events
12
+ /** @description Trigger before DataCache#dataChanged. Perform any data update during the event will NOT cause more dataChanged events
15
13
  * @event DataCache#dataComposed
16
14
  */
17
15
 
18
- /**
16
+ /** Class for caching data and firing event when data is changed
19
17
  * @constructor
20
18
  * @extends {EventDispatcher}
21
19
  */
22
20
  let DataCache = function () {
23
- let _t = this;
24
-
25
- _t._rows = {};
26
- _t._subs = {};
27
- _t._onInsert = _t._onInsert.bind(_t);
28
- _t._onUpdate = _t._onUpdate.bind(_t);
29
- _t._onDelete = _t._onDelete.bind(_t);
30
- _t._onQ2DataChanged = _t._onQ2DataChanged.bind(_t);
31
- _t._onQ2SubAdded = _t._onQ2SubAdded.bind(_t);
32
- _t._onQ2SubRemoved = _t._onQ2SubRemoved.bind(_t);
33
-
34
- _t._addEvent("dataComposed");
35
- _t._addEvent("dataChanged");
21
+ this._rows = {};
22
+
23
+ this._addEvent("dataComposed");
24
+ this._addEvent("dataChanged");
36
25
  };
37
26
  Ext.inherits(DataCache, EventDispatcher);
38
27
 
28
+ /** @protected
29
+ * @ignore
30
+ * @type {!Object.<string, Object>}
31
+ */
32
+ DataCache.prototype._rows;
33
+
34
+ /** @protected
35
+ * @ignore
36
+ * @type {boolean}
37
+ */
38
+ DataCache.prototype._composing = false;
39
+
39
40
  //#region Public
40
41
  /**
41
42
  * @public
@@ -43,162 +44,64 @@ Ext.inherits(DataCache, EventDispatcher);
43
44
  DataCache.prototype.dispose = function () {
44
45
  this.unlistenAll();
45
46
  this.clearAllData(true);
46
- this._quotes2 = null;
47
47
  };
48
48
 
49
- /**
50
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility. This API supports only Quotes2's "Subscriptions" object.
49
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
51
50
  * @public
52
- * @param {Object} subs Subscriptions object from JET.Quotes2
51
+ * @ignore
53
52
  */
54
- DataCache.prototype.setSubscriptions = function (subs) {
55
- if (this._quotes2) {
56
- this._quotes2["removeEventListener"]("dataChanged", this._onQ2DataChanged);
57
- this._quotes2["removeEventListener"]("subscriptionAdded", this._onQ2SubAdded);
58
- this._quotes2["removeEventListener"]("subscriptionRemoved", this._onQ2SubRemoved);
59
- }
60
-
61
- this._quotes2 = subs;
62
-
63
- if (this._quotes2) {
64
- this._quotes2["addEventListener"]("dataChanged", this._onQ2DataChanged);
65
- this._quotes2["addEventListener"]("subscriptionAdded", this._onQ2SubAdded);
66
- this._quotes2["addEventListener"]("subscriptionRemoved", this._onQ2SubRemoved);
67
- }
68
- };
53
+ DataCache.prototype.setSubscriptions = function () {};
69
54
 
70
- /**
71
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.This API supports only Quotes2's
72
- * "Subscriptions" object.
55
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
73
56
  * @public
74
- * @return {Object} subs Subscriptions object from JET.Quotes2
57
+ * @ignore
58
+ * @return {Object} Always returns null
75
59
  */
76
- DataCache.prototype.getSubscriptions = function () {
77
- return this._quotes2;
78
- };
60
+ DataCache.prototype.getSubscriptions = function () { return null; };
79
61
 
80
- /**
81
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
62
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
82
63
  * @public
83
- * @param {Object} sub Subscription object from JET.Quote
84
- * @param {string=} opt_primaryRic Main RIC for creating Id or recalling subscription. This is because subscription
85
- * object does not provide a way to access its data
86
- * @param {Object=} opt_values Initial values
64
+ * @ignore
87
65
  */
88
- DataCache.prototype.addSubscription = function (sub, opt_primaryRic, opt_values) {
89
- if (this.getSubscription(sub["id"])) {
90
- return;
91
- }
92
-
93
- let internalSub = {"s": sub, "rics": {}};
94
-
95
- this._subs[sub["id"]] = internalSub;
66
+ DataCache.prototype.addSubscription = function () {};
96
67
 
97
- if (!this._quotes2) {
98
- sub["onNewRow"](this._onInsert);
99
- sub["onUpdate"](this._onUpdate);
100
- sub["onRemoveRow"](this._onDelete);
101
- }
102
-
103
- if (opt_primaryRic) {
104
- internalSub["primary"] = opt_primaryRic;
105
-
106
- if (!opt_values) {
107
- opt_values = {};
108
- }
109
-
110
- this._onInsert(sub, opt_primaryRic, opt_values);
111
- }
112
- };
113
-
114
- /**
115
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
68
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
116
69
  * @public
117
- * @param {Object} sub Subscription object from JET.Quote
70
+ * @ignore
118
71
  */
119
- DataCache.prototype.removeSubscription = function (sub) { // All RICs associated to the subscription are removed
120
- let subId = sub["id"];
121
-
122
- if (!sub || !this._subs[subId]) {
123
- return;
124
- }
125
-
126
- if (!this._quotes2) {
127
- sub["stop"]();
128
- }
129
-
130
- let rics = this._subs[subId]["rics"];
131
-
132
- for (let ric in rics) {
133
- this.setRowData(subId + ric, null); // No subscription attached
134
- }
135
-
136
- delete this._subs[subId];
137
- };
72
+ DataCache.prototype.removeSubscription = function () {};
138
73
 
139
- /**
140
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
74
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
141
75
  * @public
76
+ * @ignore
142
77
  */
143
- DataCache.prototype.startAllSubscriptions = function () {
144
- if (this._quotes2) {
145
- this._quotes2["start"]();
146
- } else {
147
- for (let key in this._subs) {
148
- this._subs[key]["s"]["start"]();
149
- }
150
- }
151
- };
78
+ DataCache.prototype.startAllSubscriptions = function () {};
152
79
 
153
- /**
154
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
80
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
155
81
  * @public
82
+ * @ignore
156
83
  */
157
- DataCache.prototype.stopAllSubscriptions = function () {
158
- if (this._quotes2) {
159
- this._quotes2["stop"]();
160
- } else {
161
- for (let key in this._subs) {
162
- this._subs[key]["s"]["stop"]();
163
- }
164
- }
165
- };
84
+ DataCache.prototype.stopAllSubscriptions = function () {};
166
85
 
167
- /**
86
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
168
87
  * @public
169
- * @param {string} sub_id
170
- * @return {Object} Subscription object from JET.Quote
88
+ * @ignore
89
+ * @return {Object} Always returns null
171
90
  */
172
- DataCache.prototype.getSubscription = function (sub_id) {
173
- return (this._subs[sub_id]) ? this._subs[sub_id]["s"] : null;
174
- };
91
+ DataCache.prototype.getSubscription = function () { return null; };
175
92
 
176
- /**
93
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
177
94
  * @public
178
- * @param {string} sub_id
179
- * @return {string} ric that has been input when calling addSubscription
95
+ * @ignore
96
+ * @return {string} Always returns empty string
180
97
  */
181
- DataCache.prototype.getPrimaryRic = function (sub_id) {
182
- let subDef = this._subs[sub_id];
183
- if (subDef) {
184
- return subDef["primary"];
185
- }
186
- return "";
187
- };
98
+ DataCache.prototype.getPrimaryRic = function () { return ""; };
188
99
 
189
- /**
190
- * @public
100
+ /** @public
191
101
  * @param {boolean=} opt_suppressEvent
192
102
  * @fires DataCache#dataChanged
193
103
  */
194
- DataCache.prototype.clearAllData = function (opt_suppressEvent) { // All subscriptions are also removed
195
- if (this._quotes2) {
196
- this._quotes2["removeAllSubscriptions"]();
197
- } else {
198
- this.stopAllSubscriptions();
199
- }
200
-
201
- this._subs = {};
104
+ DataCache.prototype.clearAllData = function (opt_suppressEvent) {
202
105
  this._rows = {};
203
106
 
204
107
  if (!opt_suppressEvent) {
@@ -242,28 +145,12 @@ DataCache.prototype.getData = function (rid, cid) {
242
145
  return (row) ? row[cid] : null;
243
146
  };
244
147
 
245
- /**
246
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
148
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
247
149
  * @public
248
- * @return {Object.<string, Array.<string>>} Map of Array of subscription object
150
+ * @ignore
151
+ * @return {Object.<string, Array.<string>>} Always returns null
249
152
  */
250
- DataCache.prototype.getAllRics = function () { // Slow
251
- let ricMap = {};
252
-
253
- for (let subId in this._subs) {
254
- let rics = this._subs[subId]["rics"];
255
-
256
- for (let ric in rics) {
257
- if (!ricMap[ric]) {
258
- ricMap[ric] = [];
259
- }
260
-
261
- ricMap[ric].push(subId);
262
- }
263
- }
264
-
265
- return ricMap; // No duplicate ric
266
- };
153
+ DataCache.prototype.getAllRics = function () { return null; };
267
154
 
268
155
  /**
269
156
  * @public
@@ -462,27 +349,22 @@ DataCache.prototype.cloneRowData = function (rid) {
462
349
  /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
463
350
  * @public
464
351
  * @ignore
465
- * @suppress {checkTypes}
466
352
  */
467
353
  DataCache.prototype.addStaticFields = function () {};
468
354
 
469
- /**
470
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
355
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
471
356
  * @public
472
357
  * @ignore
473
- * @suppress {checkTypes}
474
358
  */
475
359
  DataCache.prototype.removeStaticFields = function () {};
476
360
 
477
- /**
478
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
361
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
479
362
  * @public
480
363
  * @ignore
481
364
  */
482
365
  DataCache.prototype.resetStaticFields = function () {};
483
366
 
484
- /**
485
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
367
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
486
368
  * @public
487
369
  * @ignore
488
370
  */
@@ -523,40 +405,29 @@ DataCache.prototype.log = function (opt_options) {
523
405
  console.table(this.dump(opt_options));
524
406
  };
525
407
 
526
- //#region ADC
527
408
  /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
528
409
  * @public
529
410
  * @ignore
530
- * @param {string} userId
531
- * @param {string} productId
532
- * @param {string} url
533
- * @param {string=} opt_lang
534
411
  */
535
- DataCache.prototype.setDataCloudSettings = function (userId, productId, url, opt_lang) {};
412
+ DataCache.prototype.setDataCloudSettings = function () {};
536
413
 
537
- /**
538
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
414
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
539
415
  * @public
540
416
  * @ignore
541
417
  */
542
418
  DataCache.prototype.getDataCloudFields = function () {};
543
419
 
544
- /**
545
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
420
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
546
421
  * @public
547
422
  * @ignore
548
- * @param {Array.<string>|string} fields
549
423
  */
550
- DataCache.prototype.addDataCloudFields = function (fields) {};
424
+ DataCache.prototype.addDataCloudFields = function () {};
551
425
 
552
- /**
553
- * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
426
+ /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
554
427
  * @public
555
428
  * @ignore
556
- * @param {string} field
557
429
  */
558
- DataCache.prototype.removeDataCloudField = function (field) {};
559
- //#endregion ADC
430
+ DataCache.prototype.removeDataCloudField = function () {};
560
431
  //#endregion Public
561
432
 
562
433
  /**
@@ -693,161 +564,5 @@ DataCache.constructTable = function (dataset, opt_options, opt_rowIds) {
693
564
  };
694
565
 
695
566
 
696
- //#region Private
697
- /**
698
- * For Quotes2 only
699
- * @private
700
- * @param {string} subId
701
- * @param {string} ric
702
- * @param {Object.<string, *>} values
703
- */
704
- DataCache.prototype._insertRic = function (subId, ric, values) {
705
- // HACK: Some chain may have 0# symbol in there chain index (e.g. 0#CL:)
706
- ric = ric.replace("0#", "");
707
-
708
- let rid = subId + ric;
709
-
710
- let rowData = this.getRowData(rid);
711
- if (!rowData) { // Ensure that we have subscription id and ric from Quotes2
712
- let tmp = values;
713
-
714
- values = {}; // Clone a new object for duplicated ric
715
-
716
- for (let key in tmp) { // Slow
717
- values[key] = tmp[key];
718
- }
719
-
720
- values["SUB_ID"] = subId;
721
- values["RIC"] = ric;
722
- } else {
723
- let rowDef = rowData["ROW_DEF"];
724
- if(rowDef && rowDef.isChain()){
725
- values["SUB_ID"] = subId;
726
- }
727
- }
728
-
729
- this.setRowData(rid, values);
730
- };
731
-
732
- /**
733
- * @private
734
- * @param {Object} e
735
- */
736
- DataCache.prototype._onQ2DataChanged = function (e) {
737
- let subId = e["subId"];
738
- let ric = e["ric"];
739
- let values = /** @type{Object.<string, *>} */(e["values"]);
740
-
741
- if (values) {
742
- this._insertRic(subId, ric, values);
743
- } else { // Remove ric
744
- delete this._subs[subId]["rics"][ric];
745
-
746
- this.setRowData(subId + ric, null);
747
- }
748
- };
749
-
750
- /**
751
- * @private
752
- * @param {Object} e
753
- */
754
- DataCache.prototype._onQ2SubAdded = function (e) {
755
- let subs = e["subs"];
756
- let len = subs.length;
757
-
758
- for (let i = 0; i < len; ++i) {
759
- let sub = subs[i];
760
-
761
- // chain subId fires twice, one with "_ci_" and one without "_ci_"
762
- // the subId with "_ci_" should be ignore
763
- if(sub["id"].indexOf("_ci_") < 0){
764
- this.addSubscription(sub, sub["ric"]);
765
- }
766
- }
767
- };
768
-
769
- /**
770
- * @private
771
- * @param {Object} e
772
- */
773
- DataCache.prototype._onQ2SubRemoved = function (e) {
774
- let subs = e["subs"];
775
- let len = subs.length;
776
-
777
- for (let i = 0; i < len; ++i) {
778
- let sub = subs[i];
779
-
780
- // chain subId fires twice, one with "_ci_" and one without "_ci_"
781
- // the subId with "_ci_" should be ignore
782
- if(sub["id"].indexOf("_ci_") < 0){
783
- this.removeSubscription(sub);
784
- }
785
- }
786
- };
787
-
788
- /**
789
- * @private
790
- * @param {Object} sub Subscription object from JET.Quote
791
- * @param {string} ric
792
- * @param {Object.<string, *>} values
793
- */
794
- DataCache.prototype._onInsert = function (sub, ric, values/*, rowN*/) {
795
- let subId = sub["id"];
796
-
797
- if (this._quotes2) {
798
- this._insertRic(subId, ric, values);
799
- } else {
800
- this.setRowData(subId + ric, values, {"subscription": sub, "ric": ric});
801
- }
802
- };
803
-
804
- /**
805
- * @private
806
- * @function
807
- */
808
- DataCache.prototype._onUpdate = DataCache.prototype._onInsert;
809
-
810
- /**
811
- * This is a legacy code and should be deprecated
812
- * @private
813
- * @param {Object} sub Subscription object from JET.Quote
814
- * @param {string} ric
815
- * @param {Array.<string, *>} values
816
- */
817
- DataCache.prototype._onDelete = function (sub, ric, values/*, rowN*/) {
818
- delete this._subs[sub["id"]]["rics"][ric];
819
-
820
- // We cannot cache event arguments because user may want to collect all the updates
821
- this.setRowData(sub["id"] + ric, null, {"subscription": sub, "ric": ric});
822
- };
823
-
824
- /** @protected
825
- * @ignore
826
- * @type {!Object.<string, Object>}
827
- */
828
- DataCache.prototype._rows;
829
-
830
- /**
831
- * @private
832
- * @type {!Object.<string, Object>}
833
- */
834
- DataCache.prototype._subs;
835
-
836
- /**
837
- * @private
838
- * @type {Object}
839
- */
840
- DataCache.prototype._quotes2 = null;
841
-
842
- /** @protected
843
- * @ignore
844
- * @type {boolean}
845
- */
846
- DataCache.prototype._composing = false;
847
-
848
- //#endregion Private
849
-
850
- DataCache._proto = DataCache.prototype;
851
-
852
567
  export default DataCache;
853
568
  export { DataCache };
@@ -621,7 +621,7 @@ Core.prototype._hasPendingRowChange = false;
621
621
  * @return {string}
622
622
  */
623
623
  Core.getVersion = function () {
624
- return "5.1.124";
624
+ return "5.1.125";
625
625
  };
626
626
  /** {@link ElementWrapper#dispose}
627
627
  * @override
package/lib/grid/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import {Grid} from "./lib/efx-grid.js";
2
2
  export {Grid}
3
- window.EFX_GRID = { version: "6.0.126" };
3
+ window.EFX_GRID = { version: "6.0.128" };