@refinitiv-ui/efx-grid 6.0.41 → 6.0.43

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 (91) hide show
  1. package/lib/column-format-dialog/lib/column-format-dialog.d.ts +1 -0
  2. package/lib/column-format-dialog/lib/column-format-dialog.js +3 -24
  3. package/lib/column-format-dialog/lib/preview-table.d.ts +1 -1
  4. package/lib/column-format-dialog/lib/preview-table.js +15 -27
  5. package/lib/core/dist/core.js +843 -871
  6. package/lib/core/dist/core.min.js +1 -1
  7. package/lib/core/es6/grid/Core.d.ts +4 -0
  8. package/lib/core/es6/grid/Core.js +67 -2
  9. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +3 -2
  10. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +32 -26
  11. package/lib/core/es6/grid/util/util.js +25 -9
  12. package/lib/formatters/es6/CoralButtonFormatter.d.ts +2 -2
  13. package/lib/formatters/es6/CoralCheckboxFormatter.d.ts +1 -1
  14. package/lib/formatters/es6/CoralComboBoxFormatter.d.ts +4 -4
  15. package/lib/formatters/es6/CoralIconFormatter.d.ts +3 -3
  16. package/lib/formatters/es6/CoralInputFormatter.d.ts +1 -1
  17. package/lib/formatters/es6/CoralRadioButtonFormatter.d.ts +2 -2
  18. package/lib/formatters/es6/CoralSelectFormatter.d.ts +4 -4
  19. package/lib/formatters/es6/CoralToggleFormatter.d.ts +1 -1
  20. package/lib/formatters/es6/DuplexEmeraldDateTimePickerFormatter.d.ts +1 -1
  21. package/lib/formatters/es6/EFButtonFormatter.d.ts +2 -2
  22. package/lib/formatters/es6/EFCheckboxFormatter.d.ts +1 -1
  23. package/lib/formatters/es6/EFComboBoxFormatter.d.ts +4 -4
  24. package/lib/formatters/es6/EFDateTimePickerFormatter.d.ts +1 -1
  25. package/lib/formatters/es6/EFIconFormatter.d.ts +3 -3
  26. package/lib/formatters/es6/EFNumberFieldFormatter.d.ts +1 -1
  27. package/lib/formatters/es6/EFRadioButtonFormatter.d.ts +2 -2
  28. package/lib/formatters/es6/EFSelectFormatter.d.ts +4 -4
  29. package/lib/formatters/es6/EFTextFieldFormatter.d.ts +1 -1
  30. package/lib/formatters/es6/EFToggleFormatter.d.ts +1 -1
  31. package/lib/formatters/es6/EmeraldDateTimePickerFormatter.d.ts +1 -1
  32. package/lib/formatters/es6/FormatterBuilder.d.ts +6 -2
  33. package/lib/formatters/es6/FormatterBuilder.js +328 -178
  34. package/lib/formatters/es6/NumericInputFormatter.d.ts +1 -1
  35. package/lib/formatters/es6/PercentBarFormatter.d.ts +6 -6
  36. package/lib/formatters/es6/SimpleImageFormatter.d.ts +3 -3
  37. package/lib/formatters/es6/SimpleInputFormatter.d.ts +1 -1
  38. package/lib/formatters/es6/SimpleLinkFormatter.d.ts +3 -3
  39. package/lib/formatters/es6/SimpleTickerFormatter.d.ts +3 -3
  40. package/lib/formatters/es6/SimpleToggleFormatter.d.ts +3 -3
  41. package/lib/formatters/es6/TextFormatter.d.ts +1 -1
  42. package/lib/grid/index.js +1 -1
  43. package/lib/rt-grid/dist/rt-grid.js +213 -44
  44. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  45. package/lib/rt-grid/es6/Grid.d.ts +24 -1
  46. package/lib/rt-grid/es6/Grid.js +92 -4
  47. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -0
  48. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +34 -19
  49. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +9 -3
  50. package/lib/tr-grid-column-stack/es6/ColumnStack.js +324 -388
  51. package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +17 -17
  52. package/lib/tr-grid-filter-input/es6/FilterInput.js +146 -33
  53. package/lib/tr-grid-util/es6/DateTime.js +3 -3
  54. package/lib/tr-grid-util/es6/GridPlugin.js +1 -1
  55. package/lib/types/es6/ColumnGrouping.d.ts +4 -0
  56. package/lib/types/es6/ColumnStack.d.ts +9 -3
  57. package/lib/types/es6/CoralButtonFormatter.d.ts +2 -2
  58. package/lib/types/es6/CoralCheckboxFormatter.d.ts +1 -1
  59. package/lib/types/es6/CoralComboBoxFormatter.d.ts +4 -4
  60. package/lib/types/es6/CoralIconFormatter.d.ts +3 -3
  61. package/lib/types/es6/CoralInputFormatter.d.ts +1 -1
  62. package/lib/types/es6/CoralRadioButtonFormatter.d.ts +2 -2
  63. package/lib/types/es6/CoralSelectFormatter.d.ts +4 -4
  64. package/lib/types/es6/CoralToggleFormatter.d.ts +1 -1
  65. package/lib/types/es6/Core/grid/Core.d.ts +4 -0
  66. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +3 -2
  67. package/lib/types/es6/DuplexEmeraldDateTimePickerFormatter.d.ts +1 -1
  68. package/lib/types/es6/EFButtonFormatter.d.ts +2 -2
  69. package/lib/types/es6/EFCheckboxFormatter.d.ts +1 -1
  70. package/lib/types/es6/EFComboBoxFormatter.d.ts +4 -4
  71. package/lib/types/es6/EFDateTimePickerFormatter.d.ts +1 -1
  72. package/lib/types/es6/EFIconFormatter.d.ts +3 -3
  73. package/lib/types/es6/EFNumberFieldFormatter.d.ts +1 -1
  74. package/lib/types/es6/EFRadioButtonFormatter.d.ts +2 -2
  75. package/lib/types/es6/EFSelectFormatter.d.ts +4 -4
  76. package/lib/types/es6/EFTextFieldFormatter.d.ts +1 -1
  77. package/lib/types/es6/EFToggleFormatter.d.ts +1 -1
  78. package/lib/types/es6/EmeraldDateTimePickerFormatter.d.ts +1 -1
  79. package/lib/types/es6/FilterInput.d.ts +17 -17
  80. package/lib/types/es6/FormatterBuilder.d.ts +6 -2
  81. package/lib/types/es6/NumericInputFormatter.d.ts +1 -1
  82. package/lib/types/es6/PercentBarFormatter.d.ts +6 -6
  83. package/lib/types/es6/RealtimeGrid/Grid.d.ts +22 -0
  84. package/lib/types/es6/SimpleImageFormatter.d.ts +3 -3
  85. package/lib/types/es6/SimpleInputFormatter.d.ts +1 -1
  86. package/lib/types/es6/SimpleLinkFormatter.d.ts +3 -3
  87. package/lib/types/es6/SimpleTickerFormatter.d.ts +3 -3
  88. package/lib/types/es6/SimpleToggleFormatter.d.ts +3 -3
  89. package/lib/types/es6/TextFormatter.d.ts +1 -1
  90. package/lib/versions.json +6 -6
  91. package/package.json +1 -1
@@ -20,6 +20,7 @@ import "@refinitiv-ui/elements/item";
20
20
  import "@refinitiv-ui/elements/color-dialog";
21
21
  import ElfUtil from "../../tr-grid-util/es6/ElfUtil.js";
22
22
  import { DATE_TIME, toDateTimeType } from "../../tr-grid-util/es6/FieldFormatter.js";
23
+ import ExpressionParser from "../../tr-grid-util/es6/ExpressionParser.js";
23
24
  import translation from "./locale/translation.js";
24
25
  import { PercentBar } from "../../tr-grid-util/es6/PercentBar.js";
25
26
  import ElementObserver from "../../tr-grid-util/es6/ElementObserver.js";
@@ -20,6 +20,7 @@ import "@refinitiv-ui/elements/item";
20
20
  import "@refinitiv-ui/elements/color-dialog";
21
21
  import ElfUtil from "../../tr-grid-util/es6/ElfUtil.js";
22
22
  import { DATE_TIME, toDateTimeType } from "../../tr-grid-util/es6/FieldFormatter.js";
23
+ import ExpressionParser from "../../tr-grid-util/es6/ExpressionParser.js";
23
24
  import translation from "./locale/translation.js";
24
25
  import { PercentBar } from "../../tr-grid-util/es6/PercentBar.js";
25
26
  import ElementObserver from "../../tr-grid-util/es6/ElementObserver.js";
@@ -1640,7 +1641,7 @@ class ColumnFormatDialog extends BasicElement {
1640
1641
  color: e.color,
1641
1642
  backgroundColor: e.backgroundColor
1642
1643
  };
1643
- e.conditionSequence = this._parseRowCondition(e.expression.text);
1644
+ e.conditionSequence = ExpressionParser.parse(e.expression.text);
1644
1645
  e.expressionObject = e.expression;
1645
1646
  return e;
1646
1647
  });
@@ -1651,28 +1652,6 @@ class ColumnFormatDialog extends BasicElement {
1651
1652
  }
1652
1653
  }
1653
1654
 
1654
- /**
1655
- * @private
1656
- * @param {string} expression - expression string
1657
- * @return {Function} - condition function
1658
- */
1659
- _parseRowCondition(expression) {
1660
- if (!expression) {
1661
- return null;
1662
- }
1663
-
1664
- var regEx = new RegExp(/\[[^[]*\]/g); // Regex for matching the field token E.g. "[CF_BID]"
1665
- expression = expression.replace(regEx, "value");
1666
- var finalExp = "(function(value) { return " + expression + "; })";
1667
-
1668
- var fn = null;
1669
- try {
1670
- // TODO: find a better way to avoid using eval
1671
- fn = eval(finalExp); // eslint-disable-line
1672
- } catch (err) { }
1673
- return fn;
1674
- }
1675
-
1676
1655
  /**
1677
1656
  * @private
1678
1657
  * @param {Object} item - condition item
@@ -2179,7 +2158,7 @@ class ColumnFormatDialog extends BasicElement {
2179
2158
  _setConditionalColor() {
2180
2159
  var conditionFunctions = this.conditions.map(e => {
2181
2160
  return {
2182
- conditionSequence: this._parseRowCondition(e.expression.text),
2161
+ conditionSequence: ExpressionParser.parse(e.expression.text),
2183
2162
  colors: {
2184
2163
  color: e.color,
2185
2164
  backgroundColor: e.backgroundColor
@@ -123,7 +123,7 @@ declare class PreviewTable extends ElementWrapper {
123
123
 
124
124
  public setDisplayStylePercentBarIsUsedMovement(isUsedMovement: boolean): void;
125
125
 
126
- public setDisplayStyleConditional(condition: PreviewTable.Conditional|null): void;
126
+ public setDisplayStyleConditional(conditionDefs: (PreviewTable.Conditional)[]|null): void;
127
127
 
128
128
  public setFormatType(type: string): void;
129
129
 
@@ -175,7 +175,7 @@ var PreviewTable = function (elem) {
175
175
 
176
176
  this._numberFormatter = new NumberFormatter();
177
177
 
178
- ElfUtil.getThemeColors().then(this._onThemeLoaded).catch(this._onThemeLoaded);
178
+ ElfUtil.getThemeColors().then(this._onThemeLoaded);
179
179
  setInterval(this._onIntervalUpdate, 1500);
180
180
 
181
181
  this._formatSampleValue();
@@ -344,26 +344,12 @@ PreviewTable.prototype.setDisplayStylePercentBarIsUsedMovement = function (isUse
344
344
  };
345
345
 
346
346
  /** @public
347
- * @param {PreviewTable~Conditional} condition - condition function
347
+ * @param {Array.<PreviewTable~Conditional>} conditionDefs - condition function
348
348
  */
349
- PreviewTable.prototype.setDisplayStyleConditional = function (condition) {
350
- var isEmpty = true;
351
-
352
- // Loop for check empty object
353
- for (var key in condition) {
354
- if (Object.hasOwnProperty.call(condition, key)) {
355
- isEmpty = false;
356
- }
357
- }
358
- if(!isEmpty) {
359
- this._configDisplayStyle.conditionFunction = condition;
360
- this._formatSampleValue();
361
- } else {
362
- // Set conditional false when object empty
363
- this._configDisplayStyle.conditionFunction = false;
364
- this._formatSampleValue();
365
- }
366
-
349
+ PreviewTable.prototype.setDisplayStyleConditional = function (conditionDefs) {
350
+ var count = conditionDefs ? conditionDefs.length : 0;
351
+ this._configDisplayStyle.conditionFunction = count ? conditionDefs : null;
352
+ this._formatSampleValue();
367
353
  };
368
354
 
369
355
 
@@ -831,14 +817,15 @@ PreviewTable.prototype._getSampleStyleObjects = function (blinking) {
831
817
  // conditional color section
832
818
  if (this._configDisplayStyle.mode === "conditionalColor") {
833
819
  if (this._configDisplayStyle.conditionFunction) {
820
+ var valObj = {"value": NaN};
834
821
  for (r = 0; r < rc; ++r) {
835
822
  for (c = 0; c < cc; ++c) {
836
823
  for (var i = 0; i < this._configDisplayStyle.conditionFunction.length; i++) {
837
824
  obj = objs[r][c];
838
- val = curDataset[r][c];
825
+ valObj["value"] = curDataset[r][c];
839
826
  var ret = null;
840
827
  try {
841
- ret = this._configDisplayStyle.conditionFunction[i].conditionSequence(val); // check value with function pass from another module
828
+ ret = this._configDisplayStyle.conditionFunction[i].conditionSequence(valObj); // check value with function pass from another module
842
829
  } catch (error) { } // do nothing
843
830
  if (ret) {
844
831
  obj.color = this._configDisplayStyle.conditionFunction[i].colors.color;
@@ -878,15 +865,15 @@ PreviewTable.prototype._getSampleStyleObjects = function (blinking) {
878
865
  var prevVal = prevDataset[r][c];
879
866
  var blinkColor = "";
880
867
  if (curVal >= prevVal) {
881
- blinkColor = this._configUpdateStyleValue.colors ? this._configUpdateStyleValue.colors.tickUp : "var(--color-scheme-tickup)";
868
+ blinkColor = this._colors ? this._colors.tickUp : "var(--color-scheme-tickup)";
882
869
  } else {
883
- blinkColor = this._configUpdateStyleValue.colors ? this._configUpdateStyleValue.colors.tickDown : "var(--color-scheme-tickdown)";
870
+ blinkColor = this._colors ? this._colors.tickDown : "var(--color-scheme-tickdown)";
884
871
  }
885
872
 
886
873
  // Blink border or background when value change
887
874
  if (this._configUpdateStyleValue.isBackgroundBlink) {
888
875
  obj.backgroundColor = blinkColor;
889
- obj.color = this._configUpdateStyleValue.colors ? CellPainter.getOppositeColor(blinkColor) : "";
876
+ obj.color = this._colors ? CellPainter.getOppositeColor(blinkColor) : "";
890
877
  } else {
891
878
  obj.borderColor = blinkColor;
892
879
  }
@@ -985,9 +972,10 @@ PreviewTable.prototype._updateValueFormatExample = function (val) {
985
972
 
986
973
  /**
987
974
  * @private
975
+ * @param {Object} colors
988
976
  */
989
- PreviewTable.prototype._onThemeLoaded = function () {
990
- this._configUpdateStyleValue.colors = ElfUtil.getColors();
977
+ PreviewTable.prototype._onThemeLoaded = function (colors) {
978
+ this._colors = colors;
991
979
  };
992
980
 
993
981
  export default PreviewTable;