@refinitiv-ui/efx-grid 6.0.35 → 6.0.37

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 (40) hide show
  1. package/lib/core/dist/core.css +1 -1
  2. package/lib/core/dist/core.js +150 -6
  3. package/lib/core/dist/core.min.js +1 -1
  4. package/lib/core/es6/data/DataCache.js +20 -1
  5. package/lib/core/es6/grid/Core.js +25 -2
  6. package/lib/core/es6/grid/ILayoutGrid.js +4 -0
  7. package/lib/core/es6/grid/LayoutGrid.d.ts +4 -0
  8. package/lib/core/es6/grid/LayoutGrid.js +95 -3
  9. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +6 -0
  10. package/lib/core/es6/tr-grid-theme.js +1 -1
  11. package/lib/grid/index.js +1 -1
  12. package/lib/grid/themes/base.less +1 -0
  13. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  14. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  15. package/lib/grid/themes/halo/efx-grid.less +2 -0
  16. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  17. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  18. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  19. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  20. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  21. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  22. package/lib/rt-grid/dist/rt-grid.js +302 -107
  23. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  24. package/lib/rt-grid/es6/FieldDefinition.js +0 -41
  25. package/lib/rt-grid/es6/Grid.js +4 -5
  26. package/lib/rt-grid/es6/RowDefinition.d.ts +2 -2
  27. package/lib/rt-grid/es6/RowDefinition.js +102 -52
  28. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +1 -0
  29. package/lib/tr-grid-column-stack/es6/ColumnStack.js +579 -607
  30. package/lib/tr-grid-range-bar/es6/RangeBar.d.ts +4 -1
  31. package/lib/tr-grid-range-bar/es6/RangeBar.js +99 -39
  32. package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +7 -1
  33. package/lib/tr-grid-util/es6/GroupDefinitions.js +39 -3
  34. package/lib/tr-grid-util/es6/jet/MockQuotes2.js +7 -0
  35. package/lib/types/es6/ColumnStack.d.ts +1 -0
  36. package/lib/types/es6/Core/grid/Core.d.ts +12 -0
  37. package/lib/types/es6/Core/grid/LayoutGrid.d.ts +4 -0
  38. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -2
  39. package/lib/versions.json +3 -3
  40. package/package.json +1 -1
@@ -14,40 +14,6 @@ var SYNAPSE_URL =
14
14
  + 'hits=1' // search only 1 result
15
15
  + '&profile=' + encodeURIComponent('Field Selector');
16
16
 
17
- /** @function
18
- * @private
19
- * @param {Object} e
20
- */
21
- function xRicNameRenderer(e) {
22
- e.cell.setContent(e.rowDef.getDisplayText());
23
- }
24
- /** @function
25
- * @private
26
- * @param {RowDefinition} rowA
27
- * @param {RowDefinition} rowB
28
- * @param {number} order
29
- * @returns {number}
30
- */
31
- function xRicNameSorter(rowA, rowB, order) {
32
- var A = rowA.getDisplayText();
33
- var B = rowB.getDisplayText();
34
- if(A === B) {
35
- return 0;
36
- }
37
- if(!A) {
38
- return 1;
39
- }
40
- if(!B) {
41
- return -1;
42
- }
43
- if(A < B) {
44
- return -order;
45
- }
46
-
47
- return order;
48
- }
49
-
50
-
51
17
  /* @namespace */
52
18
  var FieldDefinition = {};
53
19
 
@@ -55,13 +21,6 @@ var FieldDefinition = {};
55
21
  * @private
56
22
  */
57
23
  FieldDefinition._defs = {
58
- "X_RIC_NAME": {
59
- name: "RIC",
60
- IsRealtimeField: false,
61
- width: 100,
62
- binding: xRicNameRenderer,
63
- sortLogic: xRicNameSorter
64
- },
65
24
  "CF_NAME": {
66
25
  name: "Name",
67
26
  rank: 2800003,
@@ -326,6 +326,7 @@ var Grid = function(placeholder, config) {
326
326
  t._dc = new DataCache();
327
327
  t._dc.listen("dataChanged", t._onDataChanged);
328
328
  t._dc.listen("dataComposed", t._onDataComposed);
329
+ t._dc.addStaticFields([ROW_DEF, SUB_ID]); // Static fields are deprecated, set fields to be ignore during clone in DataCache
329
330
 
330
331
  t._dt = new DataTable();
331
332
  t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
@@ -1526,8 +1527,11 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
1526
1527
  if(colDef.getChildren()) { // Parent time series field doesn't provide hidden property
1527
1528
  colConfig["hidden"] = false;
1528
1529
  }
1530
+
1531
+ this._grid.startBatch("reset");
1529
1532
  this.insertColumn(colConfig, colIndex);
1530
1533
  this.removeColumn(colIndex + 1); // remove existing column after insert
1534
+ this._grid.stopBatch("reset");
1531
1535
  };
1532
1536
 
1533
1537
  /** to update column name when field info is loaded
@@ -1788,11 +1792,6 @@ Grid.prototype._onColumnAdded = function(e) {
1788
1792
  this._grid.enableColumnClass(idx, classes[i]);
1789
1793
  }
1790
1794
  var colField = colDef.getField();
1791
- if (!colDef.isRealTimeField()) {
1792
- if(this._dc) {
1793
- this._dc.addStaticFields([colField]);
1794
- }
1795
- }
1796
1795
  this._grid.setDataColumnName(idx, ROW_DEF); // This make ColumnDefinition renderer work
1797
1796
  var fields = colDef.getAllFields();
1798
1797
  var referrer = colDef.getId();
@@ -37,7 +37,7 @@ declare class RowDefinition {
37
37
 
38
38
  public initialize(rowOptions?: RowDefinition.Options|null): void;
39
39
 
40
- public setContent(userInput: string, permId?: string|null): boolean;
40
+ public setContent(userInput: string, permId?: string|null, asChain?: boolean|null, expanded?: boolean|null, realTime?: boolean|null): boolean;
41
41
 
42
42
  public getRowId(): string;
43
43
 
@@ -143,7 +143,7 @@ declare const ROW_DEF: string;
143
143
 
144
144
  declare const ROW_TYPES: RowDefinition.RowTypes;
145
145
 
146
- declare function rowData(userInput: string, permId?: string|null): boolean;
146
+ declare function rowData(userInput: string, permId?: string|null, asChain?: boolean|null, expanded?: boolean|null, realTime?: boolean|null): boolean;
147
147
 
148
148
  export {RowDefinition, ROW_DEF, ROW_TYPES};
149
149
  export default RowDefinition;
@@ -12,9 +12,10 @@ import { DataTable } from "../../core/es6/data/DataTable.js";
12
12
  * @property {Array.<string>=} fields=null Field that corresponds to the given static values
13
13
  * @property {boolean=} asChain=false The given ric will be treated as a chain
14
14
  * @property {string=} chainRic="" RIC to be used for chain request (overiding ric property)
15
- * @property {boolean=} collapsed=false Chain is expanded by default
15
+ * @property {boolean=} collapsed=true Chain is collapsed by default
16
16
  * @property {(string|null)=} label=null
17
17
  * @property {boolean=} hidden=true When this row is hidden
18
+ * @pro // realTime
18
19
  */
19
20
 
20
21
  /** @typedef {Object} RowDefinition~RowTypes
@@ -90,18 +91,18 @@ RowDefinition.prototype._ric = ""; // Contains no 0#
90
91
  * @private
91
92
  */
92
93
  RowDefinition.prototype._permId = "";
93
- /** @type {string}
94
- * @private
95
- */
96
- RowDefinition.prototype._displayText = "";
97
94
  /** @type {string|null}
98
95
  * @private
99
96
  */
100
97
  RowDefinition.prototype._label = null; // Label overrides _ric and _displayText
98
+ /** @type {boolean|null}
99
+ * @private
100
+ */
101
+ RowDefinition.prototype._isChain = null;
101
102
  /** @type {boolean}
102
103
  * @private
103
104
  */
104
- RowDefinition.prototype._isChain = false;
105
+ RowDefinition.prototype._realTime = true;
105
106
 
106
107
  /** @type {string}
107
108
  * @private
@@ -125,10 +126,10 @@ RowDefinition.prototype._view = null;
125
126
  */
126
127
  RowDefinition.prototype._subId = "";
127
128
 
128
- /** @type {boolean}
129
+ /** @type {boolean|null}
129
130
  * @private
130
131
  */
131
- RowDefinition.prototype._expanded = false;
132
+ RowDefinition.prototype._expanded = null;
132
133
  /** @type {boolean}
133
134
  * @private
134
135
  */
@@ -216,18 +217,19 @@ RowDefinition.prototype.initialize = function(rowOptions) {
216
217
  return;
217
218
  }
218
219
 
219
- var val = rowOptions["ric"];
220
+ var val = rowOptions["permId"];
220
221
  if(val != null) {
221
- this._ric = val;
222
+ this._permId = val;
222
223
  }
223
- val = rowOptions["permId"];
224
+ val = rowOptions["ric"];
224
225
  if(val != null) {
225
- this._permId = val;
226
+ this._ric = val;
226
227
  }
227
- if(this._ric || this._permId){
228
- this.setContent(this._ric, this._permId); // this._dataId is modified
228
+ val = rowOptions["label"];
229
+ // eslint-disable-next-line no-undefined
230
+ if(val !== undefined) { // Empty string and null are allowed
231
+ this._label = val;
229
232
  }
230
-
231
233
  val = rowOptions["chainRic"];
232
234
  if(val != null) {
233
235
  this._chainRic = val;
@@ -239,26 +241,40 @@ RowDefinition.prototype.initialize = function(rowOptions) {
239
241
  }
240
242
 
241
243
  val = rowOptions["asChain"];
242
- if(val) {
243
- this._isChain = true;
244
- this._expanded = !rowOptions["collapsed"];
245
- } else if(this._isChain) {
246
- var collapsed = rowOptions["collapsed"];
247
- if(collapsed != null) {
248
- this._expanded = !collapsed;
249
- }
244
+ if(val !== null) {
245
+ this._isChain = val;
250
246
  }
251
247
 
252
- val = rowOptions["label"];
253
- // eslint-disable-next-line no-undefined
254
- if(val !== undefined) { // Empty string and null are allowed
255
- this._label = val;
248
+ val = rowOptions["realTime"];
249
+ if(val != null) {
250
+ this._realTime = val;
256
251
  }
257
252
 
253
+ val = rowOptions["collapsed"];
254
+ if(val != null){
255
+ this._expanded = !val;
256
+ }
258
257
  val = rowOptions["keepModel"];
259
258
  if(val) {
260
259
  this._userModel = rowOptions;
261
260
  }
261
+
262
+ var expanded = this._expanded;
263
+ var symbol = this._ric || this._chainRic;
264
+ var asChain = rowOptions["asChain"] || !!this._chainRic;
265
+ if(this._ric && this._ric.indexOf("0#") >= 0){
266
+ asChain = true;
267
+ expanded = true;
268
+ }
269
+ if(rowOptions["asChain"] === false){
270
+ asChain = false;
271
+ }
272
+ if(rowOptions["collapsed"] === true){
273
+ expanded = false;
274
+ }
275
+ if(symbol || this._permId){
276
+ this.setContent(symbol, this._permId, asChain, expanded); // this._dataId is modified
277
+ }
262
278
  };
263
279
  /** @private
264
280
  * @param {!Object} rowOptions
@@ -268,7 +284,6 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
268
284
  var parentDef = /** @type{RowDefinition} */(rowOptions["parent"]);
269
285
  if(this.setParent(parentDef)) {
270
286
  this._dataId = /** @type{string} */(rowOptions["dataId"]); // Constituent will have the same subId as its parent but with different ric
271
- this._displayText = this._ric = /** @type{string} */(rowOptions["ric"]);
272
287
 
273
288
  this._dc = parentDef._dc; // Parent chain must have data cache
274
289
  if(this._dc) {
@@ -287,9 +302,12 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
287
302
  /** @public
288
303
  * @param {string} userInput RIC
289
304
  * @param {string=} permId=null Organization PermId, which use for getting ADC data for private company
305
+ * @param {boolean=} asChain
306
+ * @param {boolean=} expanded
307
+ * @param {boolean=} realTime
290
308
  * @return {boolean} True if there is any change otherwise false
291
309
  */
292
- RowDefinition.prototype.setContent = function(userInput, permId) {
310
+ RowDefinition.prototype.setContent = function(userInput, permId, asChain, expanded) {
293
311
  if(this._autoGenerated) { // AutoGenerated RowDefinition cannot be changed by user input
294
312
  return false;
295
313
  }
@@ -303,10 +321,7 @@ RowDefinition.prototype.setContent = function(userInput, permId) {
303
321
  var dirty = (this._userInput !== userInput);
304
322
  if(this._permId !== permId){
305
323
  this._permId = permId || "";
306
- if(!userInput){
307
- this._displayText = this._permId;
308
- dirty = true;
309
- }
324
+ dirty = true;
310
325
  }
311
326
  if(!dirty) {
312
327
  return false;
@@ -315,34 +330,44 @@ RowDefinition.prototype.setContent = function(userInput, permId) {
315
330
  this.unsubscribeForUpdates();
316
331
  this.resetUpdates(); // Remove all previous data updates because a new content is just entered
317
332
 
333
+ // TODO: handle changing between chain and ric row
318
334
  this._userInput = userInput;
319
335
  if(this._userInput.charAt(0) === "'") { // This is a row header
320
- this._displayText = this._userInput.substr(1);
321
336
  this._ric = this._chainRic = ""; // No ric for realtime request
322
337
  } else {
323
338
  if(this._userInput.indexOf("0#") >= 0) {
324
- this._ric = this._userInput.replace("0#", "");
325
- this._isChain = this._expanded = true; // Only chain can be expanded by 0# TODO: RIC with 0# is not necessarily a chain
326
- this._chainRic = this._userInput;
327
- if(this._view) {
328
- this._view.setSegmentSeparator(this._rowId);
329
- this.expandChain();
339
+ if(asChain === false){
340
+ this._ric = this._userInput;
341
+ } else {
342
+ this._ric = expanded ? this._userInput.replace("0#", "") : this._userInput;
343
+ this._expanded = expanded;
344
+ this._isChain = true; // Only chain can be expanded by 0#
345
+ this._chainRic = this._userInput;
346
+ if(this._view) {
347
+ this._view.setSegmentSeparator(this._rowId);
348
+ this.expandChain();
349
+ }
330
350
  }
331
351
  } else {
332
352
  this._ric = this._userInput;
333
- this._chainRic = "";
353
+ if(asChain){
354
+ this._isChain = true;
355
+ }
334
356
  }
335
- this._displayText = this._ric; // No 0#
336
357
  }
337
358
 
338
359
  this._dataId = this._rowId + this.getSymbol(); // JET/RTK will generate data id to be rowId (given from this rowDef) + ric;
339
360
 
340
- // This will work for runtime ric modification, but not for first initilization.
361
+
341
362
  if(!this.subscribeForUpdates()) {
342
- // Avoid losing the ROW_DEF pointer.
343
- var rowData = {};
344
- rowData[ROW_DEF] = this; // Enable tracking back and updating data
345
- this.setRowData(rowData);
363
+ if(this._dc) {
364
+ // This will work for runtime ric modification, but not for first initilization.
365
+ // Avoid losing the ROW_DEF pointer.
366
+ var rowData = {};
367
+ rowData[ROW_DEF] = this; // Enable tracking back and updating data
368
+ rowData["X_RIC_NAME"] = this.getDisplayText();
369
+ this.setRowData(rowData);
370
+ }
346
371
  }
347
372
  return true;
348
373
  };
@@ -363,6 +388,16 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
363
388
  obj["ric"] = val;
364
389
  }
365
390
 
391
+ // The user passed a single quote (') case
392
+ if(!this._ric && this._userInput.charAt(0) === "'") {
393
+ obj["ric"] = this._userInput;
394
+ }
395
+
396
+ val = this._realTime;
397
+ if(val !== true) {
398
+ obj["realTime"] = val;
399
+ }
400
+
366
401
  val = this._permId;
367
402
  if(val) {
368
403
  obj["permId"] = val;
@@ -384,12 +419,12 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
384
419
  }
385
420
 
386
421
  val = this._isChain;
387
- if(val) {
422
+ if(val != null) {
388
423
  obj["asChain"] = val;
389
424
  }
390
425
 
391
426
  val = this._expanded;
392
- if(val) {
427
+ if(val != null) {
393
428
  obj["collapsed"] = !val;
394
429
  }
395
430
 
@@ -487,6 +522,7 @@ RowDefinition.prototype.setDataSource = function(dataSource) {
487
522
  if(!rowData) {
488
523
  rowData = {};
489
524
  rowData[ROW_DEF] = this; // Enable tracking back and updating data
525
+ rowData["X_RIC_NAME"] = this.getDisplayText();
490
526
  this.setRowData(rowData); // TODO: This will dispatch dataChanged event and caused update to be added, which should not happen
491
527
  }
492
528
 
@@ -629,7 +665,16 @@ RowDefinition.prototype.getDisplayText = function() {
629
665
  if(this._label != null) { // Empty string is allowed
630
666
  return this._label;
631
667
  }
632
- return this._displayText;
668
+
669
+ if(this._ric) {
670
+ return this._ric;
671
+ }
672
+
673
+ if(this._permId) {
674
+ return this._permId;
675
+ }
676
+
677
+ return this._userInput;
633
678
  };
634
679
  /** @public
635
680
  * @return {string|null}
@@ -693,13 +738,18 @@ RowDefinition.prototype.isRealTimeRow = function() {
693
738
  if(!this.getRic()) { // Empty row
694
739
  return false;
695
740
  }
696
- if(this.isRowHeader()) {
741
+ if(!this._realTime) {
697
742
  return false;
698
743
  }
744
+
699
745
  if(this._autoGenerated) { // Constituents in chain are not real-time row
700
746
  return false;
701
747
  }
702
748
 
749
+ if(this.isRowHeader()) {
750
+ return false;
751
+ }
752
+
703
753
  return true;
704
754
  };
705
755
 
@@ -728,7 +778,7 @@ RowDefinition.prototype.subscribeForUpdates = function() {
728
778
  if(prevRowData) {
729
779
  this._dc.setRowData(this._dataId, prevRowData); // TODO: We may need to create a new object instead of prevRowData for data correctness
730
780
  } else {
731
- this._dc.setRowData(this._dataId, {"X_RIC_NAME": this.getSymbol(), "ROW_DEF": this}); // Trigger data update immediately
781
+ this._dc.setRowData(this._dataId, {"X_RIC_NAME": this.getDisplayText(), "ROW_DEF": this}); // Trigger data update immediately
732
782
  }
733
783
  return true;
734
784
  };
@@ -3,6 +3,7 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
3
3
  import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
4
4
  import { Icon } from "../../tr-grid-util/es6/Icon.js";
5
5
  import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
6
+ import { GroupDefinitions } from "../../tr-grid-util/es6/GroupDefinitions.js";
6
7
  import { Dom } from "../../tr-grid-util/es6/Dom.js";
7
8
  import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
8
9
  import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";