@refinitiv-ui/efx-grid 6.0.98 → 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.
- package/lib/core/dist/core.js +223 -185
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataView.js +2 -1
- package/lib/core/es6/grid/Core.d.ts +2 -0
- package/lib/core/es6/grid/Core.js +43 -17
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +11 -0
- package/lib/core/es6/grid/util/Virtualizer.js +5 -5
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +2805 -2440
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +4 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +20 -0
- package/lib/rt-grid/es6/Grid.d.ts +4 -0
- package/lib/rt-grid/es6/Grid.js +238 -1
- package/lib/rt-grid/es6/RowDefinition.d.ts +0 -2
- package/lib/rt-grid/es6/RowDefinition.js +85 -44
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +12 -1
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +9 -1
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +203 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +18 -6
- package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +1 -3
- package/lib/tr-grid-row-selection/es6/RowSelection.js +39 -58
- package/lib/types/es6/Core/data/DataView.d.ts +3 -1
- package/lib/types/es6/InCellEditing.d.ts +9 -1
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +4 -0
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +0 -2
- package/lib/types/es6/RowSelection.d.ts +1 -3
- package/lib/versions.json +5 -5
- package/package.json +1 -1
@@ -31,6 +31,8 @@ import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
|
|
31
31
|
* @property {Element=} autoSuggest=null Element of ef-autosuggest or atlas-autosuggest for handled with input cell
|
32
32
|
* @property {boolean=} closingOnScroll=true If disabled, the editor will not be automatically closed when scrolling grid.
|
33
33
|
* @property {boolean=} autoHiding=true If disabled, the editor will not be automatically closed when losing its focus.
|
34
|
+
* @property {boolean=} readonly=false If disabled, the editor will not be able to open, this property overwrite `editableContent` and `editableTitle`
|
35
|
+
* @property {(string|boolean)=} starterText=false if enable it, it will be show placeholder when no ric in grid, given string to overwrite wording
|
34
36
|
*/
|
35
37
|
|
36
38
|
/** @typedef {Object} InCellEditingPlugin~Cache
|
@@ -171,6 +173,8 @@ let InCellEditingPlugin = function (options) {
|
|
171
173
|
t._onMultiSelectionValueChanged = t._onMultiSelectionValueChanged.bind(t);
|
172
174
|
t._onMultiSelectionEditorChanged = t._onMultiSelectionEditorChanged.bind(t);
|
173
175
|
t._onAutoSuggestItemSelected = t._onAutoSuggestItemSelected.bind(t);
|
176
|
+
t._firstRendered = t._firstRendered.bind(t);
|
177
|
+
t._onGridKeyDown = t._onGridKeyDown.bind(t);
|
174
178
|
t._hosts = [];
|
175
179
|
|
176
180
|
if(options) {
|
@@ -341,10 +345,26 @@ InCellEditingPlugin.prototype._closingOnScroll = true;
|
|
341
345
|
* @private
|
342
346
|
*/
|
343
347
|
InCellEditingPlugin.prototype._autoHiding = true;
|
348
|
+
/** @type {boolean}
|
349
|
+
* @private
|
350
|
+
*/
|
351
|
+
InCellEditingPlugin.prototype._readonly = false;
|
352
|
+
/** @type {string}
|
353
|
+
* @private
|
354
|
+
*/
|
355
|
+
InCellEditingPlugin.prototype._starterText = "";
|
356
|
+
/** @type {Object}
|
357
|
+
* @private
|
358
|
+
*/
|
359
|
+
InCellEditingPlugin.prototype._starterTextPopup = null;
|
344
360
|
/** @type {number}
|
345
361
|
* @private
|
346
362
|
*/
|
347
363
|
InCellEditingPlugin.prototype._editorTimerId = 0;
|
364
|
+
/** @type {Object}
|
365
|
+
* @private
|
366
|
+
*/
|
367
|
+
InCellEditingPlugin.prototype._rowSelectionPlugin = null;
|
348
368
|
/** @type {boolean}
|
349
369
|
* @private
|
350
370
|
*/
|
@@ -369,6 +389,11 @@ InCellEditingPlugin._styles = prettifyCss([
|
|
369
389
|
],
|
370
390
|
":host .cell.editing", [
|
371
391
|
"z-index: 2;"
|
392
|
+
],
|
393
|
+
":host .starter-text", [
|
394
|
+
"padding: var(--grid-cell-padding,0 8px 0 8px);",
|
395
|
+
"pointer-events: none;",
|
396
|
+
"line-height: 28px" // WARNING: hardcode, it can be calculate with row height
|
372
397
|
]
|
373
398
|
]);
|
374
399
|
|
@@ -551,6 +576,9 @@ InCellEditingPlugin.prototype.initialize = function (host, options) {
|
|
551
576
|
}
|
552
577
|
|
553
578
|
host.listen("columnAdded", this._onColumnAdded);
|
579
|
+
host.listen("firstRendered", this._firstRendered);
|
580
|
+
host.listen("keydown", this._onGridKeyDown);
|
581
|
+
|
554
582
|
host.getVScrollbar().listen("scroll", this._onScroll);
|
555
583
|
host.getHScrollbar().listen("scroll", this._onScroll);
|
556
584
|
|
@@ -604,6 +632,14 @@ InCellEditingPlugin.prototype._afterInit = function () {
|
|
604
632
|
this._elfVersion = ElfUtil.getElfVersion();
|
605
633
|
};
|
606
634
|
|
635
|
+
/** @private
|
636
|
+
*/
|
637
|
+
InCellEditingPlugin.prototype._firstRendered = function () {
|
638
|
+
if(!this._readonly && this._starterText) {
|
639
|
+
this.showStarterText();
|
640
|
+
}
|
641
|
+
};
|
642
|
+
|
607
643
|
/** @public
|
608
644
|
* @param {Object=} options
|
609
645
|
*/
|
@@ -679,6 +715,16 @@ InCellEditingPlugin.prototype.config = function(options) {
|
|
679
715
|
if(pluginOption["autoHiding"] == false) {
|
680
716
|
t._autoHiding = false;
|
681
717
|
}
|
718
|
+
if(pluginOption["readonly"] == true) {
|
719
|
+
t._readonly = true;
|
720
|
+
}
|
721
|
+
if(pluginOption["starterText"] !== null) {
|
722
|
+
if(typeof pluginOption["starterText"] === "string") {
|
723
|
+
t._starterText = pluginOption["starterText"];
|
724
|
+
} else {
|
725
|
+
t._starterText = pluginOption["starterText"] ? "Type to add" : false;
|
726
|
+
}
|
727
|
+
}
|
682
728
|
|
683
729
|
// event callback
|
684
730
|
t.addListener(pluginOption, "preEditorOpening");
|
@@ -773,6 +819,15 @@ InCellEditingPlugin.prototype.getConfigObject = function (out_obj) {
|
|
773
819
|
dirty |= _setBooleanOption(extOptions, "uiBlocking", this._uiBlocking, false);
|
774
820
|
dirty |= _setBooleanOption(extOptions, "closingOnScroll", this._closingOnScroll, true);
|
775
821
|
dirty |= _setBooleanOption(extOptions, "autoHiding", this._autoHiding, true);
|
822
|
+
dirty |= _setBooleanOption(extOptions, "readonly", this._readonly, false);
|
823
|
+
|
824
|
+
if(this._starterText) {
|
825
|
+
if(this._starterText === "Type to add") {
|
826
|
+
extOptions["starterText"] = true;
|
827
|
+
} else {
|
828
|
+
extOptions["starterText"] = this._starterText;
|
829
|
+
}
|
830
|
+
}
|
776
831
|
|
777
832
|
if(this._contentSource !== "textContent") {
|
778
833
|
dirty = 1;
|
@@ -831,6 +886,9 @@ InCellEditingPlugin.prototype.unload = function (host) {
|
|
831
886
|
window.removeEventListener("scroll", this._onScroll);
|
832
887
|
}
|
833
888
|
|
889
|
+
if(this._starterTextPopup) {
|
890
|
+
this._starterTextPopup.dispose();
|
891
|
+
}
|
834
892
|
this._dispose();
|
835
893
|
};
|
836
894
|
|
@@ -848,6 +906,9 @@ InCellEditingPlugin.prototype.openEditor = function (colIndex, rowIndex, section
|
|
848
906
|
return;
|
849
907
|
}
|
850
908
|
}
|
909
|
+
if(this._readonly) {
|
910
|
+
return;
|
911
|
+
}
|
851
912
|
|
852
913
|
let sectionSettings = grid.getSectionSettings(sectionRef || "content");
|
853
914
|
let activePos = this._activePos;
|
@@ -937,6 +998,114 @@ InCellEditingPlugin.prototype.disableDblClick = function (opt_disabled) {
|
|
937
998
|
}
|
938
999
|
};
|
939
1000
|
|
1001
|
+
/** @private
|
1002
|
+
* @param {Object} e
|
1003
|
+
*/
|
1004
|
+
InCellEditingPlugin.prototype._onGridKeyDown = function (e) {
|
1005
|
+
if (e.key.length !== 1) { // Special character
|
1006
|
+
return;
|
1007
|
+
}
|
1008
|
+
if(this._starterText && this._starterTextPopup.isShown()) {
|
1009
|
+
let rsp = this._getPlugin("RowSelectionPlugin");
|
1010
|
+
if(rsp && rsp.getSelectedRowCount() > 0) {
|
1011
|
+
return;
|
1012
|
+
}
|
1013
|
+
let grid = this._hosts[0];
|
1014
|
+
grid.scrollToRow("content", 0, true);
|
1015
|
+
if(!this.isEditing()) {
|
1016
|
+
let firstEditableCol = this._getFirstEditableColumnIndex();
|
1017
|
+
if(firstEditableCol === 0) {
|
1018
|
+
return;
|
1019
|
+
}
|
1020
|
+
let cell = grid.getCell("content", firstEditableCol, 0);
|
1021
|
+
this._openEditor(cell, grid);
|
1022
|
+
}
|
1023
|
+
}
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
/**
|
1027
|
+
* @description Show starter text when the grid is no ric
|
1028
|
+
* @public
|
1029
|
+
* @param {boolean=} bool
|
1030
|
+
*/
|
1031
|
+
InCellEditingPlugin.prototype.showStarterText = function (bool) {
|
1032
|
+
setTimeout(this._showStarterText.bind(this, bool), 0); // Need to delay to wait scrollbar or editor closed
|
1033
|
+
};
|
1034
|
+
|
1035
|
+
|
1036
|
+
/**
|
1037
|
+
* @private
|
1038
|
+
* @param {boolean=} bool
|
1039
|
+
*/
|
1040
|
+
InCellEditingPlugin.prototype._showStarterText = function (bool) {
|
1041
|
+
if(!this._realTimeGrid || !this._starterText) {
|
1042
|
+
return;
|
1043
|
+
}
|
1044
|
+
let allRics = this._realTimeGrid.getAllRics();
|
1045
|
+
if(allRics.length > 0) {
|
1046
|
+
return;
|
1047
|
+
}
|
1048
|
+
let popupElem;
|
1049
|
+
if(!this._starterTextPopup) {
|
1050
|
+
popupElem = this._starterTextPopup = this._createStaterTextElement();
|
1051
|
+
} else {
|
1052
|
+
popupElem = this._starterTextPopup;
|
1053
|
+
}
|
1054
|
+
if(bool === false) {
|
1055
|
+
popupElem.hide();
|
1056
|
+
return;
|
1057
|
+
}
|
1058
|
+
let grid = this._hosts[0];
|
1059
|
+
|
1060
|
+
let editableColIndex = this._getFirstEditableColumnIndex();
|
1061
|
+
if(editableColIndex < 0) { // not editable
|
1062
|
+
return;
|
1063
|
+
}
|
1064
|
+
grid.scrollToRow("content", 0, true);
|
1065
|
+
let editableCell = grid.getCell("content", editableColIndex, 0);
|
1066
|
+
popupElem.attachTo(editableCell.getElement());
|
1067
|
+
popupElem.show(bool, grid.getElement().parentElement);
|
1068
|
+
};
|
1069
|
+
|
1070
|
+
/** @private
|
1071
|
+
* @return {number}
|
1072
|
+
*/
|
1073
|
+
InCellEditingPlugin.prototype._getFirstEditableColumnIndex = function () {
|
1074
|
+
if(this._readonly || !this._editableContent) {
|
1075
|
+
return -1;
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
let colCount = this.getColumnCount();
|
1079
|
+
for (let i = 0; i < colCount; i++) {
|
1080
|
+
let editableCol = this.isColumnEditable(i);
|
1081
|
+
if(editableCol) {
|
1082
|
+
return i;
|
1083
|
+
}
|
1084
|
+
}
|
1085
|
+
return -1;
|
1086
|
+
};
|
1087
|
+
|
1088
|
+
/** @private
|
1089
|
+
* @return {Object}
|
1090
|
+
*/
|
1091
|
+
InCellEditingPlugin.prototype._createStaterTextElement = function () {
|
1092
|
+
let container = document.createElement("div");
|
1093
|
+
container.textContent = this._starterText;
|
1094
|
+
container.className = "starter-text";
|
1095
|
+
let popup = new Popup(container, { positioning: "over"});
|
1096
|
+
popup.disableAutoHiding(true);
|
1097
|
+
popup.disableHideOnScroll(true);
|
1098
|
+
return popup;
|
1099
|
+
};
|
1100
|
+
|
1101
|
+
/** @public
|
1102
|
+
* @description This is for testing purpose to compare element
|
1103
|
+
* @ignore
|
1104
|
+
* @return {Object}
|
1105
|
+
*/
|
1106
|
+
InCellEditingPlugin.prototype.getStarterTextelement = function () {
|
1107
|
+
return this._starterTextPopup;
|
1108
|
+
};
|
940
1109
|
/** Checking Editing is in process.
|
941
1110
|
* @public
|
942
1111
|
* @return {boolean}
|
@@ -1090,9 +1259,27 @@ InCellEditingPlugin.prototype.enableAutoCommitText = function (opt_enable) {
|
|
1090
1259
|
* @return {boolean}
|
1091
1260
|
*/
|
1092
1261
|
InCellEditingPlugin.prototype.isColumnEditable = function (colIndex) {
|
1262
|
+
if(this._readonly) {
|
1263
|
+
return false;
|
1264
|
+
}
|
1093
1265
|
let val = this._getColumnOption(colIndex, "editableContent");
|
1094
1266
|
return val == null ? this._editableContent : val;
|
1095
1267
|
};
|
1268
|
+
|
1269
|
+
/**
|
1270
|
+
* @public
|
1271
|
+
* @param {boolean} bool
|
1272
|
+
*/
|
1273
|
+
InCellEditingPlugin.prototype.enableReadonly = function (bool) {
|
1274
|
+
this._readonly = bool !== false;
|
1275
|
+
};
|
1276
|
+
/**
|
1277
|
+
* @public
|
1278
|
+
* @param {boolean} bool
|
1279
|
+
*/
|
1280
|
+
InCellEditingPlugin.prototype.disableReadonly = function () {
|
1281
|
+
this.enableReadonly(false);
|
1282
|
+
};
|
1096
1283
|
/** @public
|
1097
1284
|
* @description Supply an keyboard input. This is for testing purpose.
|
1098
1285
|
* @ignore
|
@@ -1105,6 +1292,16 @@ InCellEditingPlugin.prototype.supplyKey = function(keyName, context) {
|
|
1105
1292
|
this._onTextKeyUp(eventObj);
|
1106
1293
|
};
|
1107
1294
|
/** @public
|
1295
|
+
* @description Supply an keyboard input. This is for testing purpose.
|
1296
|
+
* @ignore
|
1297
|
+
* @param {string} keyName
|
1298
|
+
* @param {Object=} context
|
1299
|
+
*/
|
1300
|
+
InCellEditingPlugin.prototype.supplyGridKeydown = function(keyName, context) {
|
1301
|
+
let eventObj = this._mockKeyboardEvent(keyName, context);
|
1302
|
+
this._onGridKeyDown(eventObj);
|
1303
|
+
};
|
1304
|
+
/** @public
|
1108
1305
|
* @description Supply an double click event. This is for testing purpose.
|
1109
1306
|
* @ignore
|
1110
1307
|
* @param {number} colIndex
|
@@ -1122,6 +1319,9 @@ InCellEditingPlugin.prototype.mockDoubleClick = function(colIndex, rowIndex, con
|
|
1122
1319
|
*/
|
1123
1320
|
InCellEditingPlugin.prototype._onDoubleClick = function (e, opt_host) {
|
1124
1321
|
let t = this;
|
1322
|
+
if(t._readonly) {
|
1323
|
+
return;
|
1324
|
+
}
|
1125
1325
|
let host = opt_host || t.getRelativeGrid(e);
|
1126
1326
|
if(t.isEditing() || !host) { return; }
|
1127
1327
|
|
@@ -1318,6 +1518,7 @@ InCellEditingPlugin.prototype._openEditor = function (e, host, arg) {
|
|
1318
1518
|
|
1319
1519
|
// Dispatch an event for user to setup stuff
|
1320
1520
|
t._dispatch("editorOpened", arg); // User may modify the editor
|
1521
|
+
t.showStarterText(false);
|
1321
1522
|
|
1322
1523
|
inputElement.focus();
|
1323
1524
|
if(typeof inputElement.select === "function") {
|
@@ -1337,7 +1538,7 @@ InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
|
1337
1538
|
let t = this;
|
1338
1539
|
grid = grid || t._hosts[0];
|
1339
1540
|
// if open same row we will do nothing
|
1340
|
-
if(t._getRowIndex(t._activeRowId) === rowIndex || !grid) { return; }
|
1541
|
+
if(t._getRowIndex(t._activeRowId) === rowIndex || !grid || t._readonly) { return; }
|
1341
1542
|
|
1342
1543
|
// close all open editor
|
1343
1544
|
t.closeRowEditor(false, grid);
|
@@ -1835,6 +2036,7 @@ InCellEditingPlugin.prototype._commitText = function (committed, suggestionDetai
|
|
1835
2036
|
Dom.removeParent(t._customElement);
|
1836
2037
|
|
1837
2038
|
let grid = arg["grid"];
|
2039
|
+
this.showStarterText();
|
1838
2040
|
if(grid) {
|
1839
2041
|
t._freezeScrolling(grid, false);
|
1840
2042
|
grid.focus();
|
@@ -464,12 +464,22 @@ RowDraggingPlugin.prototype.getConfigObject = function (out_obj) {
|
|
464
464
|
if(!extOptions) {
|
465
465
|
extOptions = obj.rowDragging = {};
|
466
466
|
}
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
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
|
586
|
-
|
587
|
-
|
588
|
-
|
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
|
-
|
591
|
-
|
601
|
+
if(!this._basedOnContent) { // Protect against rowPositionChanged and postBindingSection event
|
602
|
+
this._updateMenuIcon();
|
603
|
+
}
|
604
|
+
this._dispatchSelectionChanged(e);
|
592
605
|
}
|
593
|
-
this.
|
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
|
-
|
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.
|
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
|
-
|
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.
|
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
|
-
|
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
|
-
|
1271
|
-
this._activeGrid.focus();
|
1272
|
-
}
|
1253
|
+
this._focusGrid(true);
|
1273
1254
|
};
|
1274
1255
|
|
1275
1256
|
/** @private
|
@@ -236,7 +236,9 @@ declare class DataView extends EventDispatcher {
|
|
236
236
|
|
237
237
|
public searchNext(rowRef: number|string|null, searchLogic: ((...params: any[]) => any)|null): number;
|
238
238
|
|
239
|
-
public stall(
|
239
|
+
public stall(bool?: boolean|null): boolean;
|
240
|
+
|
241
|
+
public stallSorting(bool?: boolean|null): boolean;
|
240
242
|
|
241
243
|
public enableAutoGroupRemoval(opt_bool?: boolean|null): boolean;
|
242
244
|
|
@@ -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;
|
@@ -221,6 +221,8 @@ declare class Grid extends EventDispatcher {
|
|
221
221
|
|
222
222
|
public insertRow(rowOption?: (RowDefinition.Options|string)|null, rowRef?: Grid.RowReference|null): RowDefinition|null;
|
223
223
|
|
224
|
+
public insertSegmentSeparator(rowOption?: RowDefinition.Options|null, rowRef?: Grid.RowReference|null): RowDefinition|null;
|
225
|
+
|
224
226
|
public insertRows(rowOptions: (RowDefinition.Options|string)[]|null, rowRef?: Grid.RowReference|null, opt_fields?: (string)[]|null): void;
|
225
227
|
|
226
228
|
public addStaticDataRows(dataRows: any[]|null, fields?: (string)[]|null): void;
|
@@ -285,6 +287,8 @@ declare class Grid extends EventDispatcher {
|
|
285
287
|
|
286
288
|
public setRicData(ric: string, values: any): void;
|
287
289
|
|
290
|
+
public getAllRics(): (string)[]|null;
|
291
|
+
|
288
292
|
public setRowData(rowRef: Grid.RowReference|null, values: any): void;
|
289
293
|
|
290
294
|
public setStaticRowData(rowRef: Grid.RowReference|null, values: any): void;
|
@@ -142,7 +142,5 @@ declare const ROW_DEF: string;
|
|
142
142
|
|
143
143
|
declare const ROW_TYPES: RowDefinition.RowTypes;
|
144
144
|
|
145
|
-
declare function rowData(userInput: string, extractedOptions: any): boolean;
|
146
|
-
|
147
145
|
export {RowDefinition, ROW_DEF, ROW_TYPES};
|
148
146
|
export default RowDefinition;
|
@@ -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
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"tr-grid-util": "1.3.
|
2
|
+
"tr-grid-util": "1.3.151",
|
3
3
|
"tr-grid-printer": "1.0.17",
|
4
4
|
"@grid/column-dragging": "1.0.20",
|
5
5
|
"@grid/row-segmenting": "1.0.31",
|
@@ -10,7 +10,7 @@
|
|
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",
|
13
|
-
"tr-grid-column-grouping": "1.0.
|
13
|
+
"tr-grid-column-grouping": "1.0.61",
|
14
14
|
"tr-grid-column-resizing": "1.0.28",
|
15
15
|
"tr-grid-column-selection": "1.0.33",
|
16
16
|
"tr-grid-column-stack": "1.0.75",
|
@@ -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.
|
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.
|
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.
|
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