@refinitiv-ui/efx-grid 6.0.100 → 6.0.102

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,8 +45,6 @@ declare class DataCache extends EventDispatcher {
45
45
 
46
46
  public setData(rid: string, cid: string, value: any): boolean;
47
47
 
48
- public hasDataCloudData(rid: string): boolean;
49
-
50
48
  public setRowData(rid: string, values?: { [key: string]: any }|null, opt_eventArg?: any): boolean;
51
49
 
52
50
  public cloneRowData(rid: string): any;
@@ -63,19 +61,9 @@ declare class DataCache extends EventDispatcher {
63
61
 
64
62
  public log(opt_options?: any): void;
65
63
 
66
- public setDataCloudSettings(userId: string, productId: string, url: string, opt_lang?: string|null): void;
67
-
68
- public getDataCloudFields(): (string)[]|null;
69
-
70
- public addDataCloudFields(fields: (string)[]|string|null): boolean;
71
-
72
- public removeDataCloudField(field: string): boolean;
73
-
74
64
  }
75
65
 
76
66
  declare function cid(rid: string, cid: string): any;
77
67
 
78
- declare function ricMap(field: string): boolean;
79
-
80
68
  export default DataCache;
81
69
  export { DataCache };
@@ -28,9 +28,6 @@ let DataCache = function () {
28
28
  _t._onInsert = _t._onInsert.bind(_t);
29
29
  _t._onUpdate = _t._onUpdate.bind(_t);
30
30
  _t._onDelete = _t._onDelete.bind(_t);
31
- _t._onBatchRequestADCData = _t._onBatchRequestADCData.bind(_t);
32
- _t._onADCUpdate = _t._onADCUpdate.bind(_t);
33
- _t._onADCError = _t._onADCError.bind(_t);
34
31
  _t._onQ2DataChanged = _t._onQ2DataChanged.bind(_t);
35
32
  _t._onQ2SubAdded = _t._onQ2SubAdded.bind(_t);
36
33
  _t._onQ2SubRemoved = _t._onQ2SubRemoved.bind(_t);
@@ -205,13 +202,6 @@ DataCache.prototype.clearAllData = function (opt_suppressEvent) { // All subscri
205
202
  this._subs = {};
206
203
  this._rows = {};
207
204
 
208
- if (this._adcTimerId >= 0) {
209
- clearTimeout(this._adcTimerId);
210
- this._adcTimerId = -1;
211
- }
212
-
213
- this._adcRicMap = null;
214
-
215
205
  if (!opt_suppressEvent) {
216
206
  this._dispatchDataChange({"globalChange": true});
217
207
  }
@@ -388,30 +378,10 @@ DataCache.prototype.setData = function (rid, cid, value) { // Data changed event
388
378
 
389
379
  /**
390
380
  * @public
381
+ * @ignore
391
382
  * @param {string} rid
392
- * @return {boolean}
393
383
  */
394
- DataCache.prototype.hasDataCloudData = function (rid) {
395
- if (!this._adcFields) {
396
- return false;
397
- }
398
-
399
- let row = this.getRowData(rid);
400
-
401
- if (!row) {
402
- return false;
403
- }
404
-
405
- for (let i = this._adcFields.length; --i >= 0;) {
406
- let data = row[this._adcFields[i]];
407
-
408
- if (data != null) {
409
- return true;
410
- }
411
- }
412
-
413
- return false;
414
- };
384
+ DataCache.prototype.hasDataCloudData = function (rid) {};
415
385
 
416
386
  /**
417
387
  * @public
@@ -587,97 +557,36 @@ DataCache.prototype.log = function (opt_options) {
587
557
  //#region ADC
588
558
  /** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
589
559
  * @public
560
+ * @ignore
590
561
  * @param {string} userId
591
562
  * @param {string} productId
592
563
  * @param {string} url
593
564
  * @param {string=} opt_lang
594
565
  */
595
- DataCache.prototype.setDataCloudSettings = function (userId, productId, url, opt_lang) {
596
- if (userId != null) {
597
- this._userId = userId;
598
- }
599
-
600
- if (productId != null) {
601
- this._productId = productId;
602
- }
603
-
604
- if (url != null) {
605
- this._adcUrl = url;
606
- }
607
-
608
- if (opt_lang) {
609
- this._lang = opt_lang;
610
- }
611
- };
566
+ DataCache.prototype.setDataCloudSettings = function (userId, productId, url, opt_lang) {};
612
567
 
613
568
  /**
614
569
  * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
615
570
  * @public
616
- * @return {Array.<string>}
571
+ * @ignore
617
572
  */
618
- DataCache.prototype.getDataCloudFields = function () {
619
- return this._adcFields; // Return private members
620
- };
573
+ DataCache.prototype.getDataCloudFields = function () {};
621
574
 
622
575
  /**
623
576
  * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
624
577
  * @public
578
+ * @ignore
625
579
  * @param {Array.<string>|string} fields
626
- * @return {boolean} Return true if success, and false otherwise
627
580
  */
628
- DataCache.prototype.addDataCloudFields = function (fields) {
629
- if (!this._adcFields) {
630
- this._adcFields = [];
631
- this._adcRefMap = {};
632
- }
633
-
634
- let newFields = [];
635
-
636
- if (fields instanceof Array) {
637
- for (let i = fields.length; --i >= 0;) {
638
- this._addDataCloudField(fields[i], newFields);
639
- }
640
- } else {
641
- this._addDataCloudField(/** @type {string} */(fields), newFields);
642
- }
643
-
644
- if (newFields.length <= 0) {
645
- return false;
646
- }
647
-
648
- let ricMap = this.getAllRics();
649
-
650
- this._batchRequestDataCloud(ricMap, newFields);
651
-
652
- return true;
653
- };
581
+ DataCache.prototype.addDataCloudFields = function (fields) {};
654
582
 
655
583
  /**
656
584
  * Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
657
585
  * @public
586
+ * @ignore
658
587
  * @param {string} field
659
- * @return {boolean} Return true if success, and false otherwise
660
588
  */
661
- DataCache.prototype.removeDataCloudField = function (field) {
662
- if (!this._adcFields) {
663
- return false;
664
- }
665
-
666
- if (!this._adcRefMap[field]) {
667
- return false;
668
- }
669
-
670
- --this._adcRefMap[field];
671
-
672
- if (!this._adcRefMap[field]) {
673
- let foundAt = this._adcFields.indexOf(field);
674
-
675
- this._adcFields.splice(foundAt, 1);
676
- this.clearColumnData(field);
677
- }
678
-
679
- return true;
680
- };
589
+ DataCache.prototype.removeDataCloudField = function (field) {};
681
590
  //#endregion ADC
682
591
  //#endregion Public
683
592
 
@@ -829,9 +738,6 @@ DataCache.prototype._insertRic = function (subId, ric, values) {
829
738
 
830
739
  let rid = subId + ric;
831
740
 
832
- // We cannot cache event arguments because user may want to collect all the updates
833
- this._onADCForNewRic(subId, ric);
834
-
835
741
  let rowData = this.getRowData(rid);
836
742
  if (!rowData) { // Ensure that we have subscription id and ric from Quotes2
837
743
  let tmp = values;
@@ -926,36 +832,6 @@ DataCache.prototype._onQ2SubRemoved = function (e) {
926
832
  }
927
833
  };
928
834
 
929
- /**
930
- * @private
931
- * @param {string} subId Subscription id
932
- * @param {string} ric
933
- */
934
- DataCache.prototype._onADCForNewRic = function (subId, ric) {
935
- let sub = this._subs[subId];
936
-
937
- if (!sub) {
938
- return;
939
- }
940
-
941
- if (this._adcFields) {
942
- if (!sub["rics"][ric]) { // First time insertion
943
- if (this._adcTimerId < 0) {
944
- this._adcRicMap = {};
945
- this._adcTimerId = setTimeout(this._onBatchRequestADCData, 100);
946
- }
947
-
948
- if (!this._adcRicMap[ric]) {
949
- this._adcRicMap[ric] = [];
950
- }
951
-
952
- this._adcRicMap[ric].push(subId);
953
- }
954
- }
955
-
956
- sub["rics"][ric] = true;
957
- };
958
-
959
835
  /**
960
836
  * @private
961
837
  * @param {string} subId
@@ -989,7 +865,7 @@ DataCache.prototype._onDuplicateRic = function (subId, dupData) {
989
865
  ric = children[i];
990
866
  values = this._cloneRowData(dupSubId, ric, subId);
991
867
 
992
- this._onInsert(sub, ric, values); // TODO: This makes a lot of ADC request
868
+ this._onInsert(sub, ric, values);
993
869
  }
994
870
  }
995
871
  };
@@ -1006,7 +882,6 @@ DataCache.prototype._onInsert = function (sub, ric, values/*, rowN*/) {
1006
882
  if (this._quotes2) {
1007
883
  this._insertRic(subId, ric, values);
1008
884
  } else {
1009
- this._onADCForNewRic(subId, ric);
1010
885
  this.setRowData(subId + ric, values, {"subscription": sub, "ric": ric});
1011
886
  }
1012
887
  };
@@ -1031,191 +906,6 @@ DataCache.prototype._onDelete = function (sub, ric, values/*, rowN*/) {
1031
906
  this.setRowData(sub["id"] + ric, null, {"subscription": sub, "ric": ric});
1032
907
  };
1033
908
 
1034
- /**
1035
- * @private
1036
- * @param {string} field
1037
- * @param {Array.<string>} ary_out
1038
- */
1039
- DataCache.prototype._addDataCloudField = function (field, ary_out) {
1040
- if (!this._adcRefMap[field]) {
1041
- this._adcFields.push(field);
1042
-
1043
- ary_out.push(field);
1044
-
1045
- this._adcRefMap[field] = 1;
1046
- } else {
1047
- ++this._adcRefMap[field];
1048
- }
1049
- };
1050
-
1051
- /**
1052
- * @private
1053
- * @param {Object} e
1054
- * @suppress {missingProperties}
1055
- */
1056
- DataCache.prototype._onADCUpdate = function (e) {
1057
- let xhr = e["currentTarget"]; // XMLHttpRequest
1058
- let resp = null;
1059
-
1060
- try {
1061
- resp = JSON.parse(xhr.responseText);
1062
- // window.console.log("Successfully parse: " + resp.rows);
1063
- } catch (err) {
1064
- return;
1065
- }
1066
-
1067
- if (resp["status"] !== "Ok") {
1068
- return;
1069
- }
1070
-
1071
- let colCount = resp["cols"];
1072
- let rows = resp["rows"];
1073
- let colDefs = rows[0]; // The first row is always the column definition
1074
- let ricIndex = -1;
1075
- let fieldIndices = {};
1076
-
1077
- for (let i = 0; i < colCount; ++i) {
1078
- let colDef = colDefs[i];
1079
-
1080
- if (colDef["i"] === "instrument") {
1081
- ricIndex = i;
1082
- } else if (colDef["r"]) {
1083
- fieldIndices[colDef["r"]] = i;
1084
- }
1085
- }
1086
-
1087
- let rowCount = rows.length;
1088
-
1089
- for (let j = 1; j < rowCount; ++j) { // Start from 1
1090
- let row = rows[j];
1091
- let ric = row[ricIndex];
1092
- let values = {};
1093
-
1094
- for (let field in fieldIndices) {
1095
- let value = row[fieldIndices[field]];
1096
-
1097
- if (value != null) {
1098
- // Data should be merged from the backend.
1099
- // Don't override data with null value.
1100
- // TODO: Merge all the row into one single row
1101
- if (value !== null && value["f"] == null) {
1102
- if (this._quotes2) {
1103
- values[field] = value;
1104
- values[field + "_FORMATTED"] = value;
1105
- } else {
1106
- values[field] = {"formatted": value + "", "raw": value};
1107
- }
1108
- }
1109
- }
1110
- }
1111
-
1112
- let subIds = xhr.ricMap[ric];
1113
-
1114
- if (subIds) { // Only ric within the subscription can be updated
1115
- for (i = subIds.length; --i >= 0;) {
1116
- let subId = subIds[i];
1117
-
1118
- if (this._subs[subId]) { // Only update the existing subscription
1119
- // window.console.log("ADC update " + subId + ric + " with " + JSON.stringify(values));
1120
- this.setRowData(subId + ric, values); // Event is fired
1121
- }
1122
- }
1123
- }
1124
- }
1125
- };
1126
-
1127
- /**
1128
- * @private
1129
- * @param {Object} e
1130
- */
1131
- DataCache.prototype._onADCError = function (e) {
1132
- window.console.log(e);
1133
- };
1134
-
1135
- /**
1136
- * @private
1137
- * @param {Object} e
1138
- */
1139
- DataCache.prototype._onBatchRequestADCData = function (e) {
1140
- if (this._adcTimerId <= 0) {
1141
- return;
1142
- }
1143
-
1144
- this._adcTimerId = -1;
1145
- this._batchRequestDataCloud(this._adcRicMap, this._adcFields);
1146
- this._adcRicMap = null;
1147
- };
1148
-
1149
- /**
1150
- * @private
1151
- * @param {Object.<string, Array.<string>>} ricMap of Array of subscription object
1152
- * @param {Array.<string>} fields
1153
- * @return {XMLHttpRequest}
1154
- */
1155
- DataCache.prototype._batchRequestDataCloud = function (ricMap, fields) {
1156
- if (!this._adcUrl) {
1157
- return null;
1158
- }
1159
-
1160
- let rics = [];
1161
-
1162
- for (let ric in ricMap) {
1163
- rics.push(ric);
1164
- }
1165
-
1166
- // Request data cloud in small multiple batches because the service cannot handle a long request
1167
- while (rics.length > 30) {
1168
- this._requestDataCloud(ricMap, fields, rics.splice(0, 30));
1169
- }
1170
-
1171
- return this._requestDataCloud(ricMap, fields, rics);
1172
- };
1173
-
1174
- /**
1175
- * @private
1176
- * @param {Object.<string, Array.<string>>} ricMap of Array of subscription object
1177
- * @param {Array.<string>} fields
1178
- * @param {Array.<string>} rics
1179
- * @return {XMLHttpRequest}
1180
- */
1181
- DataCache.prototype._requestDataCloud = function (ricMap, fields, rics) { // Small batch
1182
- if (!rics || rics.length <= 0) {
1183
- return null;
1184
- }
1185
-
1186
- if (!fields || fields.length <= 0) {
1187
- return null;
1188
- }
1189
-
1190
- let xhr = new XMLHttpRequest();
1191
-
1192
- xhr.onload = this._onADCUpdate;
1193
- xhr.onerror = this._onADCError;
1194
- xhr.ricMap = ricMap;
1195
-
1196
- xhr.open("POST", this._adcUrl, true);
1197
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
1198
-
1199
- let body = 'formula=' + fields + '&identifiers=' + rics;
1200
-
1201
- // window.console.log("ADC is requested with " + body);
1202
- if (this._productId) {
1203
- body += '&productid=' + this._productId;
1204
- }
1205
-
1206
- if (this._userId) {
1207
- body += '&uuid=' + this._userId;
1208
- }
1209
-
1210
- if (this._lang) {
1211
- body += '&lang=' + this._lang;
1212
- }
1213
-
1214
- xhr.send(body);
1215
-
1216
- return xhr;
1217
- };
1218
-
1219
909
  /**
1220
910
  * @private
1221
911
  * @param {string|Object.<string, *>} obj
@@ -1272,62 +962,12 @@ DataCache.prototype._quotes2 = null;
1272
962
  */
1273
963
  DataCache.prototype._staticFields = null;
1274
964
 
1275
- //#region ADC
1276
- /**
1277
- * @private
1278
- * @type {Array.<string>}
1279
- */
1280
- DataCache.prototype._adcFields = null;
1281
-
1282
- /**
1283
- * @private
1284
- * @type {Object.<string, number>}
1285
- */
1286
- DataCache.prototype._adcRefMap = null;
1287
-
1288
- /**
1289
- * @private
1290
- * @type {number}
1291
- */
1292
- DataCache.prototype._adcTimerId = -1;
1293
-
1294
- /**
1295
- * @private
1296
- * @description ricMap of Array of subscription object
1297
- * @type {Object.<string, Array.<string>>}
1298
- */
1299
- DataCache.prototype._adcRicMap = null;
1300
-
1301
- /**
1302
- * @private
1303
- * @type {string}
1304
- */
1305
- DataCache.prototype._adcUrl = "/datacloud/rest/select";
1306
-
1307
- /**
1308
- * @private
1309
- * @type {string}
1310
- */
1311
- DataCache.prototype._userId = "";
1312
-
1313
- /**
1314
- * @private
1315
- * @type {string}
1316
- */
1317
- DataCache.prototype._productId = "";
1318
-
1319
965
  /** @protected
1320
966
  * @ignore
1321
967
  * @type {boolean}
1322
968
  */
1323
969
  DataCache.prototype._composing = false;
1324
970
 
1325
- /** @protected
1326
- * @ignore
1327
- * @type {string}
1328
- */
1329
- DataCache.prototype._lang = "";
1330
- //#endregion ADC
1331
971
  //#endregion Private
1332
972
 
1333
973
  DataCache._proto = DataCache.prototype;
@@ -2,6 +2,7 @@ import Ext from "../../../tr-grid-util/es6/Ext.js";
2
2
  import EventDispatcher from "../grid/event/EventDispatcher.js";
3
3
  import DataView from "./DataView.js"; // eslint-disable-line
4
4
  import DataTable from "./DataTable.js"; // eslint-disable-line
5
+ import DataCache from "./DataCache.js"; // eslint-disable-line
5
6
  import ColumnStats from "./ColumnStats.js"; // eslint-disable-line
6
7
 
7
8
  declare namespace WrappedView {
@@ -2,6 +2,7 @@ import Ext from "../../../tr-grid-util/es6/Ext.js";
2
2
  import EventDispatcher from "../grid/event/EventDispatcher.js";
3
3
  import DataView from "./DataView.js"; // eslint-disable-line
4
4
  import DataTable from "./DataTable.js"; // eslint-disable-line
5
+ import DataCache from "./DataCache.js"; // eslint-disable-line
5
6
  import ColumnStats from "./ColumnStats.js"; // eslint-disable-line
6
7
 
7
8
  /** @event WrappedView#dataChanged
@@ -574,7 +574,7 @@ Core.prototype._hasPendingRowChange = false;
574
574
  * @return {string}
575
575
  */
576
576
  Core.getVersion = function () {
577
- return "5.1.103";
577
+ return "5.1.105";
578
578
  };
579
579
  /** {@link ElementWrapper#dispose}
580
580
  * @override
@@ -11,6 +11,7 @@ import SelectionList from "./util/SelectionList.js";
11
11
  import ILayoutGrid from "./ILayoutGrid.js";
12
12
  import ElementWrapper from "./components/ElementWrapper.js";
13
13
  import HScrollbar from "./components/HScrollbar.js";
14
+ import CellBoundPainter from "./util/CellBoundPainter.js";
14
15
 
15
16
  declare class LayoutGrid extends ElementWrapper {
16
17
 
@@ -12,6 +12,7 @@ import SelectionList from "./util/SelectionList.js";
12
12
  import ILayoutGrid from "./ILayoutGrid.js";
13
13
  import ElementWrapper from "./components/ElementWrapper.js";
14
14
  import HScrollbar from "./components/HScrollbar.js";
15
+ import CellBoundPainter from "./util/CellBoundPainter.js";
15
16
  /* eslint-enable */
16
17
 
17
18
  //#region Events
@@ -277,7 +278,10 @@ LayoutGrid.prototype._leftColumnSeparator = null;
277
278
  * @private
278
279
  */
279
280
  LayoutGrid.prototype._rightColumnSeparator = null;
280
-
281
+ /** @type {Element}
282
+ * @private
283
+ */
284
+ LayoutGrid.prototype._cellBoundPainter = null;
281
285
  /**
282
286
  * {@link ElementWrapper#dispose}
283
287
  * @override
@@ -302,6 +306,10 @@ LayoutGrid.prototype.dispose = function () {
302
306
  this._ctx = null;
303
307
  this._hscrollbar = null;
304
308
 
309
+ if(this._cellBoundPainter) {
310
+ this._cellBoundPainter.dispose();
311
+ }
312
+
305
313
  this._dispose();
306
314
  };
307
315
  /**
@@ -2272,7 +2280,22 @@ LayoutGrid.prototype.selectCell = function (colIndex, rowIndex, selected) {
2272
2280
  * @param {number} width
2273
2281
  * @param {number} height
2274
2282
  */
2275
- LayoutGrid.prototype.setCellBounds = function (colIndex, rowIndex, width, height) {};
2283
+ LayoutGrid.prototype.setCellBounds = function (colIndex, rowIndex, width, height) {
2284
+ let boundLayer = this._initBoundLayer();
2285
+ let cellBoundPainter = this._cellBoundPainter;
2286
+ if(!cellBoundPainter) {
2287
+ cellBoundPainter = this._cellBoundPainter = new CellBoundPainter({
2288
+ boundLayer: boundLayer,
2289
+ layoutX: this._trackX,
2290
+ layoutY: this._trackY,
2291
+ hscrollbar: this._hscrollbar,
2292
+ calculateColumnBounds: this.calculateColumnBounds.bind(this)
2293
+ });
2294
+ }
2295
+
2296
+ let colCount = this.getColumnCount();
2297
+ cellBoundPainter.setCellBounds(colIndex, rowIndex, width, height, colCount);
2298
+ };
2276
2299
  /** @public
2277
2300
  * @ignore
2278
2301
  * @return {!TrackLayout}
@@ -6,6 +6,7 @@ import ILayoutGrid from "./ILayoutGrid.js";
6
6
  import LayoutGrid from "./LayoutGrid.js";
7
7
  import ElementWrapper from "./components/ElementWrapper.js";
8
8
  import HScrollbar from "./components/HScrollbar.js";
9
+ import CellBoundPainter from "./util/CellBoundPainter.js";
9
10
 
10
11
  declare class VirtualizedLayoutGrid extends ElementWrapper {
11
12