@refinitiv-ui/efx-grid 6.0.78 → 6.0.79

Sign up to get free protection for your applications and to get access to all the features.
@@ -73,7 +73,9 @@ const TEXT_FILTERS = [
73
73
  DEFAULT_FILTERS[6],
74
74
  DEFAULT_FILTERS[7],
75
75
  DEFAULT_FILTERS[8],
76
- DEFAULT_FILTERS[9]
76
+ DEFAULT_FILTERS[9],
77
+ DEFAULT_FILTERS[10],
78
+ DEFAULT_FILTERS[11]
77
79
  ];
78
80
  /** @type {Array.<Array>}
79
81
  * @private
@@ -736,7 +738,7 @@ class FilterDialog extends BasicElement {
736
738
  var fdt = dateTimeType ? dateTimeType : this.fieldDataType.toLowerCase();
737
739
  if(fdt === "number") {
738
740
  filterItems = NUMBER_FILTERS;
739
- } else if(fdt === "general" || fdt === "text") {
741
+ } else if(fdt === "string" || fdt === "text") {
740
742
  filterItems = TEXT_FILTERS;
741
743
  } else {
742
744
  filterItems = DEFAULT_FILTERS;
@@ -5,6 +5,10 @@ var onElementUpdated = function (element, ctx) {
5
5
  element.textContent = ctx.value;
6
6
  };
7
7
 
8
+ var onElementCreated = function (element, ctx) {
9
+ element.classList.add("text");
10
+ };
11
+
8
12
  /** @constructor
9
13
  * @param {*=} options
10
14
  */
@@ -20,7 +24,8 @@ TextFormatter.create = function (options) {
20
24
  var defaultOpt = {
21
25
  tagName: "div",
22
26
  refName: "TextFormatter",
23
- onElementUpdated: onElementUpdated
27
+ onElementUpdated: onElementUpdated,
28
+ onElementCreated: onElementCreated
24
29
  };
25
30
 
26
31
  return FormatterBuilder.create(options, defaultOpt);
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.78" };
3
+ window.EFX_GRID = { version: "6.0.79" };
@@ -1111,12 +1111,12 @@ CheckboxPlugin.prototype._getSectionState = function (sectionSettings) {
1111
1111
  }
1112
1112
  };
1113
1113
  /** @private
1114
- * @param {Object} sectionSettings Grid sectionSettings object
1114
+ * @param {Object} sectionSettings Section or SectionSettings
1115
1115
  * @param {number} rowIndex
1116
1116
  * @return {Element}
1117
1117
  */
1118
1118
  CheckboxPlugin.prototype._getCheckbox = function (sectionSettings, rowIndex) {
1119
- var section = sectionSettings.getSection();
1119
+ var section = sectionSettings.getSection ? sectionSettings.getSection() : sectionSettings;
1120
1120
  var chkbox = /** @type{Element} */(section.getCellContent(this._displayColumn, rowIndex));
1121
1121
  if (!chkbox) {
1122
1122
  return null;
@@ -1444,9 +1444,30 @@ CheckboxPlugin.prototype._onCheckboxClicked = function (e) {
1444
1444
  * @param {Event} e
1445
1445
  */
1446
1446
  CheckboxPlugin.prototype._onCheckboxKeydown = function (e) {
1447
- if(e.keyCode === 32) {
1447
+ var keyCode = e.keyCode;
1448
+ if(keyCode === 32) {
1449
+ this._onCheckboxMousedown(e); // Set anchor if no shift key is pressed
1448
1450
  this._onCheckboxChanged(e, true);
1449
1451
  e.preventDefault();
1452
+ } if(keyCode === 38 || keyCode === 40) { // Arrow key up and down
1453
+ var host = this._hosts[0];
1454
+ var pos = host.getRelativePosition(e.currentTarget);
1455
+ if(pos.sectionType === "content") {
1456
+ var dv = host.getDataSource();
1457
+ var offset = (keyCode === 38) ? -1 : 1;
1458
+ var nextIndex = pos.rowIndex + offset;
1459
+ var rowId = dv.getRowId(nextIndex);
1460
+ if(rowId) {
1461
+ host.scrollToRow(null, nextIndex);
1462
+ var chkbox = this._getCheckbox(pos.section, nextIndex);
1463
+ if(chkbox) {
1464
+ chkbox.focus();
1465
+ }
1466
+ e.preventDefault();
1467
+ }
1468
+ }
1469
+
1470
+
1450
1471
  }
1451
1472
  };
1452
1473
  /** @private
@@ -111,6 +111,8 @@ declare class RowGroupingPlugin extends GridPlugin {
111
111
 
112
112
  public enableFooterRow(opt_num?: (boolean|number)|null): void;
113
113
 
114
+ public getFooterRowCount(): number;
115
+
114
116
  }
115
117
 
116
118
  declare function isNonFunction(obj: any): boolean;
@@ -650,7 +650,7 @@ RowGroupingPlugin.prototype.getConfigObject = function (gridOptions) {
650
650
  extOptions.headerSpanning = this._headerSpanning;
651
651
  }
652
652
  if(this._footerSpanning) {
653
- extOptions.headerSpanning = this._footerSpanning;
653
+ extOptions.footerSpanning = this._footerSpanning;
654
654
  }
655
655
  if(this._autoGroupSorting) {
656
656
  extOptions.autoGroupSorting = this._autoGroupSorting;
@@ -1165,6 +1165,13 @@ RowGroupingPlugin.prototype._onGroupAdded = function (e) {
1165
1165
  if (this._footerRows) {
1166
1166
  e.newGroup.addFooter(this._footerRows);
1167
1167
  }
1168
+ var newGroup = e.newGroup;
1169
+ // WARNING: contentAsHeader mode is overwrite arrow hidden to boolean
1170
+ if(!this._contentAsHeader && newGroup.disableCollapsing) {
1171
+ if(this._isArrowHidden(newGroup)) {
1172
+ newGroup.disableCollapsing();
1173
+ }
1174
+ }
1168
1175
  this._dispatch("groupAdded", e);
1169
1176
 
1170
1177
  if (this._autoGroupSorting) {
@@ -1502,6 +1509,9 @@ RowGroupingPlugin.prototype._onCellClicked = function (e) {
1502
1509
  var grpView = dv.getGroupByRowId(rowId);
1503
1510
  if (grpView) {
1504
1511
  changed = true;
1512
+ if(grpView.isCollapsible && !grpView.isCollapsible()) { // Prevent applied styles
1513
+ return;
1514
+ }
1505
1515
  grpView.collapse(!collapsed);
1506
1516
  } else if (this._contentAsHeader) {
1507
1517
  changed = true;
@@ -1656,6 +1666,13 @@ RowGroupingPlugin.prototype.enableFooterRow = function (opt_num) {
1656
1666
  this._footerRows = /** @type{number} */(opt_num);
1657
1667
  };
1658
1668
 
1669
+ /** @public
1670
+ * @return {number}
1671
+ */
1672
+ RowGroupingPlugin.prototype.getFooterRowCount = function () {
1673
+ return this._footerRows;
1674
+ };
1675
+
1659
1676
  /** @function
1660
1677
  * @param {Object} obj
1661
1678
  * @return {boolean}
@@ -1,6 +1,8 @@
1
1
  import {Ext} from "./Ext.js";
2
2
  import {EventDispatcher} from "./EventDispatcher.js";
3
3
  import {Deferred} from "./Deferred.js";
4
+ import {injectCss} from "./Util.js";
5
+ import {ElfUtil} from "./ElfUtil.js";
4
6
 
5
7
  declare class GridPlugin extends EventDispatcher {
6
8
 
@@ -44,6 +46,12 @@ declare class GridPlugin extends EventDispatcher {
44
46
 
45
47
  public static requestPlugin(ref: any, pluginRef: any, configObj?: any, compositeGrid?: any, realTimeGrid?: any): Promise<any>|null;
46
48
 
49
+ public applyStaticStyles(styleCalculator: ((...params: any[]) => any)|null): void;
50
+
51
+ public applyStyles(cssString: string, nameSpace?: string|null, replaceable?: boolean|null): void;
52
+
53
+ public revokeStyles(host: any, nameSpace: string): void;
54
+
47
55
  }
48
56
 
49
57
  declare function gridAPI(gridType: string, wrapperInstance: any): void;
@@ -1,6 +1,8 @@
1
1
  import {Ext} from "./Ext.js";
2
2
  import {EventDispatcher} from "./EventDispatcher.js";
3
3
  import {Deferred} from "./Deferred.js";
4
+ import {injectCss} from "./Util.js";
5
+ import {ElfUtil} from "./ElfUtil.js";
4
6
 
5
7
  /** This class is designed to be a base class for other tr.Grid plug-ins. It provide commonly used functionalities by the plug-ins.
6
8
  * @constructor
@@ -816,6 +818,99 @@ GridPlugin.prototype._mockKeyboardEvent = function(keyCode, context) {
816
818
 
817
819
  return evt;
818
820
  };
821
+
822
+ /** @type {Object}
823
+ * @private
824
+ */
825
+ GridPlugin._staticStyles = {};
826
+
827
+ /** @type {Object}
828
+ * @private
829
+ */
830
+ GridPlugin._themeLoaders = {};
831
+
832
+ /** @private
833
+ * @param {Function} styleCalculator
834
+ * @param {Object} colors
835
+ */
836
+ GridPlugin._themeLoadSuccess = function(styleCalculator, colors) {
837
+ var extName = this.getName();
838
+ var styles = GridPlugin._staticStyles[extName] = styleCalculator(colors);
839
+ this.applyStyles(styles, extName);
840
+ };
841
+
842
+ /** @public
843
+ * @param {Function} styleCalculator
844
+ */
845
+ GridPlugin.prototype.applyStaticStyles = function(styleCalculator) {
846
+ var extName = this.getName();
847
+ var styles = GridPlugin._staticStyles[extName];
848
+ if (!styles) {
849
+ if (styleCalculator) {
850
+ if (!GridPlugin._themeLoaders[extName]) {
851
+ GridPlugin._themeLoaders[extName] = ElfUtil.getThemeColors();
852
+ }
853
+ GridPlugin._themeLoaders[extName]
854
+ .then(GridPlugin._themeLoadSuccess.bind(this, styleCalculator));
855
+ }
856
+ } else {
857
+ this.applyStyles(styles, extName);
858
+ }
859
+ };
860
+
861
+ /** @public
862
+ * @param {string} cssString
863
+ * @param {string=} nameSpace
864
+ * @param {boolean=} replaceable
865
+ */
866
+ GridPlugin.prototype.applyStyles = function(cssString, nameSpace, replaceable) {
867
+ if (!nameSpace) {
868
+ nameSpace = this.getName();
869
+ }
870
+
871
+ var intNameSpace = "_style" + nameSpace;
872
+
873
+ var hosts = this._hosts;
874
+ var len = hosts.length;
875
+ if (!len) {
876
+ return;
877
+ }
878
+
879
+ var i, host;
880
+ if (!replaceable) {
881
+ for (i = 0; i < len; i++) {
882
+ host = hosts[i];
883
+ if (!host[intNameSpace]) {
884
+ injectCss(cssString, host.getElement());
885
+ host[intNameSpace] = true;
886
+ }
887
+ }
888
+ } else {
889
+ for (i = 0; i < len; i++) {
890
+ host = hosts[i];
891
+ this.revokeStyles(host, nameSpace);
892
+ host[intNameSpace] = injectCss(cssString, host.getElement());
893
+ }
894
+ }
895
+ };
896
+
897
+ /** @public
898
+ * @param {Object} host
899
+ * @param {string} nameSpace
900
+ */
901
+ GridPlugin.prototype.revokeStyles = function(host, nameSpace) {
902
+ if (!host || !nameSpace) {
903
+ return;
904
+ }
905
+
906
+ nameSpace = "_style" + nameSpace;
907
+ var styleTag = host[nameSpace];
908
+ if (styleTag && styleTag.nodeType === 1) {
909
+ styleTag.parentNode.removeChild(styleTag);
910
+ host[nameSpace] = null;
911
+ }
912
+ };
913
+
819
914
  /** Export the plugin to the given object by attaching it to tr and tr.grid namespaces
820
915
  * @public
821
916
  * @function
@@ -111,6 +111,8 @@ declare class RowGroupingPlugin extends GridPlugin {
111
111
 
112
112
  public enableFooterRow(opt_num?: (boolean|number)|null): void;
113
113
 
114
+ public getFooterRowCount(): number;
115
+
114
116
  }
115
117
 
116
118
  declare function isNonFunction(obj: any): boolean;
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.134",
2
+ "tr-grid-util": "1.3.135",
3
3
  "tr-grid-printer": "1.0.17",
4
4
  "@grid/column-dragging": "1.0.15",
5
5
  "@grid/row-segmenting": "1.0.30",
@@ -7,7 +7,7 @@
7
7
  "@grid/zoom": "1.0.11",
8
8
  "tr-grid-auto-tooltip": "1.1.6",
9
9
  "tr-grid-cell-selection": "1.0.34",
10
- "tr-grid-checkbox": "1.0.61",
10
+ "tr-grid-checkbox": "1.0.62",
11
11
  "tr-grid-column-fitter": "1.0.39",
12
12
  "tr-grid-column-formatting": "0.9.35",
13
13
  "tr-grid-column-grouping": "1.0.57",
@@ -25,13 +25,13 @@
25
25
  "tr-grid-range-bar": "2.0.6",
26
26
  "tr-grid-row-dragging": "1.0.31",
27
27
  "tr-grid-row-filtering": "1.0.65",
28
- "tr-grid-row-grouping": "1.0.82",
28
+ "tr-grid-row-grouping": "1.0.84",
29
29
  "tr-grid-row-selection": "1.0.25",
30
30
  "tr-grid-rowcoloring": "1.0.25",
31
31
  "tr-grid-textformatting": "1.0.46",
32
32
  "tr-grid-titlewrap": "1.0.20",
33
- "@grid/formatters": "1.0.50",
33
+ "@grid/formatters": "1.0.51",
34
34
  "@grid/column-selection-dialog": "4.0.55",
35
- "@grid/filter-dialog": "4.0.60",
35
+ "@grid/filter-dialog": "4.0.61",
36
36
  "@grid/column-format-dialog": "4.0.44"
37
37
  }
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.78"
69
+ "version": "6.0.79"
70
70
  }