@refinitiv-ui/efx-grid 6.0.99 → 6.0.101

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.
@@ -464,12 +464,22 @@ RowDraggingPlugin.prototype.getConfigObject = function (out_obj) {
464
464
  if(!extOptions) {
465
465
  extOptions = obj.rowDragging = {};
466
466
  }
467
- // TODO: should not assign the config object if it's a default value
468
- extOptions.dragBox = this._dragBoxEnabled;
469
- extOptions.mouseInput = this._mouseInput;
470
- extOptions.autoScroll = this._autoScroll;
471
- extOptions.dataTransfer = this._dataTransfer;
472
- extOptions.disabled = this._uiDisabled;
467
+
468
+ if(this._dragBoxEnabled) {
469
+ extOptions.dragBox = this._dragBoxEnabled;
470
+ }
471
+ if(!this._mouseInput) {
472
+ extOptions.mouseInput = this._mouseInput;
473
+ }
474
+ if(!this._autoScroll) {
475
+ extOptions.autoScroll = this._autoScroll;
476
+ }
477
+ if(!this._dataTransfer) {
478
+ extOptions.dataTransfer = this._dataTransfer;
479
+ }
480
+ if(this._uiDisabled) {
481
+ extOptions.disabled = this._uiDisabled;
482
+ }
473
483
 
474
484
  return obj;
475
485
  };
@@ -1103,6 +1113,8 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
1103
1113
 
1104
1114
  let moveCount = movedRowIds ? movedRowIds.length : 0;
1105
1115
  if(moveCount) {
1116
+ destGrid.focus();
1117
+
1106
1118
  evtArg["originRowId"] = movedRowIds[0];
1107
1119
  evtArg["originRowIds"] = movedRowIds;
1108
1120
  evtArg["destinationRowId"] = destRowId; // Return empty string for the last row
@@ -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,19 +1686,22 @@ 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;
@@ -1802,22 +1841,36 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
1802
1841
  let filterFuncs = null;
1803
1842
  let exp = colSettings.expression;
1804
1843
  if(exp) {
1844
+ let userInputs = [];
1845
+ if(cfo._filters && cfo._filters.length) {
1846
+ filterFuncs = cfo._filters;
1847
+ }
1805
1848
  if(Array.isArray(exp)) {
1806
1849
  if(exp.length) {
1807
1850
  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);
1851
+ let conditionAry = null;
1852
+ conditionAry = RowFilteringPlugin._formatArrayExpression(condition2D[0], field, formatter);
1853
+ condition2D[0] = conditionAry;
1854
+ if(conditionAry) {
1855
+ _pushRawValue(userInputs, conditionAry.rawValue != null ? conditionAry.rawValue : conditionAry[1]);
1856
+ }
1857
+
1858
+ conditionAry = RowFilteringPlugin._formatArrayExpression(condition2D[1], field, formatter);
1859
+ condition2D[1] = conditionAry;
1860
+ if(conditionAry) {
1861
+ _pushRawValue(userInputs, conditionAry.rawValue != null ? conditionAry.rawValue : conditionAry[1]);
1862
+ }
1863
+
1810
1864
  filterMode = "advanced";
1811
1865
  }
1812
1866
  } else if(typeof exp === "function" || typeof exp === "string" || typeof exp === "object") {
1813
- if(cfo._filters && cfo._filters.length) {
1814
- filterFuncs = cfo._filters;
1815
- }
1816
1867
  if(typeof exp === "object") {
1817
- exp = _handledBlankProperties(exp);
1818
- dialogConfig.additionalItems = _arrayConcat(dialogConfig.additionalItems, Object.keys(exp));
1868
+ for(let expKey in exp) {
1869
+ _pushRawValue(userInputs, expKey);
1870
+ }
1819
1871
  }
1820
1872
  }
1873
+ dialogConfig.additionalItems = _arrayConcat(dialogConfig.additionalItems, userInputs);
1821
1874
  }
1822
1875
 
1823
1876
  let selectedItems = {};
@@ -1,9 +1,7 @@
1
1
  import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
2
  import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
3
3
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
4
- import { isMac as isMacFn } from "../../tr-grid-util/es6/Util.js";
5
- import { isIE, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
6
- import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
4
+ import { isMac as isMacFn, prepareTSVContent, prettifyCss } from "../../tr-grid-util/es6/Util.js";
7
5
 
8
6
  declare namespace RowSelectionPlugin {
9
7
 
@@ -1,9 +1,7 @@
1
1
  import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
2
  import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
3
3
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
4
- import { isMac as isMacFn } from "../../tr-grid-util/es6/Util.js";
5
- import { isIE, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
6
- import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
4
+ import { isMac as isMacFn, prepareTSVContent, prettifyCss } from "../../tr-grid-util/es6/Util.js";
7
5
 
8
6
  /** @private
9
7
  * @type {boolean}
@@ -43,7 +41,6 @@ const IS_MAC = isMacFn();
43
41
  let RowSelectionPlugin = function (options) {
44
42
  let t = this;
45
43
  t._onMouseDown = t._onMouseDown.bind(t);
46
- t._onMouseMove = t._onMouseMove.bind(t);
47
44
  t._onClick = t._onClick.bind(t);
48
45
  t._onKeyDown = t._onKeyDown.bind(t);
49
46
  t._onBeforeRowRemoved = t._onBeforeRowRemoved.bind(t);
@@ -53,7 +50,6 @@ let RowSelectionPlugin = function (options) {
53
50
  t._updateMenuIcon = t._updateMenuIcon.bind(t);
54
51
 
55
52
  t._hosts = [];
56
- t._isIE = isIE();
57
53
  t._textRange = document.createRange();
58
54
 
59
55
  if(options) {
@@ -101,10 +97,6 @@ RowSelectionPlugin.prototype._selectionField = "SELECTED_ROW";
101
97
  * @description use with _basedOnContent mode for tracking current anchor row
102
98
  */
103
99
  RowSelectionPlugin.prototype._anchorRowId = "";
104
- /** @type {boolean}
105
- * @private
106
- */
107
- RowSelectionPlugin.prototype._isIE = false;
108
100
  /** @type {Range}
109
101
  * @private
110
102
  */
@@ -578,19 +570,40 @@ RowSelectionPlugin.prototype.disableMultiSelection = function (disabled) {
578
570
  this._singleSelMode = disabled !== false;
579
571
  };
580
572
 
573
+ /** Focus the active grid only if there is no selected text
574
+ * @private
575
+ * @param {boolean=} force
576
+ * @returns {boolean} Returns true if there is any change
577
+ */
578
+ RowSelectionPlugin.prototype._focusGrid = function (force) {
579
+ if(this._activeGrid) {
580
+ if(force || !window.getSelection().toString()) {
581
+ this._activeGrid.focus();
582
+ return true;
583
+ }
584
+ }
585
+ return false;
586
+ };
581
587
  /** @private
582
588
  * @param {Event} e
583
589
  */
584
590
  RowSelectionPlugin.prototype._onClick = function (e) {
585
- if(this._pendingClickIndex >= 0 && this._anchorSection) {
586
- this._selectSingleRow(this._anchorSection, this._pendingClickIndex);
587
- let host = this.getRelativeGrid(e);
588
- this._clearPendingClickIndex(host);
591
+ if(this._pendingClickIndex >= 0) {
592
+ let performClick = (this._activeGrid && this._anchorSection) ? true : false;
593
+ if(performClick) {
594
+ let curPos = this._activeGrid.getRelativePosition(e);
595
+ performClick = curPos.rowIndex === this._pendingClickIndex && curPos.section === this._anchorSection;
596
+ }
597
+ if(performClick) {
598
+ this._selectSingleRow(this._anchorSection, this._pendingClickIndex);
599
+ this._focusGrid();
589
600
 
590
- if(!this._basedOnContent) { // Protect against rowPositionChanged and postBindingSection event
591
- this._updateMenuIcon();
601
+ if(!this._basedOnContent) { // Protect against rowPositionChanged and postBindingSection event
602
+ this._updateMenuIcon();
603
+ }
604
+ this._dispatchSelectionChanged(e);
592
605
  }
593
- this._dispatchSelectionChanged(e);
606
+ this._pendingClickIndex = -1;
594
607
  }
595
608
  };
596
609
  /** @public
@@ -634,10 +647,9 @@ RowSelectionPlugin.prototype._onMouseDown = function (e) {
634
647
  }
635
648
  }
636
649
 
650
+ this._pendingClickIndex = -1;
637
651
  let host = this.getRelativeGrid(e);
638
652
 
639
- this._clearPendingClickIndex(host);
640
-
641
653
  if(!host) {
642
654
  return;
643
655
  }
@@ -683,7 +695,8 @@ RowSelectionPlugin.prototype._onMouseDown = function (e) {
683
695
  if(singleSelection) { // Click: selects a single row
684
696
  this._anchorSection = section;
685
697
  if(prevSel) { // Click on the selected row
686
- this._setPendingClickIndex(rowIndex, host); // Delay the operation to allow drag and drop operation
698
+ // Delay the operation to allow drag and drop operation
699
+ this._pendingClickIndex = rowIndex;
687
700
  return;
688
701
  } else { // Perform single click immediately
689
702
  let prevGrid = this._activeGrid;
@@ -698,44 +711,16 @@ RowSelectionPlugin.prototype._onMouseDown = function (e) {
698
711
  }
699
712
  }
700
713
 
701
- if(this._activeGrid && !prevSel) {
702
- e.preventDefault();
703
- this._activeGrid.focus();
714
+ if(this._focusGrid(!prevSel)) {
715
+ e.preventDefault(); // Prevent changing focus due to clicking on unfocusable element
704
716
  }
705
717
 
706
718
  if(!this._basedOnContent) { // Protect against rowPositionChanged and postBindingSection event
707
719
  this._updateMenuIcon();
708
720
  }
709
721
 
710
- this._dispatchSelectionChanged(e, rowIndex, section);
711
- };
712
722
 
713
- /** To clear _pendingClickIndex when mouse move
714
- * @private
715
- * @param {Event} e
716
- */
717
- RowSelectionPlugin.prototype._onMouseMove = function (e) {
718
- let host = this.getRelativeGrid(e);
719
- this._clearPendingClickIndex(host);
720
- };
721
-
722
- /** To set _pendingClickIndex
723
- * @private
724
- * @param {number} rowIndex
725
- * @param {Object=} host core grid instance
726
- */
727
- RowSelectionPlugin.prototype._setPendingClickIndex = function (rowIndex, host) {
728
- this._pendingClickIndex = rowIndex;
729
- host && host.listen("mousemove", this._onMouseMove);
730
- };
731
-
732
- /** To clear _pendingClickIndex
733
- * @private
734
- * @param {Object=} host core grid instance
735
- */
736
- RowSelectionPlugin.prototype._clearPendingClickIndex = function (host) {
737
- this._pendingClickIndex = -1;
738
- host && host.unlisten("mousemove", this._onMouseMove);
723
+ this._dispatchSelectionChanged(e, rowIndex, section);
739
724
  };
740
725
 
741
726
  /** @private
@@ -865,7 +850,7 @@ RowSelectionPlugin.prototype.getSelectedText = function () {
865
850
  if(!this._compositeGrid && !this._realTimeGrid) return "";
866
851
 
867
852
  let selectedRows = this.getSelectedRows();
868
- let rowCount = selectedRows.length;
853
+ let rowCount = selectedRows ? selectedRows.length : 0;
869
854
  let columnCount = this.getColumnCount();
870
855
  let text = "";
871
856
  let dv = this._activeGrid.getDataSource();
@@ -938,7 +923,7 @@ RowSelectionPlugin.prototype._clearSelectedRows = function (preserveAnchor) { //
938
923
  if(!preserveAnchor) {
939
924
  this._anchorSection = null;
940
925
  }
941
- this._clearPendingClickIndex(this._activeGrid);
926
+ this._pendingClickIndex = -1;
942
927
  this._clearMenuIcon();
943
928
  };
944
929
  /** @private
@@ -952,9 +937,7 @@ RowSelectionPlugin.prototype._selectByKey = function (direction, e, pageKey) {
952
937
 
953
938
  if(!this._anchorSection) { return; }
954
939
 
955
- if(this._activeGrid != null){
956
- this._activeGrid.focus();
957
- }
940
+ this._focusGrid(true);
958
941
 
959
942
  let shiftKey = e.shiftKey;
960
943
  let next = 0;
@@ -1267,9 +1250,7 @@ RowSelectionPlugin.prototype._gotoGrid = function (gridIndex) {
1267
1250
  let sectionIndex = this._anchorSection.getIndex();
1268
1251
  this.clearSelectedRows(); // Clear all current grid's selections
1269
1252
  this.selectSingleRow(anchorRow, sectionIndex, this._hosts[gridIndex]); // go to the next grid at the first column
1270
- if(this._activeGrid != null){
1271
- this._activeGrid.focus();
1272
- }
1253
+ this._focusGrid(true);
1273
1254
  };
1274
1255
 
1275
1256
  /** @private
@@ -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;
@@ -31,7 +31,9 @@ declare namespace InCellEditingPlugin {
31
31
  rowEditorClosed?: ((...params: any[]) => any)|null,
32
32
  autoSuggest?: Element|null,
33
33
  closingOnScroll?: boolean|null,
34
- autoHiding?: boolean|null
34
+ autoHiding?: boolean|null,
35
+ readonly?: boolean|null,
36
+ starterText?: (string|boolean)|null
35
37
  };
36
38
 
37
39
  type Cache = {
@@ -81,6 +83,8 @@ declare class InCellEditingPlugin extends GridPlugin {
81
83
 
82
84
  public disableDblClick(opt_disabled?: boolean|null): void;
83
85
 
86
+ public showStarterText(bool?: boolean|null): void;
87
+
84
88
  public isEditing(): boolean;
85
89
 
86
90
  public getTextBox(columnIndex?: number|null, grid?: any): Element|null;
@@ -99,6 +103,10 @@ declare class InCellEditingPlugin extends GridPlugin {
99
103
 
100
104
  public isColumnEditable(colIndex: number): boolean;
101
105
 
106
+ public enableReadonly(bool: boolean): void;
107
+
108
+ public disableReadonly(bool: boolean): void;
109
+
102
110
  public openRowEditor(rowIndex: number, grid?: any): void;
103
111
 
104
112
  public closeRowEditor(isCommit?: boolean|null): void;
@@ -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;
@@ -287,6 +287,8 @@ declare class Grid extends EventDispatcher {
287
287
 
288
288
  public setRicData(ric: string, values: any): void;
289
289
 
290
+ public getAllRics(): (string)[]|null;
291
+
290
292
  public setRowData(rowRef: Grid.RowReference|null, values: any): void;
291
293
 
292
294
  public setStaticRowData(rowRef: Grid.RowReference|null, values: any): void;
@@ -1,9 +1,7 @@
1
1
  import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
2
  import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
3
3
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
4
- import { isMac as isMacFn } from "../../tr-grid-util/es6/Util.js";
5
- import { isIE, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
6
- import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
4
+ import { isMac as isMacFn, prepareTSVContent, prettifyCss } from "../../tr-grid-util/es6/Util.js";
7
5
 
8
6
  declare namespace RowSelectionPlugin {
9
7
 
package/lib/versions.json CHANGED
@@ -19,14 +19,14 @@
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.84",
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
- "tr-grid-row-dragging": "1.0.34",
27
- "tr-grid-row-filtering": "1.0.74",
26
+ "tr-grid-row-dragging": "1.0.35",
27
+ "tr-grid-row-filtering": "1.0.75",
28
28
  "tr-grid-row-grouping": "1.0.87",
29
- "tr-grid-row-selection": "1.0.28",
29
+ "tr-grid-row-selection": "1.0.30",
30
30
  "tr-grid-rowcoloring": "1.0.25",
31
31
  "tr-grid-textformatting": "1.0.48",
32
32
  "tr-grid-titlewrap": "1.0.22",
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.99"
69
+ "version": "6.0.101"
70
70
  }