@refinitiv-ui/efx-grid 6.0.27 → 6.0.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/lib/core/dist/core.js +248 -29
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/data/DataTable.d.ts +1 -1
  4. package/lib/core/es6/data/DataTable.js +3 -2
  5. package/lib/core/es6/data/DataView.d.ts +1 -1
  6. package/lib/core/es6/data/DataView.js +3 -2
  7. package/lib/core/es6/data/Segment.d.ts +1 -1
  8. package/lib/core/es6/data/Segment.js +12 -3
  9. package/lib/core/es6/data/SegmentCollection.d.ts +1 -1
  10. package/lib/core/es6/data/SegmentCollection.js +3 -2
  11. package/lib/core/es6/grid/Core.d.ts +17 -3
  12. package/lib/core/es6/grid/Core.js +226 -20
  13. package/lib/core/es6/grid/LayoutGrid.js +1 -0
  14. package/lib/grid/index.js +1 -1
  15. package/lib/row-segmenting/es6/RowSegmenting.js +21 -2
  16. package/lib/rt-grid/dist/rt-grid.js +418 -238
  17. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  18. package/lib/rt-grid/es6/ColumnDefinition.d.ts +2 -2
  19. package/lib/rt-grid/es6/ColumnDefinition.js +71 -70
  20. package/lib/rt-grid/es6/Grid.d.ts +9 -2
  21. package/lib/rt-grid/es6/Grid.js +55 -132
  22. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -3
  23. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +9 -27
  24. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +6 -0
  25. package/lib/tr-grid-column-stack/es6/ColumnStack.js +68 -9
  26. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +30 -23
  27. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +78 -3
  28. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +24 -10
  29. package/lib/tr-grid-util/es6/CellPainter.d.ts +2 -1
  30. package/lib/tr-grid-util/es6/CellPainter.js +53 -15
  31. package/lib/tr-grid-util/es6/GridPlugin.d.ts +6 -0
  32. package/lib/tr-grid-util/es6/GridPlugin.js +67 -0
  33. package/lib/types/es6/ColumnGrouping.d.ts +3 -3
  34. package/lib/types/es6/ColumnStack.d.ts +6 -0
  35. package/lib/types/es6/Core/data/DataTable.d.ts +1 -1
  36. package/lib/types/es6/Core/data/DataView.d.ts +1 -1
  37. package/lib/types/es6/Core/data/Segment.d.ts +1 -1
  38. package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -1
  39. package/lib/types/es6/Core/grid/Core.d.ts +17 -3
  40. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +2 -2
  41. package/lib/types/es6/RealtimeGrid/Grid.d.ts +9 -2
  42. package/lib/utils/index.d.ts +3 -0
  43. package/lib/utils/index.js +3 -0
  44. package/lib/versions.json +6 -6
  45. package/package.json +6 -2
@@ -49,13 +49,13 @@ declare namespace ColumnDefinition {
49
49
 
50
50
  declare class ColumnDefinition {
51
51
 
52
- constructor(columnOption?: ColumnDefinition.Options|string|null, hostGrid?: any);
52
+ constructor(columnOption?: ColumnDefinition.Options|null, hostGrid?: any);
53
53
 
54
54
  public dispose(): void;
55
55
 
56
56
  public _initializeTimeSeriesChild(columnOption?: ColumnDefinition.Options|string|null): void;
57
57
 
58
- public initialize(columnOption?: ColumnDefinition.Options|string|null): void;
58
+ public initialize(columnOption?: ColumnDefinition.Options|null): void;
59
59
 
60
60
  public getId(): string;
61
61
 
@@ -104,14 +104,13 @@ var _toAlignment = function(str) {
104
104
  };
105
105
 
106
106
  /** @constructor
107
- * @param {ColumnDefinition~Options|string=} columnOption
107
+ * @param {ColumnDefinition~Options=} columnOption
108
108
  * @param {*=} hostGrid
109
109
  */
110
110
  var ColumnDefinition = function(columnOption, hostGrid) {
111
111
  this._defaultRenderer = this._defaultRenderer.bind(this);
112
112
  this._customRenderer = this._customRenderer.bind(this);
113
113
 
114
- this._id = "" + ColumnDefinition._runningId++;
115
114
  this._internalRenderer = this._defaultRenderer;
116
115
  this._internalSorter = this._defaultSorter;
117
116
 
@@ -136,16 +135,8 @@ var ColumnDefinition = function(columnOption, hostGrid) {
136
135
 
137
136
  };
138
137
  //#region Private Members
139
- /** @type {string}
140
- * @private
141
- */
142
- ColumnDefinition.prototype._id;
143
- /** @type {number}
144
- * @private
145
- */
146
- ColumnDefinition._runningId = 1;
147
-
148
- /** @type {string}
138
+ /** This is used as a cache for better performance. The actual field is stored in the core
139
+ * @type {string}
149
140
  * @private
150
141
  */
151
142
  ColumnDefinition.prototype._field = "";
@@ -160,11 +151,11 @@ ColumnDefinition.prototype._name = "";
160
151
  /** @type {boolean}
161
152
  * @private
162
153
  */
163
- ColumnDefinition.prototype._isDefaultName = true;
154
+ ColumnDefinition.prototype._defaultName = true;
164
155
  /** @type {boolean}
165
156
  * @private
166
157
  */
167
- ColumnDefinition.prototype._emptyField = false;
158
+ ColumnDefinition.prototype._defaultField = true;
168
159
  /** @type {string|null}
169
160
  * @private
170
161
  */
@@ -263,6 +254,10 @@ ColumnDefinition.prototype._children = null;
263
254
  * @private
264
255
  */
265
256
  ColumnDefinition.prototype._info = null;
257
+ /** @type {Object}
258
+ * @private
259
+ */
260
+ ColumnDefinition.prototype._coreColDef = null;
266
261
  //#endregion Private Members
267
262
 
268
263
 
@@ -270,6 +265,7 @@ ColumnDefinition.prototype._info = null;
270
265
  */
271
266
  ColumnDefinition.prototype.dispose = function() {
272
267
  this._eventArg = {}; // Clear all references
268
+ this._coreColDef = null;
273
269
  this._activatedRenderer = this._rendererMap = null;
274
270
  this.setRenderer(null); // this._userRenderers are removed
275
271
  this.setSorter(null);
@@ -289,25 +285,19 @@ ColumnDefinition.prototype._initializeTimeSeriesChild = function(columnOption) {
289
285
  this.initialize(columnOption);
290
286
  };
291
287
  /** @public
292
- * @param {ColumnDefinition~Options|string=} columnOption
288
+ * @param {ColumnDefinition~Options=} columnOption
293
289
  */
294
290
  ColumnDefinition.prototype.initialize = function(columnOption) {
295
- var field = "";
296
- if(typeof columnOption === "string") {
297
- field = columnOption;
298
- columnOption = FieldDefinition.get(field) || null;
299
- }
300
-
301
291
  if(!columnOption) {
302
- this._setField(field);
303
292
  return;
304
293
  }
305
294
 
306
- var i, len, key;
295
+ var i, len, key, val;
307
296
  //#region Apply pre-defined option
308
- field = columnOption["field"];
297
+ var field = columnOption["field"]; // Field could be null or undefined here
309
298
  var defaultOption = FieldDefinition.get(field);
310
299
  if(defaultOption && defaultOption !== columnOption) { // The column match the default field list
300
+ // WARNING: This changes reference of the user object. Any new property added won't affect anything outside of this method
311
301
  var userOption = columnOption;
312
302
  columnOption = {}; // Create a new object for cloning process
313
303
 
@@ -321,12 +311,6 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
321
311
  }
322
312
  //#endregion Apply pre-defined option
323
313
 
324
- var val;
325
- val = columnOption["id"];
326
- if(val) {
327
- this._id = val + "";
328
- }
329
-
330
314
  val = columnOption["formulaEngine"];
331
315
  if(val && val["addFormula"]) {
332
316
  this._fnEngine = /** @type{Engine} */(val);
@@ -350,7 +334,7 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
350
334
  val = columnOption["name"] || columnOption["title"]; // title is migrated from Composite Grid
351
335
  if(val != null) { // Name can be empty string
352
336
  this._name = val;
353
- this._isDefaultName = false;
337
+ this._defaultName = false;
354
338
  }
355
339
 
356
340
  val = columnOption["dataType"];
@@ -439,14 +423,17 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
439
423
  this._info = val;
440
424
  }
441
425
 
442
- this._userModel = columnOption;
426
+ this._userModel = columnOption; // WARNING: This may not actually the user object
443
427
  };
444
428
 
445
429
  /** @public
446
430
  * @return {string}
447
431
  */
448
432
  ColumnDefinition.prototype.getId = function() {
449
- return this._id;
433
+ if(this._coreColDef) {
434
+ return this._coreColDef["id"] || "";
435
+ }
436
+ return "";
450
437
  };
451
438
  /** @public
452
439
  * @return {!Array.<string>}
@@ -477,19 +464,25 @@ ColumnDefinition.prototype.getHeaderRenderer = function() {
477
464
  * @return {string}
478
465
  */
479
466
  ColumnDefinition.prototype.getName = function() {
467
+ if(this._defaultName) {
468
+ if(this._defaultField) {
469
+ return "Column " + this.getId();
470
+ }
471
+ return this.getField();
472
+ }
480
473
  return this._name;
481
474
  };
482
475
  /** @public
483
476
  * @return {boolean}
484
477
  */
485
478
  ColumnDefinition.prototype.isDefaultName = function() {
486
- return this._isDefaultName;
479
+ return this._defaultName;
487
480
  };
488
481
  /** @public
489
482
  * @return {string}
490
483
  */
491
484
  ColumnDefinition.prototype.getFieldDefinition = function () {
492
- return FieldDefinition.get(this._field);
485
+ return FieldDefinition.get(this.getField());
493
486
  };
494
487
  /** get realtime field data type
495
488
  * @public
@@ -551,12 +544,14 @@ ColumnDefinition.prototype.getTooltip = function() {
551
544
  }
552
545
  }
553
546
 
554
- if(this._name) {
555
- return this._name;
547
+ var name = this.getName();
548
+ if(name) {
549
+ return name;
556
550
  }
557
551
 
558
- if(this._field) {
559
- return this._field;
552
+ var field = this.getField();
553
+ if(field) {
554
+ return field;
560
555
  }
561
556
 
562
557
  return "";
@@ -565,25 +560,32 @@ ColumnDefinition.prototype.getTooltip = function() {
565
560
  * @return {string}
566
561
  */
567
562
  ColumnDefinition.prototype.getField = function() {
568
- return this._field;
563
+ if(this._coreColDef) {
564
+ return this._coreColDef["field"] || "";
565
+ }
566
+ return "";
569
567
  };
570
568
  /** @public
571
569
  * @return {!Array.<string>}
572
570
  */
573
571
  ColumnDefinition.prototype.getAllFields = function() {
574
- return this._requiredFields.concat(this._field);
572
+ var field = this.getField();
573
+ if(field) {
574
+ return this._requiredFields.concat(field);
575
+ }
576
+ return this._requiredFields.slice();
575
577
  };
576
578
  /** @public
577
579
  * @return {boolean}
578
580
  */
579
581
  ColumnDefinition.prototype.isRealTimeField = function() {
580
- return FieldDefinition.isRealTimeField(this._field);
582
+ return FieldDefinition.isRealTimeField(this.getField());
581
583
  };
582
584
  /** @public
583
585
  * @return {boolean}
584
586
  */
585
587
  ColumnDefinition.prototype.isTimeSeries = function() {
586
- return FieldDefinition.isTimeSeries(this._field);
588
+ return FieldDefinition.isTimeSeries(this.getField());
587
589
  };
588
590
  /** @public
589
591
  * @return {boolean}
@@ -688,7 +690,7 @@ ColumnDefinition.prototype.getTextAlign = function() {
688
690
  * @return {boolean}
689
691
  */
690
692
  ColumnDefinition.prototype.isFieldEmpty = function() {
691
- return this._emptyField;
693
+ return !this.getField();
692
694
  };
693
695
 
694
696
  /** @public
@@ -714,8 +716,13 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
714
716
  obj["info"] = this._info;
715
717
  }
716
718
 
717
- if(this._field !== "" && !this._field.match(/^COLUMN_/)) {
718
- obj["field"] = this._field;
719
+ if(obj["field"] == null) {
720
+ if(!this._defaultField) {
721
+ var field = this.getField();
722
+ if(field) {
723
+ obj["field"] = field;
724
+ }
725
+ }
719
726
  }
720
727
 
721
728
  var value = this.getDataType();
@@ -727,16 +734,16 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
727
734
  obj["formulaReference"] = this._formulaRef;
728
735
  }
729
736
 
730
- if(this._requiredFields) {
737
+ if(this._requiredFields && this._requiredFields.length) {
731
738
  obj["require"] = this._requiredFields;
732
739
  }
733
740
 
734
- if(this._name) {
735
- obj["name"] = this._name;
741
+ if(!this._defaultName) {
742
+ obj["name"] = this.getName();
736
743
  }
737
744
 
738
745
  // The 'IsRealtimeField' property will only be set if the user sets 'notRealTimeField' in the column options. It will be returned if the user has this option enabled, otherwise it will not be returned
739
- value = FieldDefinition.getFieldProperty(this._field, "IsRealtimeField") === false;
746
+ value = FieldDefinition.getFieldProperty(this.getField(), "IsRealtimeField") === false;
740
747
  if(value) {
741
748
  obj["notRealTimeField"] = value;
742
749
  }
@@ -859,8 +866,6 @@ ColumnDefinition.prototype.setRenderer = function(func) {
859
866
  ColumnDefinition.prototype.getParent = function() {
860
867
  return this._parent;
861
868
  };
862
-
863
-
864
869
  /**
865
870
  * @private
866
871
  * @param {ColumnDefinition} parentDef
@@ -877,8 +882,6 @@ ColumnDefinition.prototype._setParent = function(parentDef) {
877
882
  }
878
883
  return false;
879
884
  };
880
-
881
-
882
885
  /**
883
886
  * @public
884
887
  * @return {Array.<ColumnDefinition>}
@@ -886,7 +889,6 @@ ColumnDefinition.prototype._setParent = function(parentDef) {
886
889
  ColumnDefinition.prototype.getChildren = function() {
887
890
  return this._children;
888
891
  };
889
-
890
892
  /**
891
893
  * @private
892
894
  * @param {string} colDef Child column definition
@@ -959,7 +961,7 @@ ColumnDefinition.prototype.setSorter = function(func) {
959
961
  */
960
962
  ColumnDefinition.prototype.isRowSorting = function() {
961
963
  if(this._rowSorting == null) {
962
- return !FieldDefinition.getFieldProperty(this._field, "IsRealtimeField");
964
+ return !FieldDefinition.getFieldProperty(this.getField(), "IsRealtimeField");
963
965
  }
964
966
  return this._rowSorting ? true : false;
965
967
  };
@@ -977,7 +979,7 @@ ColumnDefinition.prototype.isAutoGenerated = function() {
977
979
  */
978
980
  ColumnDefinition.prototype.setName = function(str) {
979
981
  this._name = str;
980
- this._isDefaultName = false;
982
+ this._defaultName = false;
981
983
  };
982
984
 
983
985
  /** @private
@@ -985,14 +987,14 @@ ColumnDefinition.prototype.setName = function(str) {
985
987
  * @param {ColumnDefinition~Options=} columnOption
986
988
  */
987
989
  ColumnDefinition.prototype._setField = function(field, columnOption) {
988
- var defaultField = (field == null); // undefined or null
990
+ this._defaultField = (field == null); // undefined or null
989
991
  if(!field) {
990
992
  field = "";
991
993
  }
992
994
  // Trim white spaces -- equivalent to String.trim(), which is not support in IE8
993
995
  field = field.replace(/^\s+|\s+$/gm, "");
994
996
 
995
- var formulaStr = columnOption["formula"];
997
+ var formulaStr = columnOption ? columnOption["formula"] : "";
996
998
  if(this._fnEngine) {
997
999
  var uppercasedF = field.toUpperCase(); // For comparison only
998
1000
  var predefinedF = formulaStr || PredefinedFormula.get(uppercasedF);
@@ -1012,24 +1014,15 @@ ColumnDefinition.prototype._setField = function(field, columnOption) {
1012
1014
  }
1013
1015
  }
1014
1016
 
1015
- if(defaultField) {
1016
- this._field = "COLUMN_" + this._id;
1017
- this._name = "Column " + this._id;
1018
- this._emptyField = true;
1019
- } else {
1020
- this._field = field;
1021
- this._name = field;
1022
- this._emptyField = false;
1023
- }
1017
+ this._field = field; // WARNING: This could be out of sync with core. It is used as a cache for better performance
1024
1018
 
1025
1019
  // We need to cache time series in field definition for improve performance of checking methond
1026
1020
  FieldDefinition.setFieldProperty(field, "timeSeries", FieldDefinition.isTimeSeries(field) ? true : false);
1027
1021
 
1028
- if(columnOption["parent"]) {
1022
+ if(columnOption && columnOption["parent"]) {
1029
1023
  FieldDefinition.setFieldProperty(field, "timeSeriesChild", true);
1030
1024
  }
1031
1025
 
1032
- this._isDefaultName = true;
1033
1026
  this._updateContext("field", field);
1034
1027
  if(this.isRealTimeField()) { // Only realtime field will have a formatted field
1035
1028
  this._updateContext("formattedField", field + "_FORMATTED");
@@ -1135,6 +1128,14 @@ ColumnDefinition.prototype.getColumnInfo = function() {
1135
1128
  return this._info;
1136
1129
  };
1137
1130
 
1131
+ /** @public
1132
+ * @ignore
1133
+ * @param {Object} obj
1134
+ */
1135
+ ColumnDefinition.prototype._setCoreColumnDef = function(obj) {
1136
+ this._coreColDef = obj || null;
1137
+ };
1138
+
1138
1139
 
1139
1140
  export {ColumnDefinition, COL_DEF};
1140
1141
  export default ColumnDefinition;
@@ -81,7 +81,8 @@ declare namespace Grid {
81
81
  formulaEngine?: boolean|null,
82
82
  adcPollingInterval?: number|null,
83
83
  fieldCaching?: boolean|null,
84
- childDataField?: string|null
84
+ childDataField?: string|null,
85
+ topSection?: boolean|null
85
86
  };
86
87
 
87
88
  type RowReference = number|string|RowDefinition|null;
@@ -144,7 +145,7 @@ declare class Grid extends EventDispatcher {
144
145
 
145
146
  public moveColumnById(srcCol: number|string|null, destCol?: (number|string)|null): boolean;
146
147
 
147
- public reorderColumns(colRefs: number|string|(number|string)[]|null, destCol: number|string|null): boolean;
148
+ public reorderColumns(colRefs: number|string|(number|string)[]|null, destCol?: (number|string)|null): boolean;
148
149
 
149
150
  public hideColumn(colRef: Grid.ColumnReference|null, hidden?: boolean|null): void;
150
151
 
@@ -294,6 +295,10 @@ declare class Grid extends EventDispatcher {
294
295
 
295
296
  public setClassification(rowRef: Grid.RowReference|null, fields: (string)[]|null): boolean;
296
297
 
298
+ public contains(elem: Element|null): boolean;
299
+
300
+ public isFocused(): boolean;
301
+
297
302
  public focus(): void;
298
303
 
299
304
  public requestRowRefresh(): void;
@@ -314,6 +319,8 @@ declare class Grid extends EventDispatcher {
314
319
 
315
320
  declare function borders(gridOptions?: any): any;
316
321
 
322
+ declare function idx(colRef: Grid.ColumnReference|null): void;
323
+
317
324
  declare function colCount(rowRef: number|string|null): string;
318
325
 
319
326
  export { Grid };