@refinitiv-ui/efx-grid 6.0.28 → 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.
Files changed (32) hide show
  1. package/lib/core/dist/core.js +3 -2
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/grid/Core.js +2 -2
  4. package/lib/core/es6/grid/LayoutGrid.js +1 -0
  5. package/lib/grid/index.js +1 -1
  6. package/lib/rt-grid/dist/rt-grid.js +142 -26
  7. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  8. package/lib/rt-grid/es6/ColumnDefinition.d.ts +2 -0
  9. package/lib/rt-grid/es6/ColumnDefinition.js +6 -0
  10. package/lib/rt-grid/es6/FieldDefinition.d.ts +4 -0
  11. package/lib/rt-grid/es6/FieldDefinition.js +27 -1
  12. package/lib/rt-grid/es6/Grid.d.ts +1 -0
  13. package/lib/rt-grid/es6/Grid.js +14 -0
  14. package/lib/rt-grid/es6/RowDefinition.d.ts +1 -1
  15. package/lib/rt-grid/es6/RowDefinition.js +7 -7
  16. package/lib/rt-grid/es6/SnapshotFiller.js +3 -0
  17. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +6 -0
  18. package/lib/tr-grid-column-stack/es6/ColumnStack.js +70 -1
  19. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +30 -23
  20. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +78 -3
  21. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +24 -10
  22. package/lib/tr-grid-util/es6/CellPainter.d.ts +2 -1
  23. package/lib/tr-grid-util/es6/CellPainter.js +53 -15
  24. package/lib/tr-grid-util/es6/jet/mockDataAPI.js +29 -1
  25. package/lib/types/es6/ColumnStack.d.ts +6 -0
  26. package/lib/types/es6/ConditionalColoring.d.ts +30 -23
  27. package/lib/types/es6/ExtensionOptions.d.ts +2 -0
  28. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +1 -1
  29. package/lib/utils/index.d.ts +3 -0
  30. package/lib/utils/index.js +3 -0
  31. package/lib/versions.json +4 -4
  32. package/package.json +6 -2
@@ -18,6 +18,7 @@ import { ElfUtil } from "./ElfUtil.js";
18
18
  * @property {string=} fontStyle
19
19
  * @property {string=} textAlign
20
20
  * @property {string=} textDecoration
21
+ * @property {string=} cssClass Predefined color class name
21
22
  */
22
23
 
23
24
  /** @typedef {Object.<string, string>} CellPainter~ThemeColors
@@ -517,14 +518,21 @@ CellPainter.prototype.renderForPrinting = function(cell, rowData, min, max) {
517
518
  return;
518
519
  }
519
520
  var styles = this._getStyles(rowData, min, max);
520
- var c = styles["backgroundColor"];
521
- if(c) {
522
- cell.style.backgroundColor = c;
523
- }
524
-
525
- c = styles["color"];
526
- if(c) {
527
- cell.style.color = c;
521
+ var cssClass = styles["cssClass"];
522
+ if (cssClass) {
523
+ if (cell._coloringCssClass !== cssClass) {
524
+ cell.classList.remove(cell._coloringCssClass);
525
+ cell._coloringCssClass = null;
526
+ }
527
+ cell.classList.add(cssClass);
528
+ cell._coloringCssClass = cssClass;
529
+ } else {
530
+ if (cell._coloringCssClass) {
531
+ cell.classList.remove(cell._coloringCssClass);
532
+ cell._coloringCssClass = null;
533
+ }
534
+ cell.style.backgroundColor = styles["backgroundColor"] || "";
535
+ cell.style.color = styles["color"] || "";
528
536
  }
529
537
  };
530
538
 
@@ -650,8 +658,24 @@ CellPainter._cellRestorer = function(scope) {
650
658
  }
651
659
 
652
660
  var styles = this._getStyles(rowData, min, max);
653
- elem.style.backgroundColor = styles["backgroundColor"] || "";
654
- elem.style.color = styles["color"] || "";
661
+ var cssClass = styles["cssClass"];
662
+ if (cssClass) {
663
+ if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
664
+ elem.classList.remove(elem._coloringCssClass);
665
+ elem._coloringCssClass = null;
666
+ }
667
+ elem.classList.add(cssClass);
668
+ elem._coloringCssClass = cssClass;
669
+ elem.style.backgroundColor = "";
670
+ elem.style.color = "";
671
+ } else {
672
+ if (elem._coloringCssClass) {
673
+ elem.classList.remove(elem._coloringCssClass);
674
+ elem._coloringCssClass = null;
675
+ }
676
+ elem.style.backgroundColor = styles["backgroundColor"] || "";
677
+ elem.style.color = styles["color"] || "";
678
+ }
655
679
  }
656
680
  };
657
681
 
@@ -1000,11 +1024,25 @@ CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
1000
1024
  }
1001
1025
 
1002
1026
  var styles = this._getStyles(rowData, min, max);
1003
- var ss = CellPainter.bgStyles;
1004
- var elStyle = elem.style;
1005
- for (var n = ss.length; --n >= 0;) {
1006
- var styleName = ss[n];
1007
- elStyle[styleName] = styles[styleName] || "";
1027
+ var cssClass = styles["cssClass"];
1028
+ if (cssClass) {
1029
+ if (elem._coloringCssClass !== cssClass) {
1030
+ elem.classList.remove(elem._coloringCssClass);
1031
+ elem._coloringCssClass = null;
1032
+ }
1033
+ elem.classList.add(cssClass);
1034
+ elem._coloringCssClass = cssClass;
1035
+ } else {
1036
+ if (elem._coloringCssClass) {
1037
+ elem.classList.remove(elem._coloringCssClass);
1038
+ elem._coloringCssClass = null;
1039
+ }
1040
+ var ss = CellPainter.bgStyles;
1041
+ var elStyle = elem.style;
1042
+ for (var n = ss.length; --n >= 0;) {
1043
+ var styleName = ss[n];
1044
+ elStyle[styleName] = styles[styleName] || "";
1045
+ }
1008
1046
  }
1009
1047
  };
1010
1048
 
@@ -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
@@ -129,6 +129,12 @@ declare class ColumnStackPlugin extends GridPlugin {
129
129
 
130
130
  public moveColumnById(srcCol: number|string|null, destCol?: (number|string)|null): boolean;
131
131
 
132
+ public hideStack(stackId: string): void;
133
+
134
+ public showStack(stackId: string): void;
135
+
136
+ public isStackHidden(stackId: string): boolean|null|null;
137
+
132
138
  }
133
139
 
134
140
  export default ColumnStackPlugin;
@@ -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
 
@@ -0,0 +1,3 @@
1
+ import {DataGenerator} from "../tr-grid-util/es6/jet/DataGenerator.js"
2
+ import {MockRTK} from "../tr-grid-util/es6/jet/MockRTK.js"
3
+ export {DataGenerator, MockRTK}
@@ -0,0 +1,3 @@
1
+ import {DataGenerator} from "../tr-grid-util/es6/jet/DataGenerator.js"
2
+ import {MockRTK} from "../tr-grid-util/es6/jet/MockRTK.js"
3
+ export {DataGenerator, MockRTK}
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.87",
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,13 +12,13 @@
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.52",
16
- "tr-grid-conditional-coloring": "1.0.57",
15
+ "tr-grid-column-stack": "1.0.54",
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",
19
19
  "tr-grid-filter-input": "0.9.31",
20
20
  "tr-grid-heat-map": "1.0.28",
21
- "tr-grid-in-cell-editing": "1.0.75",
21
+ "tr-grid-in-cell-editing": "1.0.77",
22
22
  "tr-grid-pagination": "1.0.24",
23
23
  "tr-grid-percent-bar": "1.0.22",
24
24
  "tr-grid-printer": "1.0.16",
package/package.json CHANGED
@@ -24,6 +24,9 @@
24
24
  "grid": [
25
25
  "lib/grid/lib/efx-grid.d.ts"
26
26
  ],
27
+ "utils": [
28
+ "lib/utils/index.d.ts"
29
+ ],
27
30
  "*": [
28
31
  "lib/types/index.d.ts"
29
32
  ]
@@ -53,7 +56,8 @@
53
56
  "./extensions": "./lib/index.js",
54
57
  "./window-exporter": "./lib/window-exporter.js",
55
58
  "./grid": "./lib/grid/lib/efx-grid.js",
56
- "./formatters/": "./lib/formatters/es6/"
59
+ "./formatters/": "./lib/formatters/es6/",
60
+ "./utils": "./lib/utils/index.js"
57
61
  },
58
62
  "peerDependencies": {
59
63
  "@refinitiv-ui/core": "^6.2.0",
@@ -62,5 +66,5 @@
62
66
  "publishConfig": {
63
67
  "access": "public"
64
68
  },
65
- "version": "6.0.28"
69
+ "version": "6.0.30"
66
70
  }