@refinitiv-ui/efx-grid 6.0.100 → 6.0.102

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.
@@ -44,7 +44,7 @@ declare namespace ColumnDefinition {
44
44
  leftPinned?: boolean|null,
45
45
  rightPinned?: boolean|null,
46
46
  info?: any,
47
- focusable: boolean
47
+ focusable?: boolean|null
48
48
  };
49
49
 
50
50
  }
@@ -50,7 +50,7 @@ import Engine from "../../tr-grid-util/es6/formula/Engine.js";
50
50
  * @property {boolean=} leftPinned=false If enabled, the column will not be part of the scrollable area and is pinned to the left side
51
51
  * @property {boolean=} rightPinned=false If enabled, the column will not be part of the scrollable area and is pinned to the right side
52
52
  * @property {Object=} info=null For storing any additional information to the column
53
- * @property {boolean} focusable=false If enabled, the column will be used to find focusable element when pressing tab key
53
+ * @property {boolean=} focusable=false If enabled, the column will be used to find focusable element when pressing tab key
54
54
  */
55
55
 
56
56
  /** mapping of field type to javascript type
@@ -1130,6 +1130,11 @@ RowDefinition.prototype._toRealTimeRow = function() {
1130
1130
  this._parent = null;
1131
1131
  this._depthLevel = 0;
1132
1132
 
1133
+ // Add static value to the new allocated row
1134
+ if(this._staticValues) {
1135
+ this.setRowData(this._staticValues);
1136
+ }
1137
+
1133
1138
  this.subscribeForUpdates();
1134
1139
  };
1135
1140
 
@@ -1148,8 +1153,12 @@ RowDefinition.prototype.unlinkChain = function() {
1148
1153
  }
1149
1154
  }
1150
1155
 
1156
+ let staticData = this._getStaticRowData();
1151
1157
  this.unsubscribeForUpdates();
1152
1158
 
1159
+ // Restore static data
1160
+ this.setStaticRowData(staticData);
1161
+
1153
1162
  let view = this._view;
1154
1163
  if(view) {
1155
1164
  let rid = this.getRowId();
@@ -474,8 +474,11 @@ CellSelectionPlugin.prototype._onMouseMove = function (e) {
474
474
  }
475
475
  var activeGrid = this._getActiveGrid();
476
476
  var newMouse = activeGrid.getRelativePosition(e);
477
- if (newMouse.sectionIndex === 0) {
478
- // prevent first row (header) selection
477
+
478
+ // Avoid cross section selection but scrolling is still working
479
+ if (this._anchor["sectionType"] === "title" && newMouse["sectionType"] !== "title") {
480
+ return;
481
+ } else if (this._anchor["sectionType"] === "content" && newMouse["sectionType"] === "title") {
479
482
  return;
480
483
  }
481
484
  if (!newMouse['hit']) {
@@ -1158,17 +1161,24 @@ CellSelectionPlugin.prototype._updateSelection = function (tgtRect) {
1158
1161
  var x = this._curRect.left;
1159
1162
  var y = this._curRect.top;
1160
1163
  var mapInfo = this._map[y];
1161
- var contentType = mapInfo ? mapInfo.type === "content" : false;
1162
1164
  var w = 0;
1163
1165
  var h = 0;
1164
- if (contentType) {
1166
+ if (mapInfo) {
1165
1167
  w = this._curRect.right - x;
1166
1168
  h = this._curRect.bottom - y;
1167
1169
  y -= mapInfo.rowOffset;
1168
- }
1169
- var contentSect = activeGrid.getSection("content");
1170
- if (contentSect) {
1171
- contentSect.setCellBounds(x, y, w, h);
1170
+ var contentType = mapInfo.type;
1171
+ if (contentType === "content") {
1172
+ var contentSect = activeGrid.getSection("content");
1173
+ if (contentSect) {
1174
+ contentSect.setCellBounds(x, y, w, h);
1175
+ }
1176
+ } else {
1177
+ var titleSect = activeGrid.getSection("title");
1178
+ if (titleSect) {
1179
+ titleSect.setCellBounds(x, y, w, h);
1180
+ }
1181
+ }
1172
1182
  }
1173
1183
  }
1174
1184
  };
@@ -1359,6 +1369,10 @@ CellSelectionPlugin.prototype.deselectAll = function () {
1359
1369
  if (contentSect) {
1360
1370
  contentSect.setCellBounds(0, 0, 0, 0);
1361
1371
  }
1372
+ var titleSect = activeGrid.getSection("title");
1373
+ if (titleSect) {
1374
+ titleSect.setCellBounds(0, 0, 0, 0);
1375
+ }
1362
1376
  }
1363
1377
  this._lastSelection = this.getSelectionBounds();
1364
1378
  this._anchor = null;
@@ -884,10 +884,13 @@ InCellEditingPlugin.prototype.unload = function (host) {
884
884
  clearTimeout(this._editorTimerId);
885
885
  }
886
886
  window.removeEventListener("scroll", this._onScroll);
887
+ if(this._starterTextPopup) {
888
+ this._starterTextPopup.dispose();
889
+ }
887
890
  }
888
-
889
- if(this._starterTextPopup) {
890
- this._starterTextPopup.dispose();
891
+ if(this.isEditing()) {
892
+ this.closeRowEditor(false);
893
+ this.closeCellEditor(false);
891
894
  }
892
895
  this._dispose();
893
896
  };
@@ -136,6 +136,42 @@ let _arrayConcat = function(ary, val) {
136
136
  }
137
137
  return ary;
138
138
  };
139
+
140
+ /** @type {Object}
141
+ * @private
142
+ * @const
143
+ */
144
+ const BlankValues = {
145
+ "": true,
146
+ "null": true,
147
+ "undefined": true,
148
+ "NaN": true
149
+ };
150
+ /** @private
151
+ * @function
152
+ * @param {Array} ary
153
+ * @param {string} str
154
+ * @returns {boolean} Returns true if there is any change
155
+ */
156
+ let _pushRawValue = function(ary, str) {
157
+ if(str) {
158
+ if(!BlankValues[str]) {
159
+ let dateObj = stringToDateObject(str);
160
+ if(dateObj !== str) {
161
+ ary.push(dateObj);
162
+ } else {
163
+ try {
164
+ ary.push(JSON.parse(str));
165
+ } catch (err) {
166
+ ary.push(str);
167
+ }
168
+ }
169
+ return true;
170
+ }
171
+ }
172
+ return false;
173
+ };
174
+
139
175
  /** @private
140
176
  * @function
141
177
  * @param {Object} obj
@@ -670,8 +706,8 @@ RowFilteringPlugin.prototype._parseFilter = function(exp, colIndex, ctx) {
670
706
  rawDataAccessor = ctx.rawDataAccessor || null;
671
707
  formattedDataAccessor = ctx.formattedDataAccessor || null;
672
708
  }
673
- if(!Array.isArray(exp)) {
674
- if(exp[BLANKS] || (ctx && ctx.blankValues)) {
709
+ if(!Array.isArray(exp)) { // If exp is an object
710
+ if(exp[BLANKS] || (ctx && ctx.blankValues)) { // it contains BLANKS key or context object has blank option
675
711
  exp[""] = exp["null"] = exp["undefined"] = exp["NaN"] = true;
676
712
  delete exp[BLANKS];
677
713
  }
@@ -1485,7 +1521,7 @@ let _valueToString = function(formattedVal, rawVal) {
1485
1521
  } else if(formattedVal instanceof Date) {
1486
1522
  return formattedVal.toLocaleString("en-GB");
1487
1523
  } else { // Object type cannot be converted to string
1488
- return"";
1524
+ return "";
1489
1525
  }
1490
1526
  } else if(formattedVal === 0) {
1491
1527
  return "0";
@@ -1650,23 +1686,34 @@ RowFilteringPlugin._formatArrayExpression = function(exp, field, formatter) {
1650
1686
  ary.rawValue = val;
1651
1687
  ary.formattedValue = formattedVal;
1652
1688
  }
1653
- if(field && formatter && typeof val !== "string") {
1654
- if(val != null) {
1689
+ if(typeof val !== "string" && val != null) {
1690
+ if(field && formatter) {
1655
1691
  let dummyRow = {};
1656
1692
  dummyRow[field] = val;
1657
1693
  formattedVal = formatter(dummyRow);
1658
- if(formattedVal) {
1659
- ary.rawValue = val;
1660
- ary.formattedValue = formattedVal;
1661
- val = formattedVal;
1662
- }
1694
+ } else {
1695
+ formattedVal = _valueToString(val, val);
1696
+ }
1697
+ if(formattedVal) {
1698
+ ary.rawValue = val;
1699
+ ary.formattedValue = formattedVal;
1700
+ } else {
1701
+ formattedVal = val;
1663
1702
  }
1664
1703
  }
1665
- ary[1] = val;
1704
+ ary[1] = formattedVal;
1666
1705
  return ary;
1667
1706
  }
1668
1707
  return null;
1669
1708
  };
1709
+ /** For mocking dialog instance
1710
+ * @public
1711
+ * @ignore
1712
+ * @param {*} dialog
1713
+ */
1714
+ RowFilteringPlugin.prototype.setDialog = function(dialog) {
1715
+ this._filterDialog = dialog;
1716
+ };
1670
1717
  /** @public
1671
1718
  * @param {number} colIndex
1672
1719
  * @param {RowFilteringPlugin~FilterDialogOptions=} runtimeDialogOptions
@@ -1802,22 +1849,36 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
1802
1849
  let filterFuncs = null;
1803
1850
  let exp = colSettings.expression;
1804
1851
  if(exp) {
1852
+ let userInputs = [];
1853
+ if(cfo._filters && cfo._filters.length) {
1854
+ filterFuncs = cfo._filters;
1855
+ }
1805
1856
  if(Array.isArray(exp)) {
1806
1857
  if(exp.length) {
1807
1858
  condition2D = Array.isArray(exp[0]) ? exp.slice() : [exp]; // Guaranteed condition2D to be a 2D array
1808
- condition2D[0] = RowFilteringPlugin._formatArrayExpression(condition2D[0], field, formatter);
1809
- condition2D[1] = RowFilteringPlugin._formatArrayExpression(condition2D[1], field, formatter);
1859
+ let conditionAry = null;
1860
+ conditionAry = RowFilteringPlugin._formatArrayExpression(condition2D[0], field, formatter);
1861
+ condition2D[0] = conditionAry;
1862
+ if(conditionAry) {
1863
+ _pushRawValue(userInputs, conditionAry.rawValue != null ? conditionAry.rawValue : conditionAry[1]);
1864
+ }
1865
+
1866
+ conditionAry = RowFilteringPlugin._formatArrayExpression(condition2D[1], field, formatter);
1867
+ condition2D[1] = conditionAry;
1868
+ if(conditionAry) {
1869
+ _pushRawValue(userInputs, conditionAry.rawValue != null ? conditionAry.rawValue : conditionAry[1]);
1870
+ }
1871
+
1810
1872
  filterMode = "advanced";
1811
1873
  }
1812
1874
  } else if(typeof exp === "function" || typeof exp === "string" || typeof exp === "object") {
1813
- if(cfo._filters && cfo._filters.length) {
1814
- filterFuncs = cfo._filters;
1815
- }
1816
1875
  if(typeof exp === "object") {
1817
- exp = _handledBlankProperties(exp);
1818
- dialogConfig.additionalItems = _arrayConcat(dialogConfig.additionalItems, Object.keys(exp));
1876
+ for(let expKey in exp) {
1877
+ _pushRawValue(userInputs, expKey);
1878
+ }
1819
1879
  }
1820
1880
  }
1881
+ dialogConfig.additionalItems = _arrayConcat(dialogConfig.additionalItems, userInputs);
1821
1882
  }
1822
1883
 
1823
1884
  let selectedItems = {};
@@ -327,6 +327,8 @@ declare class Core extends ElementWrapper {
327
327
 
328
328
  public scrollToRow(sectionRef: Core.SectionReference|null, rowIndex: number, topOfView?: boolean|null): void;
329
329
 
330
+ public getVerticalViewInfo(): any;
331
+
330
332
  public getVScrollView(): any;
331
333
 
332
334
  public getScrollTop(): number;
@@ -11,6 +11,7 @@ import SelectionList from "./util/SelectionList.js";
11
11
  import ILayoutGrid from "./ILayoutGrid.js";
12
12
  import ElementWrapper from "./components/ElementWrapper.js";
13
13
  import HScrollbar from "./components/HScrollbar.js";
14
+ import CellBoundPainter from "./util/CellBoundPainter.js";
14
15
 
15
16
  declare class LayoutGrid extends ElementWrapper {
16
17
 
@@ -6,6 +6,7 @@ import ILayoutGrid from "./ILayoutGrid.js";
6
6
  import LayoutGrid from "./LayoutGrid.js";
7
7
  import ElementWrapper from "./components/ElementWrapper.js";
8
8
  import HScrollbar from "./components/HScrollbar.js";
9
+ import CellBoundPainter from "./util/CellBoundPainter.js";
9
10
 
10
11
  declare class VirtualizedLayoutGrid extends ElementWrapper {
11
12
 
@@ -0,0 +1,16 @@
1
+
2
+
3
+ declare class CellBoundPainter {
4
+
5
+ constructor(ctx: any);
6
+
7
+ public dispose(): void;
8
+
9
+ public setCellBounds(colIndex: number, rowIndex: number, width: number, height: number, colCount: number): void;
10
+
11
+ public updateCellBounds(): void;
12
+
13
+ }
14
+
15
+ export default CellBoundPainter;
16
+ export { CellBoundPainter };
@@ -45,7 +45,8 @@ declare namespace ColumnDefinition {
45
45
  stationary?: boolean|null,
46
46
  leftPinned?: boolean|null,
47
47
  rightPinned?: boolean|null,
48
- info?: any
48
+ info?: any,
49
+ focusable?: boolean|null
49
50
  };
50
51
 
51
52
  }
@@ -160,6 +161,8 @@ declare class ColumnDefinition {
160
161
 
161
162
  public getColumnInfo(): any;
162
163
 
164
+ public isFocusable(): boolean;
165
+
163
166
  }
164
167
 
165
168
  declare const COL_DEF: string;
package/lib/versions.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "@grid/statistics-row": "1.0.17",
7
7
  "@grid/zoom": "1.0.11",
8
8
  "tr-grid-auto-tooltip": "1.1.6",
9
- "tr-grid-cell-selection": "1.0.37",
9
+ "tr-grid-cell-selection": "1.0.38",
10
10
  "tr-grid-checkbox": "1.0.67",
11
11
  "tr-grid-column-fitter": "1.0.40",
12
12
  "tr-grid-column-formatting": "0.9.36",
@@ -19,12 +19,12 @@
19
19
  "tr-grid-contextmenu": "1.0.41",
20
20
  "tr-grid-filter-input": "0.9.39",
21
21
  "tr-grid-heat-map": "1.0.29",
22
- "tr-grid-in-cell-editing": "1.0.85",
22
+ "tr-grid-in-cell-editing": "1.0.86",
23
23
  "tr-grid-pagination": "1.0.24",
24
24
  "tr-grid-percent-bar": "1.0.24",
25
25
  "tr-grid-range-bar": "2.0.8",
26
26
  "tr-grid-row-dragging": "1.0.35",
27
- "tr-grid-row-filtering": "1.0.74",
27
+ "tr-grid-row-filtering": "1.0.76",
28
28
  "tr-grid-row-grouping": "1.0.87",
29
29
  "tr-grid-row-selection": "1.0.30",
30
30
  "tr-grid-rowcoloring": "1.0.25",
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.100"
69
+ "version": "6.0.102"
70
70
  }