@refinitiv-ui/efx-grid 6.0.99 → 6.0.100

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
@@ -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
@@ -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;
@@ -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.85",
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",
26
+ "tr-grid-row-dragging": "1.0.35",
27
27
  "tr-grid-row-filtering": "1.0.74",
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.100"
70
70
  }