@refinitiv-ui/efx-grid 6.0.29 → 6.0.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -91,6 +91,8 @@ declare class ColumnDefinition {
91
91
 
92
92
  public isTimeSeries(): boolean;
93
93
 
94
+ public isTimeSeriesChild(): boolean;
95
+
94
96
  public isFormulaField(): boolean;
95
97
 
96
98
  public static isFormulaField(field: string): boolean;
@@ -590,6 +590,12 @@ ColumnDefinition.prototype.isTimeSeries = function() {
590
590
  /** @public
591
591
  * @return {boolean}
592
592
  */
593
+ ColumnDefinition.prototype.isTimeSeriesChild = function() {
594
+ return FieldDefinition.isTimeSeriesChild(this.getField());
595
+ };
596
+ /** @public
597
+ * @return {boolean}
598
+ */
593
599
  ColumnDefinition.prototype.isFormulaField = function() {
594
600
  return this._formula ? true : false;
595
601
  };
@@ -20,12 +20,16 @@ declare namespace FieldDefinition {
20
20
 
21
21
  function setFieldCaching(caching: boolean): void;
22
22
 
23
+ function disableTimeSeriesExpansion(disabled: boolean): void;
24
+
23
25
  function isFormula(field: string): boolean;
24
26
 
25
27
  function isAdc(field: string): boolean;
26
28
 
27
29
  function isRealTimeField(field: string): boolean;
28
30
 
31
+ function isTimeSeriesChild(field: string): boolean;
32
+
29
33
  function isTimeSeries(field: string): boolean;
30
34
 
31
35
  }
@@ -182,6 +182,11 @@ FieldDefinition._lang = 'en';
182
182
  * @private
183
183
  */
184
184
  FieldDefinition._caching = false;
185
+ /**
186
+ * @type {boolean}
187
+ * @private
188
+ */
189
+ FieldDefinition._timeSeriesExpansion = true;
185
190
 
186
191
  /**
187
192
  * @type {Object.<string, boolean>}
@@ -269,6 +274,14 @@ FieldDefinition.setFieldCaching = function (caching) {
269
274
  FieldDefinition._caching = caching;
270
275
  };
271
276
 
277
+ /** @public
278
+ * @function
279
+ * @param {boolean} disabled=true if disable it, time series will not be expand
280
+ */
281
+ FieldDefinition.disableTimeSeriesExpansion = function(disabled) {
282
+ FieldDefinition._timeSeriesExpansion = disabled != false ? false : true;
283
+ };
284
+
272
285
  /** @public
273
286
  * @param {string} field
274
287
  * @return {boolean}
@@ -301,7 +314,7 @@ FieldDefinition.isRealTimeField = function(field) {
301
314
  return false;
302
315
  }
303
316
 
304
- if(FieldDefinition.getFieldProperty(field, "timeSeriesChild")) {
317
+ if(FieldDefinition.isTimeSeriesChild(field)) {
305
318
  return false;
306
319
  }
307
320
 
@@ -312,6 +325,14 @@ FieldDefinition.isRealTimeField = function(field) {
312
325
  return FieldDefinition.getFieldProperty(field, "IsRealtimeField") !== false;
313
326
  };
314
327
 
328
+ /** @public
329
+ * @param {string} field
330
+ * @return {boolean}
331
+ */
332
+ FieldDefinition.isTimeSeriesChild = function(field) {
333
+ return FieldDefinition.getFieldProperty(field, "timeSeriesChild") ? true : false;
334
+ };
335
+
315
336
  /** @public
316
337
  * @param {string} field
317
338
  * @return {boolean}=true if field is time series field
@@ -321,6 +342,11 @@ FieldDefinition.isTimeSeries = function (field) {
321
342
  return false;
322
343
  }
323
344
 
345
+ // If we disable time series expansion, the grid won't have a time series field.
346
+ if(!FieldDefinition._timeSeriesExpansion) {
347
+ return false;
348
+ }
349
+
324
350
  // We can check time series using a cache to avoid duplicating checks in regular expressions.
325
351
  var timeSeriesField = FieldDefinition.getFieldProperty(field, "timeSeries");
326
352
  if (timeSeriesField != null) {
@@ -81,6 +81,7 @@ declare namespace Grid {
81
81
  formulaEngine?: boolean|null,
82
82
  adcPollingInterval?: number|null,
83
83
  fieldCaching?: boolean|null,
84
+ timeSeriesExpansion?: boolean|null,
84
85
  childDataField?: string|null,
85
86
  topSection?: boolean|null
86
87
  };
@@ -84,6 +84,7 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
84
84
  * @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.
85
85
  * @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
86
86
  * @property {boolean=} fieldCaching=false If enabled, field definition will be caching internal mechanism
87
+ * @property {boolean=} timeSeriesExpansion=true If disabled, the time series field will be treated as a normal field and not expanded.
87
88
  * @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
88
89
  * @property {boolean=} topSection=true If disabled, title section will not be rendered
89
90
  */
@@ -530,6 +531,11 @@ Grid.prototype._pollingEnabled = true;
530
531
  * @private
531
532
  */
532
533
  Grid.prototype._fieldCaching = false;
534
+ /** @type {boolean}
535
+ * @private
536
+ */
537
+ Grid.prototype._timeSeriesExpansion = true;
538
+
533
539
  /** @type {string}
534
540
  * @private
535
541
  */
@@ -790,6 +796,11 @@ Grid.prototype.initialize = function(gridOption) {
790
796
  FieldDefinition.setFieldCaching(t._fieldCaching);
791
797
  }
792
798
 
799
+ if(gridOption["timeSeriesExpansion"] != null) {
800
+ t._timeSeriesExpansion = gridOption["timeSeriesExpansion"];
801
+ FieldDefinition.disableTimeSeriesExpansion(!t._timeSeriesExpansion);
802
+ }
803
+
793
804
  if (gridOption["icons"] && gridOption["icons"]["rowGrouping"] && gridOption["icons"]["rowGrouping"]["expander"]) {
794
805
  StyleLoader.chainIcon = gridOption["icons"]["rowGrouping"]["expander"];
795
806
  }
@@ -1112,6 +1123,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
1112
1123
  if(this._fieldCaching) {
1113
1124
  obj["fieldCaching"] = this._fieldCaching;
1114
1125
  }
1126
+ if(this._timeSeriesExpansion != true) {
1127
+ obj["timeSeriesExpansion"] = this._timeSeriesExpansion;
1128
+ }
1115
1129
 
1116
1130
  if(this._childDataField) {
1117
1131
  obj["childDataField"] = this._childDataField;
@@ -136,7 +136,7 @@ declare class RowDefinition {
136
136
 
137
137
  declare const ROW_DEF: string;
138
138
 
139
- declare const ROW_TYPES: RowDefinition.RowTypes|null;
139
+ declare const ROW_TYPES: RowDefinition.RowTypes;
140
140
 
141
141
  declare function rowData(userInput: string): boolean;
142
142
 
@@ -17,12 +17,12 @@ import { DataTable } from "../../core/es6/data/DataTable.js";
17
17
  */
18
18
 
19
19
  /** @typedef {Object} RowDefinition~RowTypes
20
- * @property {string} CONTENT="CONTENT"
21
- * @property {string} CHAIN="CHAIN"
22
- * @property {string} CONSTITUENT="CONSTITUENT"
23
- * @property {string} GROUP_HEADER="GROUP_HEADER"
24
- * @property {string} SUBGROUP_HEADER="SUBGROUP_HEADER"
25
- * @property {string} GROUP_MEMBER="GROUP_MEMBER"
20
+ * @property {string} CONTENT="CONTENT" Regular row
21
+ * @property {string} CHAIN="CHAIN" Chain RIC row
22
+ * @property {string} CONSTITUENT="CONSTITUENT" Constituent row
23
+ * @property {string} GROUP_HEADER="GROUP_HEADER" Row of segment separator at the very top
24
+ * @property {string} SUBGROUP_HEADER="SUBGROUP_HEADER" Row of nested segment separator
25
+ * @property {string} GROUP_MEMBER="GROUP_MEMBER" Child row displayed under segment separator
26
26
  */
27
27
 
28
28
  /** @type {string}
@@ -31,7 +31,7 @@ import { DataTable } from "../../core/es6/data/DataTable.js";
31
31
  */
32
32
  var ROW_DEF = "ROW_DEF";
33
33
 
34
- /** @type {RowDefinition~RowTypes}
34
+ /** @type {!RowDefinition~RowTypes}
35
35
  * @public
36
36
  * @const
37
37
  */
@@ -381,6 +381,9 @@ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
381
381
  var dataRow = data2D[i];
382
382
  ric = dataRow[0];
383
383
 
384
+ if (ricMap[ric]) {
385
+ continue; // we interested only first row of ric
386
+ }
384
387
  var snapData = ricMap[ric] = {};
385
388
 
386
389
  // loop for create rowData for update
@@ -1311,6 +1311,10 @@ ColumnStackPlugin.prototype._onColumnRemoved = function (e) {
1311
1311
  } else {
1312
1312
  stackOpt.activeColumn = stackOpt.stackRefs[0];
1313
1313
  }
1314
+
1315
+ // TODO: Add a proper way to set visibility to activeColumn when activeColumn is changed
1316
+ var activeColIndex = this._getColumnIndex(stackOpt.activeColumn);
1317
+ this._setColumnVisibility(activeColIndex, true);
1314
1318
  this._updateUI();
1315
1319
  }
1316
1320
  }
@@ -266,7 +266,7 @@ Adc.request = function (payload, mockResponse) {
266
266
  } else {
267
267
 
268
268
  identifiers = payload.identifiers;
269
- formula = payload.formula.trim().split(","); // TODO: check each field with another way, this doesn't work when user use some comma (,) formula
269
+ formula = Adc.splitFields(payload.formula);
270
270
  fields = [];
271
271
 
272
272
  // _invalidFieldDict is a dictionary of non exist field
@@ -344,6 +344,34 @@ Adc.request = function (payload, mockResponse) {
344
344
  }));
345
345
  };
346
346
 
347
+ /**
348
+ * Splits a string of comma-separated fields into an array of individual field names with optional parentheses and contents.
349
+ *
350
+ * @param {string} strFields - The string of comma-separated fields to split.
351
+ * @returns {Array<string>} - An array of individual field names with optional parentheses and contents.
352
+ */
353
+ Adc.splitFields = function(strFields) {
354
+ if(!strFields) {
355
+ return [];
356
+ }
357
+
358
+ // Split the input string using the regular expression
359
+ // regex is match commas that are not inside parentheses
360
+ /*
361
+ , - matches a comma
362
+ (?![^()]*\) - negative lookahead assertion that matches if the comma is not followed by:
363
+ [^()]* - any characters that are not opening or closing parentheses
364
+ \) - a closing parenthesis
365
+ ) - ending delimiter of the regular expression
366
+ */
367
+ var fields = strFields.split(/,(?![^()]*\))/);
368
+ fields = fields.map(function(field) {
369
+ return field.trim();
370
+ });
371
+
372
+ return fields;
373
+ };
374
+
347
375
  /** @public
348
376
  * @function
349
377
  * @param {string} dataType
@@ -1,39 +1,44 @@
1
1
  import {Ext} from '../../tr-grid-util/es6/Ext.js';
2
- import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
3
- import { extendObject } from '../../tr-grid-util/es6/Util.js';
2
+ import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
3
+ import {extendObject, injectCss, prettifyCss} from '../../tr-grid-util/es6/Util.js';
4
4
  import {CellPainter} from '../../tr-grid-util/es6/CellPainter.js';
5
5
  import {FilterBuilder} from '../../tr-grid-util/es6/FilterBuilder.js';
6
6
  import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
7
7
 
8
8
  declare namespace ConditionalColoringPlugin {
9
9
 
10
+ type Options = {
11
+ predefinedColors?: any
12
+ };
13
+
10
14
  type ColumnOptions = {
11
- conditions?: (ConditionalColoringPlugin.Condition)[],
12
- colorText?: (string|boolean),
13
- tickColor?: (string|boolean),
14
- blinking?: (ConditionalColoringPlugin.Blinking|boolean),
15
- field?: string
15
+ conditions?: (ConditionalColoringPlugin.Condition)[]|null,
16
+ colorText?: (string|boolean)|null,
17
+ tickColor?: (string|boolean)|null,
18
+ blinking?: (ConditionalColoringPlugin.Blinking|boolean)|null,
19
+ field?: string|null
16
20
  };
17
21
 
18
22
  type ConditionalColoringOptions = {
19
- conditions?: (ConditionalColoringPlugin.Condition)[],
20
- colorText?: (string|boolean),
21
- tickColor?: (string|boolean),
22
- field?: string
23
+ conditions?: (ConditionalColoringPlugin.Condition)[]|null,
24
+ colorText?: (string|boolean)|null,
25
+ tickColor?: (string|boolean)|null,
26
+ field?: string|null
23
27
  };
24
28
 
25
29
  type Condition = {
26
- expression?: (string|((...params: any[]) => any)),
27
- backgroundColor?: string,
28
- color?: string
30
+ expression?: (string|((...params: any[]) => any))|null,
31
+ backgroundColor?: string|null,
32
+ color?: string|null,
33
+ cssClass?: string|null
29
34
  };
30
35
 
31
36
  type Blinking = {
32
- border?: boolean,
33
- field?: string,
34
- up?: string,
35
- down?: string,
36
- level?: (string|boolean)
37
+ border?: boolean|null,
38
+ field?: string|null,
39
+ up?: string|null,
40
+ down?: string|null,
41
+ level?: (string|boolean)|null
37
42
  };
38
43
 
39
44
  }
@@ -56,21 +61,23 @@ declare class ConditionalColoringPlugin extends GridPlugin {
56
61
 
57
62
  public getColumnColoring(colIndex: number, options?: any): ConditionalColoringPlugin.ColumnOptions;
58
63
 
59
- public setColumnColoring(colIndex: number, columnOptions?: (ConditionalColoringPlugin.ColumnOptions|null)): void;
64
+ public setColumnColoring(colIndex: number, columnOptions?: (ConditionalColoringPlugin.ColumnOptions|null)|null): void;
60
65
 
61
- public setConditionalColoring(colIndex: number, coloringOptions?: (ConditionalColoringPlugin.ConditionalColoringOptions|null)): void;
66
+ public setConditionalColoring(colIndex: number, coloringOptions?: (ConditionalColoringPlugin.ConditionalColoringOptions|null)|null): void;
62
67
 
63
- public setColumnBlinking(colIndex: number, blinkingOptions?: (boolean|ConditionalColoringPlugin.Blinking), field?: string): void;
68
+ public setColumnBlinking(colIndex: number, blinkingOptions?: (boolean|ConditionalColoringPlugin.Blinking)|null, field?: string|null): void;
64
69
 
65
70
  public blinkRow(rowIndex: number, blinkSignal: number, host?: any): void;
66
71
 
72
+ public setPredefinedColors(predefinedColors: any): void;
73
+
67
74
  public getColumnPainter(colIndex: number): CellPainter|null;
68
75
 
69
76
  public applyColor(colIndex: number, cell: any, rowData?: any): void;
70
77
 
71
78
  public static cleanUpPrevRows(): void;
72
79
 
73
- public static setThemeColors(colors: { [key: string]: string }): void;
80
+ public static setThemeColors(colors: { [key: string]: string }|null): void;
74
81
 
75
82
  public reloadThemeColors(): Promise<any>|null;
76
83
 
@@ -9,6 +9,7 @@ import ColumnGrouping from "../../tr-grid-column-grouping/es6/ColumnGrouping.js"
9
9
  import ColumnResizing from "../../tr-grid-column-resizing/es6/ColumnResizing.js";
10
10
  import ColumnSelection from "../../tr-grid-column-selection/es6/ColumnSelection.js";
11
11
  import ColumnStack from "../../tr-grid-column-stack/es6/ColumnStack.js";
12
+ import ConditionalColoring from "../../tr-grid-conditional-coloring/es6/ConditionalColoring.js";
12
13
  import ContentWrap from "../../tr-grid-content-wrap/es6/ContentWrap.js";
13
14
  import ContextMenu from "../../tr-grid-contextmenu/es6/ContextMenu.js";
14
15
  import FilterInput from "../../tr-grid-filter-input/es6/FilterInput.js";
@@ -34,6 +35,7 @@ type ExtensionOptions = {
34
35
  columnResizing?: ColumnResizing.Options,
35
36
  columnSelection?: ColumnSelection.Options,
36
37
  columnStack?: ColumnStack.Options,
38
+ conditionalColoring?: ConditionalColoring.Options,
37
39
  contentWrap?: ContentWrap.Options,
38
40
  contextMenu?: ContextMenu.Options,
39
41
  filterInput?: FilterInput.Options,
@@ -136,7 +136,7 @@ declare class RowDefinition {
136
136
 
137
137
  declare const ROW_DEF: string;
138
138
 
139
- declare const ROW_TYPES: RowDefinition.RowTypes|null;
139
+ declare const ROW_TYPES: RowDefinition.RowTypes;
140
140
 
141
141
  declare function rowData(userInput: string): boolean;
142
142
 
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.88",
2
+ "tr-grid-util": "1.3.89",
3
3
  "@grid/column-dragging": "1.0.11",
4
4
  "@grid/row-segmenting": "1.0.23",
5
5
  "@grid/statistics-row": "1.0.13",
@@ -12,7 +12,7 @@
12
12
  "tr-grid-column-grouping": "1.0.46",
13
13
  "tr-grid-column-resizing": "1.0.28",
14
14
  "tr-grid-column-selection": "1.0.26",
15
- "tr-grid-column-stack": "1.0.53",
15
+ "tr-grid-column-stack": "1.0.54",
16
16
  "tr-grid-conditional-coloring": "1.0.58",
17
17
  "tr-grid-content-wrap": "1.0.19",
18
18
  "tr-grid-contextmenu": "1.0.38",
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.29"
69
+ "version": "6.0.30"
70
70
  }