@refinitiv-ui/efx-grid 6.0.29 → 6.0.30

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.
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.29" };
3
+ window.EFX_GRID = { version: "6.0.30" };
@@ -13072,12 +13072,12 @@ DataTable._proto = DataTable.prototype;
13072
13072
  */
13073
13073
 
13074
13074
  /** @typedef {Object} RowDefinition~RowTypes
13075
- * @property {string} CONTENT="CONTENT"
13076
- * @property {string} CHAIN="CHAIN"
13077
- * @property {string} CONSTITUENT="CONSTITUENT"
13078
- * @property {string} GROUP_HEADER="GROUP_HEADER"
13079
- * @property {string} SUBGROUP_HEADER="SUBGROUP_HEADER"
13080
- * @property {string} GROUP_MEMBER="GROUP_MEMBER"
13075
+ * @property {string} CONTENT="CONTENT" Regular row
13076
+ * @property {string} CHAIN="CHAIN" Chain RIC row
13077
+ * @property {string} CONSTITUENT="CONSTITUENT" Constituent row
13078
+ * @property {string} GROUP_HEADER="GROUP_HEADER" Row of segment separator at the very top
13079
+ * @property {string} SUBGROUP_HEADER="SUBGROUP_HEADER" Row of nested segment separator
13080
+ * @property {string} GROUP_MEMBER="GROUP_MEMBER" Child row displayed under segment separator
13081
13081
  */
13082
13082
 
13083
13083
  /** @type {string}
@@ -13086,7 +13086,7 @@ DataTable._proto = DataTable.prototype;
13086
13086
  */
13087
13087
  var ROW_DEF = "ROW_DEF";
13088
13088
 
13089
- /** @type {RowDefinition~RowTypes}
13089
+ /** @type {!RowDefinition~RowTypes}
13090
13090
  * @public
13091
13091
  * @const
13092
13092
  */
@@ -14374,6 +14374,11 @@ FieldDefinition._lang = 'en';
14374
14374
  * @private
14375
14375
  */
14376
14376
  FieldDefinition._caching = false;
14377
+ /**
14378
+ * @type {boolean}
14379
+ * @private
14380
+ */
14381
+ FieldDefinition._timeSeriesExpansion = true;
14377
14382
 
14378
14383
  /**
14379
14384
  * @type {Object.<string, boolean>}
@@ -14461,6 +14466,14 @@ FieldDefinition.setFieldCaching = function (caching) {
14461
14466
  FieldDefinition._caching = caching;
14462
14467
  };
14463
14468
 
14469
+ /** @public
14470
+ * @function
14471
+ * @param {boolean} disabled=true if disable it, time series will not be expand
14472
+ */
14473
+ FieldDefinition.disableTimeSeriesExpansion = function(disabled) {
14474
+ FieldDefinition._timeSeriesExpansion = disabled != false ? false : true;
14475
+ };
14476
+
14464
14477
  /** @public
14465
14478
  * @param {string} field
14466
14479
  * @return {boolean}
@@ -14493,7 +14506,7 @@ FieldDefinition.isRealTimeField = function(field) {
14493
14506
  return false;
14494
14507
  }
14495
14508
 
14496
- if(FieldDefinition.getFieldProperty(field, "timeSeriesChild")) {
14509
+ if(FieldDefinition.isTimeSeriesChild(field)) {
14497
14510
  return false;
14498
14511
  }
14499
14512
 
@@ -14504,6 +14517,14 @@ FieldDefinition.isRealTimeField = function(field) {
14504
14517
  return FieldDefinition.getFieldProperty(field, "IsRealtimeField") !== false;
14505
14518
  };
14506
14519
 
14520
+ /** @public
14521
+ * @param {string} field
14522
+ * @return {boolean}
14523
+ */
14524
+ FieldDefinition.isTimeSeriesChild = function(field) {
14525
+ return FieldDefinition.getFieldProperty(field, "timeSeriesChild") ? true : false;
14526
+ };
14527
+
14507
14528
  /** @public
14508
14529
  * @param {string} field
14509
14530
  * @return {boolean}=true if field is time series field
@@ -14513,6 +14534,11 @@ FieldDefinition.isTimeSeries = function (field) {
14513
14534
  return false;
14514
14535
  }
14515
14536
 
14537
+ // If we disable time series expansion, the grid won't have a time series field.
14538
+ if(!FieldDefinition._timeSeriesExpansion) {
14539
+ return false;
14540
+ }
14541
+
14516
14542
  // We can check time series using a cache to avoid duplicating checks in regular expressions.
14517
14543
  var timeSeriesField = FieldDefinition.getFieldProperty(field, "timeSeries");
14518
14544
  if (timeSeriesField != null) {
@@ -15387,6 +15413,12 @@ ColumnDefinition.prototype.isTimeSeries = function() {
15387
15413
  /** @public
15388
15414
  * @return {boolean}
15389
15415
  */
15416
+ ColumnDefinition.prototype.isTimeSeriesChild = function() {
15417
+ return js_FieldDefinition.isTimeSeriesChild(this.getField());
15418
+ };
15419
+ /** @public
15420
+ * @return {boolean}
15421
+ */
15390
15422
  ColumnDefinition.prototype.isFormulaField = function() {
15391
15423
  return this._formula ? true : false;
15392
15424
  };
@@ -16321,6 +16353,9 @@ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
16321
16353
  var dataRow = data2D[i];
16322
16354
  ric = dataRow[0];
16323
16355
 
16356
+ if (ricMap[ric]) {
16357
+ continue; // we interested only first row of ric
16358
+ }
16324
16359
  var snapData = ricMap[ric] = {};
16325
16360
 
16326
16361
  // loop for create rowData for update
@@ -25655,6 +25690,7 @@ LayoutGrid.prototype.setRowOffset = function (index) {
25655
25690
  LayoutGrid.prototype.updateLayout = function () {
25656
25691
  this._calculateViewSize(true); // Column bounds will be updated by trigger from Core
25657
25692
 
25693
+ this._stretchedCells.updateCells();
25658
25694
  this._updateRightSpaceStyle();
25659
25695
  };
25660
25696
 
@@ -35372,7 +35408,7 @@ Core.prototype._groupDefs = null;
35372
35408
  * @return {string}
35373
35409
  */
35374
35410
  Core.getVersion = function () {
35375
- return "5.1.38";
35411
+ return "5.1.39";
35376
35412
  };
35377
35413
  /** {@link ElementWrapper#dispose}
35378
35414
  * @override
@@ -39815,7 +39851,7 @@ Core.prototype.getColumnField = function (colIndex) {
39815
39851
  return "";
39816
39852
  };
39817
39853
  /** @public
39818
- * @return {!Array.<string>} Return all column ids from existing column
39854
+ * @return {!Array.<string>} Return all column fields from existing columns
39819
39855
  */
39820
39856
  Core.prototype.getColumnFields = function () {
39821
39857
  var colCount = this.getColumnCount();
@@ -43060,6 +43096,7 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
43060
43096
  * @property {boolean=} formulaEngine=false If enabled, field with leading equal sign will be treated as a formula and rows will be filled with the calculated values.
43061
43097
  * @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
43062
43098
  * @property {boolean=} fieldCaching=false If enabled, field definition will be caching internal mechanism
43099
+ * @property {boolean=} timeSeriesExpansion=true If disabled, the time series field will be treated as a normal field and not expanded.
43063
43100
  * @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
43064
43101
  * @property {boolean=} topSection=true If disabled, title section will not be rendered
43065
43102
  */
@@ -43506,6 +43543,11 @@ Grid.prototype._pollingEnabled = true;
43506
43543
  * @private
43507
43544
  */
43508
43545
  Grid.prototype._fieldCaching = false;
43546
+ /** @type {boolean}
43547
+ * @private
43548
+ */
43549
+ Grid.prototype._timeSeriesExpansion = true;
43550
+
43509
43551
  /** @type {string}
43510
43552
  * @private
43511
43553
  */
@@ -43766,6 +43808,11 @@ Grid.prototype.initialize = function(gridOption) {
43766
43808
  js_FieldDefinition.setFieldCaching(t._fieldCaching);
43767
43809
  }
43768
43810
 
43811
+ if(gridOption["timeSeriesExpansion"] != null) {
43812
+ t._timeSeriesExpansion = gridOption["timeSeriesExpansion"];
43813
+ js_FieldDefinition.disableTimeSeriesExpansion(!t._timeSeriesExpansion);
43814
+ }
43815
+
43769
43816
  if (gridOption["icons"] && gridOption["icons"]["rowGrouping"] && gridOption["icons"]["rowGrouping"]["expander"]) {
43770
43817
  js_StyleLoader.chainIcon = gridOption["icons"]["rowGrouping"]["expander"];
43771
43818
  }
@@ -44088,6 +44135,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
44088
44135
  if(this._fieldCaching) {
44089
44136
  obj["fieldCaching"] = this._fieldCaching;
44090
44137
  }
44138
+ if(this._timeSeriesExpansion != true) {
44139
+ obj["timeSeriesExpansion"] = this._timeSeriesExpansion;
44140
+ }
44091
44141
 
44092
44142
  if(this._childDataField) {
44093
44143
  obj["childDataField"] = this._childDataField;
@@ -49208,7 +49258,7 @@ Adc.request = function (payload, mockResponse) {
49208
49258
  } else {
49209
49259
 
49210
49260
  identifiers = payload.identifiers;
49211
- formula = payload.formula.trim().split(","); // TODO: check each field with another way, this doesn't work when user use some comma (,) formula
49261
+ formula = Adc.splitFields(payload.formula);
49212
49262
  fields = [];
49213
49263
 
49214
49264
  // _invalidFieldDict is a dictionary of non exist field
@@ -49286,6 +49336,34 @@ Adc.request = function (payload, mockResponse) {
49286
49336
  }));
49287
49337
  };
49288
49338
 
49339
+ /**
49340
+ * Splits a string of comma-separated fields into an array of individual field names with optional parentheses and contents.
49341
+ *
49342
+ * @param {string} strFields - The string of comma-separated fields to split.
49343
+ * @returns {Array<string>} - An array of individual field names with optional parentheses and contents.
49344
+ */
49345
+ Adc.splitFields = function(strFields) {
49346
+ if(!strFields) {
49347
+ return [];
49348
+ }
49349
+
49350
+ // Split the input string using the regular expression
49351
+ // regex is match commas that are not inside parentheses
49352
+ /*
49353
+ , - matches a comma
49354
+ (?![^()]*\) - negative lookahead assertion that matches if the comma is not followed by:
49355
+ [^()]* - any characters that are not opening or closing parentheses
49356
+ \) - a closing parenthesis
49357
+ ) - ending delimiter of the regular expression
49358
+ */
49359
+ var fields = strFields.split(/,(?![^()]*\))/);
49360
+ fields = fields.map(function(field) {
49361
+ return field.trim();
49362
+ });
49363
+
49364
+ return fields;
49365
+ };
49366
+
49289
49367
  /** @public
49290
49368
  * @function
49291
49369
  * @param {string} dataType
@@ -49438,6 +49516,7 @@ var TickFields = {
49438
49516
  * @property {string=} fontStyle
49439
49517
  * @property {string=} textAlign
49440
49518
  * @property {string=} textDecoration
49519
+ * @property {string=} cssClass Predefined color class name
49441
49520
  */
49442
49521
 
49443
49522
  /** @typedef {Object.<string, string>} CellPainter~ThemeColors
@@ -49937,14 +50016,21 @@ CellPainter.prototype.renderForPrinting = function(cell, rowData, min, max) {
49937
50016
  return;
49938
50017
  }
49939
50018
  var styles = this._getStyles(rowData, min, max);
49940
- var c = styles["backgroundColor"];
49941
- if(c) {
49942
- cell.style.backgroundColor = c;
49943
- }
49944
-
49945
- c = styles["color"];
49946
- if(c) {
49947
- cell.style.color = c;
50019
+ var cssClass = styles["cssClass"];
50020
+ if (cssClass) {
50021
+ if (cell._coloringCssClass !== cssClass) {
50022
+ cell.classList.remove(cell._coloringCssClass);
50023
+ cell._coloringCssClass = null;
50024
+ }
50025
+ cell.classList.add(cssClass);
50026
+ cell._coloringCssClass = cssClass;
50027
+ } else {
50028
+ if (cell._coloringCssClass) {
50029
+ cell.classList.remove(cell._coloringCssClass);
50030
+ cell._coloringCssClass = null;
50031
+ }
50032
+ cell.style.backgroundColor = styles["backgroundColor"] || "";
50033
+ cell.style.color = styles["color"] || "";
49948
50034
  }
49949
50035
  };
49950
50036
 
@@ -50070,8 +50156,24 @@ CellPainter._cellRestorer = function(scope) {
50070
50156
  }
50071
50157
 
50072
50158
  var styles = this._getStyles(rowData, min, max);
50073
- elem.style.backgroundColor = styles["backgroundColor"] || "";
50074
- elem.style.color = styles["color"] || "";
50159
+ var cssClass = styles["cssClass"];
50160
+ if (cssClass) {
50161
+ if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
50162
+ elem.classList.remove(elem._coloringCssClass);
50163
+ elem._coloringCssClass = null;
50164
+ }
50165
+ elem.classList.add(cssClass);
50166
+ elem._coloringCssClass = cssClass;
50167
+ elem.style.backgroundColor = "";
50168
+ elem.style.color = "";
50169
+ } else {
50170
+ if (elem._coloringCssClass) {
50171
+ elem.classList.remove(elem._coloringCssClass);
50172
+ elem._coloringCssClass = null;
50173
+ }
50174
+ elem.style.backgroundColor = styles["backgroundColor"] || "";
50175
+ elem.style.color = styles["color"] || "";
50176
+ }
50075
50177
  }
50076
50178
  };
50077
50179
 
@@ -50420,11 +50522,25 @@ CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
50420
50522
  }
50421
50523
 
50422
50524
  var styles = this._getStyles(rowData, min, max);
50423
- var ss = CellPainter.bgStyles;
50424
- var elStyle = elem.style;
50425
- for (var n = ss.length; --n >= 0;) {
50426
- var styleName = ss[n];
50427
- elStyle[styleName] = styles[styleName] || "";
50525
+ var cssClass = styles["cssClass"];
50526
+ if (cssClass) {
50527
+ if (elem._coloringCssClass !== cssClass) {
50528
+ elem.classList.remove(elem._coloringCssClass);
50529
+ elem._coloringCssClass = null;
50530
+ }
50531
+ elem.classList.add(cssClass);
50532
+ elem._coloringCssClass = cssClass;
50533
+ } else {
50534
+ if (elem._coloringCssClass) {
50535
+ elem.classList.remove(elem._coloringCssClass);
50536
+ elem._coloringCssClass = null;
50537
+ }
50538
+ var ss = CellPainter.bgStyles;
50539
+ var elStyle = elem.style;
50540
+ for (var n = ss.length; --n >= 0;) {
50541
+ var styleName = ss[n];
50542
+ elStyle[styleName] = styles[styleName] || "";
50543
+ }
50428
50544
  }
50429
50545
  };
50430
50546