@refinitiv-ui/efx-grid 6.0.141 → 6.0.143

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.141" };
3
+ window.EFX_GRID = { version: "6.0.143" };
@@ -20,7 +20,8 @@ declare namespace RowFilteringPlugin {
20
20
  type ColumnOptions = {
21
21
  filter?: RowFilteringPlugin.Expression|null,
22
22
  filterState?: any,
23
- filterIcon?: boolean|null
23
+ filterIcon?: boolean|null,
24
+ filterDialogOptions?: RowFilteringPlugin.FilterDialogOptions|null
24
25
  };
25
26
 
26
27
  type FilterDialogOptions = {
@@ -74,6 +74,7 @@ The expression can take various forms:<br>
74
74
  * @property {RowFilteringPlugin~Expression=} filter An expression string or Function
75
75
  * @property {*=} filterState Context object that will be passed as the third parameter for the filter logic
76
76
  * @property {boolean=} filterIcon=true If disabled, filter icon will not be shown. This property only works with "always" mode
77
+ * @property {RowFilteringPlugin~FilterDialogOptions=} filterDialogOptions=null Configuration for Filter Dialog, applying to column.
77
78
  */
78
79
 
79
80
  /** @typedef {Object} RowFilteringPlugin~FilterDialogOptions
@@ -614,6 +615,11 @@ RowFilteringPlugin.prototype.getConfigObject = function (gridOptions) {
614
615
  if(!filterIcon) {
615
616
  column.filterIcon = false;
616
617
  }
618
+
619
+ let filterDialogOptions = colSettings.filterDialogOptions;
620
+ if(filterDialogOptions != null) {
621
+ column.filterDialogOptions = colSettings.filterDialogOptions;
622
+ }
617
623
  }
618
624
 
619
625
  let extOptions = obj.rowFiltering;
@@ -914,6 +920,11 @@ RowFilteringPlugin.prototype._setColumnOptions = function(colIndex, userObj) {
914
920
  this._updateColumnIcon(colIndex);
915
921
  }
916
922
 
923
+ let filterDialogOptions = userObj["filterDialogOptions"];
924
+ if(filterDialogOptions != null) {
925
+ colSettings.filterDialogOptions = filterDialogOptions;
926
+ }
927
+
917
928
  return (exp != null);
918
929
  };
919
930
  /** @private
@@ -1925,11 +1936,15 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
1925
1936
 
1926
1937
  let columnDialogOptions = null;
1927
1938
  let colSettings = this._getUserColumnSettings(colIndex); // colData["rowFiltering"]
1939
+ if(colSettings.filterDialogOptions) {
1940
+ columnDialogOptions = colSettings.filterDialogOptions;
1941
+ }
1928
1942
  if(colSettings.fieldDataType){
1929
1943
  // TODO: Use data type from Composite Grid (getColumnDataType) or Realtime Grid (getDataType) instead
1930
- columnDialogOptions = {
1931
- fieldDataType: colSettings.fieldDataType
1932
- };
1944
+ if(!columnDialogOptions) {
1945
+ columnDialogOptions = {};
1946
+ }
1947
+ columnDialogOptions.fieldDataType = colSettings.fieldDataType;
1933
1948
  }
1934
1949
 
1935
1950
  RowFilteringPlugin._overrideConfig(dialogConfig, this._dialogOptions);
@@ -56,12 +56,8 @@ declare class CellPainter {
56
56
 
57
57
  public resetColoring(): void;
58
58
 
59
- public resetBlinking(): void;
60
-
61
59
  public clearBlinking(): void;
62
60
 
63
- public resetHeatMap(): void;
64
-
65
61
  public clearHeatMap(): boolean;
66
62
 
67
63
  public applyThemeColor(): void;
@@ -122,7 +118,7 @@ declare class CellPainter {
122
118
 
123
119
  public static getOppositeColor(hexCode: string|(number)[]|null): string;
124
120
 
125
- public render(cell: any, rowData: any, min: number, max: number, changedCols?: any): void;
121
+ public render(cell: any, rowData: any, min: number, max: number): void;
126
122
 
127
123
  public renderHeatMap(cell: any, rowData: any, min: number, max: number): void;
128
124
 
@@ -132,8 +128,6 @@ declare class CellPainter {
132
128
 
133
129
  public flash(cell: any, blinkColor: string|null|null, rowData: any): boolean;
134
130
 
135
- public _blink(scope: any, elem: Element|null, blinkColor: string, contrastColor: string): boolean;
136
-
137
131
  public blinkCell(cell: any, newValue: number, oldValue: number, rowData: any): boolean;
138
132
 
139
133
  public verifyBlinking(cell: any, rowData: any): void;
@@ -35,14 +35,25 @@ import { ExpressionParser } from "./ExpressionParser.js";
35
35
  * @property {string=} tickDown Color for negative tick icon
36
36
  */
37
37
 
38
- /** @constructor */
39
-
38
+ /** @constructor
39
+ */
40
40
  let CellPainter = function() {
41
41
  this._conditions = [];
42
42
  this._scopes = [];
43
43
 
44
44
  CellPainter._painters.push(this); // For later referencing
45
45
  };
46
+ /** @private
47
+ * @function
48
+ * @param {Element} elem
49
+ * @param {string=} targetClass
50
+ */
51
+ let _removeCssClass = function(elem, targetClass) {
52
+ if (elem._coloringCssClass != null && elem._coloringCssClass !== targetClass) {
53
+ elem.classList.remove(elem._coloringCssClass);
54
+ elem._coloringCssClass = null;
55
+ }
56
+ };
46
57
 
47
58
  /** Enum for coloring types.
48
59
  * @enum {number}
@@ -165,25 +176,7 @@ CellPainter.prototype.dispose = function() {
165
176
  /** @public */
166
177
  CellPainter.prototype.reset = function() {
167
178
  this._setColoringType(0);
168
-
169
- let len = this._scopes.length;
170
- if(len) {
171
- for(let i = 0; i < len; ++i) {
172
- let scope = this._scopes[i];
173
- if(CellPainter._clearBlinkTimer(scope)) {
174
- scope._restorer();
175
- }
176
- let cell = scope["cell"];
177
- if(cell) {
178
- delete cell["blinking"]; // Delete cell blinking scope
179
- }
180
-
181
- scope["cell"] = null;
182
- }
183
- this._scopes.length = 0;
184
- }
185
-
186
- this._blinkCondition = null;
179
+ this.clearBlinking();
187
180
  };
188
181
 
189
182
  /** @public */
@@ -194,12 +187,6 @@ CellPainter.prototype.resetColoring = function() {
194
187
  this._conditions.length = 0;
195
188
  };
196
189
 
197
- /** @public */
198
- CellPainter.prototype.resetBlinking = function() {
199
- this._blinkCondition = null;
200
- this._scopes.length = 0;
201
- };
202
-
203
190
  /** @public */
204
191
  CellPainter.prototype.clearBlinking = function() {
205
192
  this._blinkCondition = null;
@@ -220,12 +207,11 @@ CellPainter.prototype.clearBlinking = function() {
220
207
  this._scopes.length = 0;
221
208
  }
222
209
  };
223
-
224
- /** @public */
225
- CellPainter.prototype.resetHeatMap = function() {
226
- this._conditions.length = 0;
227
- this._columnStats = null;
228
- };
210
+ /** @public
211
+ * @ignore
212
+ * @function
213
+ */
214
+ CellPainter.prototype.resetBlinking = CellPainter.prototype.clearBlinking;
229
215
 
230
216
  /** Return true if no one is using this painter
231
217
  * @public
@@ -241,6 +227,14 @@ CellPainter.prototype.clearHeatMap = function() {
241
227
  return true;
242
228
  }
243
229
  };
230
+ /** @public
231
+ * @ignore
232
+ * @function
233
+ */
234
+ CellPainter.prototype.resetHeatMap = function() {
235
+ this._conditions.length = 0;
236
+ this._columnStats = null;
237
+ };
244
238
 
245
239
  /** @public */
246
240
  CellPainter.prototype.applyThemeColor = function() {
@@ -308,7 +302,7 @@ CellPainter.prototype.setConditions = function(conditions) {
308
302
  this._conditions.length = 0; // TODO: Clear existing cell styles first
309
303
  this._setColoringType(CellPainter.ColoringTypes.CONDITIONAL);
310
304
 
311
- let len = conditions.length;
305
+ let len = conditions ? conditions.length : 0;
312
306
  for (let i = 0; i < len; i++) {
313
307
  this._addCondition(conditions[i]);
314
308
  }
@@ -400,6 +394,7 @@ CellPainter.prototype._addColorText = function(expression, field, upClass, downC
400
394
  condition["upClass"] = upClass;
401
395
  condition["downClass"] = downClass;
402
396
  condition["levelClass"] = levelClass;
397
+ // TODO: Make this consistent with other type (e.g., heat map and blinking)
403
398
 
404
399
  this._addCondition(condition);
405
400
  return condition;
@@ -526,20 +521,14 @@ CellPainter.prototype.renderForPrinting = function(cell, rowData, min, max) {
526
521
  }
527
522
  let styles = this._getStyles(rowData, min, max);
528
523
  let cssClass = styles["cssClass"]; // Can be an empty string
524
+
525
+ _removeCssClass(cell, cssClass);
529
526
  if (cssClass != null) { // Predefined colors mode
530
- if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
531
- elem.classList.remove(elem._coloringCssClass);
532
- elem._coloringCssClass = null;
533
- }
534
527
  if (cssClass) {
535
- elem.classList.add(cssClass);
536
- elem._coloringCssClass = cssClass;
528
+ cell.classList.add(cssClass);
529
+ cell._coloringCssClass = cssClass;
537
530
  }
538
531
  } else {
539
- if (cell._coloringCssClass) {
540
- cell.classList.remove(cell._coloringCssClass);
541
- cell._coloringCssClass = null;
542
- }
543
532
  cell.style.backgroundColor = styles["backgroundColor"] || "";
544
533
  cell.style.color = styles["color"] || "";
545
534
  }
@@ -660,11 +649,8 @@ CellPainter._cellRestorer = function(scope) {
660
649
 
661
650
  let styles = this._getStyles(rowData, min, max);
662
651
  let cssClass = styles["cssClass"]; // Can be an empty string
652
+ _removeCssClass(elem, cssClass);
663
653
  if (cssClass != null) { // Predefined colors mode
664
- if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
665
- elem.classList.remove(elem._coloringCssClass);
666
- elem._coloringCssClass = null;
667
- }
668
654
  if (cssClass) {
669
655
  elem.classList.add(cssClass);
670
656
  elem._coloringCssClass = cssClass;
@@ -673,10 +659,6 @@ CellPainter._cellRestorer = function(scope) {
673
659
  elem.style.backgroundColor = "";
674
660
  elem.style.color = "";
675
661
  } else {
676
- if (elem._coloringCssClass) {
677
- elem.classList.remove(elem._coloringCssClass);
678
- elem._coloringCssClass = null;
679
- }
680
662
  elem.style.backgroundColor = styles["backgroundColor"] || "";
681
663
  elem.style.color = styles["color"] || "";
682
664
  }
@@ -728,10 +710,12 @@ CellPainter.prototype._getStyles = function(rowData, min, max) {
728
710
  curCond["cssClass"] = curCond["upClass"];
729
711
  } else if(ret < 0) {
730
712
  curCond["cssClass"] = curCond["downClass"];
731
- } else {
713
+ } else if(ret === 0) {
732
714
  curCond["cssClass"] = curCond["levelClass"];
715
+ } // else case is no change in cssClass
716
+ if(!curCond["cssClass"]) {
717
+ curCond["cssClass"] = ""; // If no cssClass, remove existing one
733
718
  }
734
- curCond["cssClass"] = curCond["cssClass"] || "";
735
719
  return curCond;
736
720
  }
737
721
 
@@ -864,9 +848,7 @@ CellPainter.clearCellStyle = function(cell, styles) {
864
848
  // WARNING: Scope is not removed from the this._scopes collection to speed things up
865
849
  }
866
850
 
867
- if(elem._coloringCssClass) {
868
- elem.classList.remove(elem._coloringCssClass);
869
- }
851
+ _removeCssClass(elem);
870
852
 
871
853
  if(!styles){
872
854
  styles = CellPainter.supportedStyles;
@@ -949,9 +931,8 @@ CellPainter.getOppositeColor = function (hexCode) {
949
931
  * @param {Object} rowData e.g. { PCTCHNG: 0.53, CF_NETCHNG: 0.75 }
950
932
  * @param {number} min
951
933
  * @param {number} max
952
- * @param {Object=} changedCols
953
934
  */
954
- CellPainter.prototype.render = function (cell, rowData, min, max, changedCols) {
935
+ CellPainter.prototype.render = function (cell, rowData, min, max) {
955
936
  if (min != null && min === min) { // Render heatmap
956
937
  this._paintCell(cell, rowData, min, max);
957
938
  } else if (this._conditions.length && this._coloringType === CellPainter.ColoringTypes.CONDITIONAL) { // Render conditional-coloring
@@ -1005,10 +986,7 @@ CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
1005
986
  let elStyle = elem.style;
1006
987
 
1007
988
  let cssClass = styles["cssClass"]; // Can be an empty string
1008
- if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
1009
- elem.classList.remove(elem._coloringCssClass);
1010
- elem._coloringCssClass = null;
1011
- }
989
+ _removeCssClass(elem, cssClass);
1012
990
  if (cssClass != null) { // Predefined colors mode
1013
991
  if (cssClass) {
1014
992
  elem.classList.add(cssClass);
@@ -1086,7 +1064,8 @@ CellPainter.prototype.blink = function (cell, blinkSignal, rowData) {
1086
1064
  contrastColor = bc["contrastLevelColor"];
1087
1065
  }
1088
1066
 
1089
- return this._blink(scope, elem, blinkColor, contrastColor);
1067
+ this._blink(scope, elem, blinkColor, contrastColor);
1068
+ return true;
1090
1069
  };
1091
1070
 
1092
1071
  /** Blink cell with specific color or theme's neutral movement color.
@@ -1112,32 +1091,30 @@ CellPainter.prototype.flash = function(cell, blinkColor, rowData) {
1112
1091
  blinkColor = ElfUtil.themeColors["level"];
1113
1092
  }
1114
1093
 
1115
- return this._blink(scope, elem, blinkColor, CellPainter.getOppositeColor(blinkColor));
1094
+ this._blink(scope, elem, blinkColor, CellPainter.getOppositeColor(blinkColor));
1095
+ return true;
1116
1096
  };
1117
1097
 
1118
- /**
1119
- * @public
1098
+ /** @private
1120
1099
  * @param {Object} scope
1121
1100
  * @param {Element} elem
1122
1101
  * @param {string} blinkColor
1123
1102
  * @param {string} contrastColor
1124
- * @return {boolean}
1103
+ * @return {boolean} Returns true if it is a background blinking, otherwise returns false
1125
1104
  */
1126
1105
  CellPainter.prototype._blink = function (scope, elem, blinkColor, contrastColor) {
1127
- let bgBlinking = true;
1106
+ CellPainter._clearBlinkTimer(scope);
1107
+ scope["blinkTimer"] = setTimeout(scope._restorer, this._blinkingDuration);
1128
1108
 
1129
1109
  if (this._blinkCondition["border"]) {
1130
1110
  elem.style.border = "1px solid " + blinkColor;
1131
- bgBlinking = false;
1111
+ return false;
1132
1112
  } else {
1133
1113
  elem.style.backgroundColor = blinkColor;
1134
1114
  elem.style.color = contrastColor;
1135
1115
  }
1136
1116
 
1137
- CellPainter._clearBlinkTimer(scope);
1138
- scope["blinkTimer"] = setTimeout(scope._restorer, this._blinkingDuration);
1139
-
1140
- return bgBlinking;
1117
+ return true;
1141
1118
  };
1142
1119
 
1143
1120
  /**
@@ -8,6 +8,8 @@ declare namespace ElfUtil {
8
8
 
9
9
  const themeColors: { [key: string]: string }|null;
10
10
 
11
+ function setElfVersion(ver: number): void;
12
+
11
13
  function getElfVersion(): number;
12
14
 
13
15
  function hasComponent(compName: string): number;
@@ -22,7 +24,7 @@ declare namespace ElfUtil {
22
24
 
23
25
  function isHaloTheme(themeName?: string|null): boolean;
24
26
 
25
- function injectIcons(configObj: any, optElem?: Element|null): void;
27
+ function injectIcons(configObj: any): void;
26
28
 
27
29
  function getIconList(): (string)[];
28
30
 
@@ -116,6 +116,15 @@ ElfUtil._icons = {
116
116
  ElfUtil._icons["halo-theme"] = ElfUtil._icons["elf-theme-halo"];
117
117
  ElfUtil._icons["solar-theme"] = ElfUtil._icons["elf-theme-solar"];
118
118
 
119
+
120
+ /** Set ELF version for testing purpose
121
+ * @public
122
+ * @function
123
+ * @param {number} ver
124
+ */
125
+ ElfUtil.setElfVersion = function (ver) {
126
+ ElfUtil._elfVersion = ver;
127
+ };
119
128
  /** Check ELF version
120
129
  * @public
121
130
  * @function
@@ -279,9 +288,8 @@ ElfUtil.isHaloTheme = function (themeName) {
279
288
  * @public
280
289
  * @function
281
290
  * @param {Object} configObj Object to mutate
282
- * @param {Element=} optElem Deprecated param: will no longer use anymore
283
291
  */
284
- ElfUtil.injectIcons = function (configObj, optElem) {
292
+ ElfUtil.injectIcons = function (configObj) {
285
293
  if (typeof configObj !== "object") { return; }
286
294
 
287
295
  let theme = ElfUtil.getThemeName();
@@ -533,7 +541,8 @@ ElfUtil._profileNameRetrieved = function() {
533
541
  };
534
542
 
535
543
  /** Get theme colors from document
536
- * @private
544
+ * @public
545
+ * @ignore
537
546
  * @param {string} profileName Movement color profile name
538
547
  */
539
548
  ElfUtil._retrieveThemeColors = function(profileName) {
@@ -18,7 +18,8 @@ Icon.create = function(iconName, className) {
18
18
  return icon;
19
19
  };
20
20
 
21
- /** @public
21
+ /** Create a container element with an icon element in it.
22
+ * @public
22
23
  * @function
23
24
  * @param {string=} iconName
24
25
  * @param {string=} className Class name for the containing box
@@ -48,7 +48,7 @@ declare class RowDefinition {
48
48
 
49
49
  public getType(): string;
50
50
 
51
- public setDataSource(dataSource: DataCache|null, subs?: any): void;
51
+ public setDataSource(dataSource: DataCache|null, subs?: any): boolean;
52
52
 
53
53
  public getDataSource(): DataCache|null;
54
54
 
@@ -20,7 +20,8 @@ declare namespace RowFilteringPlugin {
20
20
  type ColumnOptions = {
21
21
  filter?: RowFilteringPlugin.Expression|null,
22
22
  filterState?: any,
23
- filterIcon?: boolean|null
23
+ filterIcon?: boolean|null,
24
+ filterDialogOptions?: RowFilteringPlugin.FilterDialogOptions|null
24
25
  };
25
26
 
26
27
  type FilterDialogOptions = {
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.169",
2
+ "tr-grid-util": "1.3.172",
3
3
  "tr-grid-printer": "1.0.18",
4
4
  "@grid/column-dragging": "1.0.21",
5
5
  "@grid/row-segmenting": "2.0.1",
@@ -24,7 +24,7 @@
24
24
  "tr-grid-percent-bar": "1.0.24",
25
25
  "tr-grid-range-bar": "2.0.9",
26
26
  "tr-grid-row-dragging": "1.0.38",
27
- "tr-grid-row-filtering": "1.0.88",
27
+ "tr-grid-row-filtering": "1.0.89",
28
28
  "tr-grid-row-grouping": "1.0.88",
29
29
  "tr-grid-row-selection": "1.0.33",
30
30
  "tr-grid-rowcoloring": "1.0.26",
package/package.json CHANGED
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "version": "6.0.141"
72
+ "version": "6.0.143"
73
73
  }