@refinitiv-ui/efx-grid 6.0.116 → 6.0.117
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +214 -42
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +9 -2
- package/lib/grid/index.js +1 -1
- package/lib/row-segmenting/es6/RowSegmenting.js +72 -29
- package/lib/rt-grid/dist/rt-grid.js +324 -141
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +5 -2
- package/lib/rt-grid/es6/DataConnector.d.ts +2 -0
- package/lib/rt-grid/es6/DataConnector.js +8 -0
- package/lib/rt-grid/es6/Grid.d.ts +4 -0
- package/lib/rt-grid/es6/Grid.js +39 -1
- package/lib/rt-grid/es6/ReferenceCounter.d.ts +2 -0
- package/lib/rt-grid/es6/ReferenceCounter.js +10 -0
- package/lib/rt-grid/es6/RowDefinition.js +28 -34
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.d.ts +1 -1
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.js +13 -8
- package/lib/tr-grid-contextmenu/es6/MenuItem.js +49 -9
- package/lib/tr-grid-contextmenu/es6/PopupMenu.js +24 -21
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +3 -0
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +115 -28
- package/lib/types/es6/InCellEditing.d.ts +3 -0
- package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +4 -0
- package/lib/types/es6/RealtimeGrid/ReferenceCounter.d.ts +2 -0
- package/lib/versions.json +3 -3
- package/package.json +1 -1
@@ -6,6 +6,7 @@ import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
|
6
6
|
import { isTouchDevice, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
7
7
|
import { ElfDate } from "../../tr-grid-util/es6/ElfDate.js";
|
8
8
|
import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
|
9
|
+
import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
|
9
10
|
|
10
11
|
/** @typedef {Object} InCellEditingPlugin~Options
|
11
12
|
* @description InCellEditingPlugin options that can be specified from `inCellEditing` property of the main grid's options
|
@@ -193,6 +194,12 @@ let InCellEditingPlugin = function (options) {
|
|
193
194
|
t._onAutoSuggestItemSelected = t._onAutoSuggestItemSelected.bind(t);
|
194
195
|
t._firstRendered = t._firstRendered.bind(t);
|
195
196
|
t._onGridKeyDown = t._onGridKeyDown.bind(t);
|
197
|
+
t._onRicAdded = t._onRicAdded.bind(t);
|
198
|
+
t._onRicRemoved = t._onRicRemoved.bind(t);
|
199
|
+
t._onColumnChanged = t._onColumnChanged.bind(t);
|
200
|
+
t._onRowCountChanged = t._onRowCountChanged.bind(t);
|
201
|
+
t._requestUpdateStarterText = t._requestUpdateStarterText.bind(t);
|
202
|
+
t._updateStarterTextConflator = new Conflator(100, this._requestUpdateStarterText);
|
196
203
|
t._hosts = [];
|
197
204
|
|
198
205
|
if(options) {
|
@@ -581,6 +588,37 @@ InCellEditingPlugin.prototype._onColumnAdded = function(e) {
|
|
581
588
|
}
|
582
589
|
};
|
583
590
|
|
591
|
+
/** @private
|
592
|
+
* @param {Event} e
|
593
|
+
*/
|
594
|
+
InCellEditingPlugin.prototype._onRicAdded = function(e) {
|
595
|
+
this._requestUpdateStarterText(false);
|
596
|
+
};
|
597
|
+
|
598
|
+
/** @private
|
599
|
+
* @param {Event} e
|
600
|
+
*/
|
601
|
+
InCellEditingPlugin.prototype._onRicRemoved = function(e) {
|
602
|
+
if(this._realTimeGrid && !this._realTimeGrid.hasRic()) {
|
603
|
+
this._requestUpdateStarterText();
|
604
|
+
}
|
605
|
+
};
|
606
|
+
|
607
|
+
/** @private
|
608
|
+
* @param {Event} e
|
609
|
+
*/
|
610
|
+
InCellEditingPlugin.prototype._onColumnChanged = function(e) {
|
611
|
+
this._requestUpdateStarterText();
|
612
|
+
};
|
613
|
+
|
614
|
+
|
615
|
+
/** @private
|
616
|
+
* @param {Event} e
|
617
|
+
*/
|
618
|
+
InCellEditingPlugin.prototype._onRowCountChanged = function(e) {
|
619
|
+
this._requestUpdateStarterText();
|
620
|
+
};
|
621
|
+
|
584
622
|
/** Called by grid system when initial plugins.
|
585
623
|
* @public
|
586
624
|
* @param {Object} host core grid object
|
@@ -596,6 +634,10 @@ InCellEditingPlugin.prototype.initialize = function (host, options) {
|
|
596
634
|
host.listen("columnAdded", this._onColumnAdded);
|
597
635
|
host.listen("firstRendered", this._firstRendered);
|
598
636
|
host.listen("keydown", this._onGridKeyDown);
|
637
|
+
host.listen("columnAdded", this._onColumnChanged);
|
638
|
+
host.listen("columnRemoved", this._onColumnChanged);
|
639
|
+
host.listen("rowAdded", this._onRowCountChanged);
|
640
|
+
host.listen("rowRemoved", this._onRowCountChanged);
|
599
641
|
|
600
642
|
host.getVScrollbar().listen("scroll", this._onScroll);
|
601
643
|
host.getHScrollbar().listen("scroll", this._onScroll);
|
@@ -658,13 +700,17 @@ InCellEditingPlugin.prototype.beforeProcessOption = function (optionName, option
|
|
658
700
|
*/
|
659
701
|
InCellEditingPlugin.prototype._afterInit = function () {
|
660
702
|
this._elfVersion = ElfUtil.getElfVersion();
|
703
|
+
if(this._realTimeGrid) {
|
704
|
+
this._realTimeGrid.listen("ricAdded", this._onRicAdded);
|
705
|
+
this._realTimeGrid.listen("ricRemoved", this._onRicRemoved);
|
706
|
+
}
|
661
707
|
};
|
662
708
|
|
663
709
|
/** @private
|
664
710
|
*/
|
665
711
|
InCellEditingPlugin.prototype._firstRendered = function () {
|
666
712
|
if(!this._readonly && this._starterText) {
|
667
|
-
this.
|
713
|
+
this._requestUpdateStarterText();
|
668
714
|
}
|
669
715
|
};
|
670
716
|
|
@@ -897,6 +943,12 @@ InCellEditingPlugin.prototype.unload = function (host) {
|
|
897
943
|
this._hosts.splice(at, 1);
|
898
944
|
|
899
945
|
host.unlisten("columnAdded", this._onColumnAdded);
|
946
|
+
host.unlisten("firstRendered", this._firstRendered);
|
947
|
+
host.unlisten("keydown", this._onGridKeyDown);
|
948
|
+
host.unlisten("columnAdded", this._onColumnChanged);
|
949
|
+
host.unlisten("columnRemoved", this._onColumnChanged);
|
950
|
+
host.unlisten("rowAdded", this._onRowCountChanged);
|
951
|
+
host.unlisten("rowRemoved", this._onRowCountChanged);
|
900
952
|
host.getVScrollbar().unlisten("scroll", this._onScroll);
|
901
953
|
host.getHScrollbar().unlisten("scroll", this._onScroll);
|
902
954
|
|
@@ -916,6 +968,11 @@ InCellEditingPlugin.prototype.unload = function (host) {
|
|
916
968
|
if(this._starterTextPopup) {
|
917
969
|
this._starterTextPopup.dispose();
|
918
970
|
}
|
971
|
+
if(this._realTimeGrid && this._starterText) {
|
972
|
+
this._realTimeGrid.removeEventListener("ricAdded", this._onRicAdded);
|
973
|
+
this._realTimeGrid.removeEventListener("ricRemoved", this._onRicRemoved);
|
974
|
+
}
|
975
|
+
this._updateStarterTextConflator.reset();
|
919
976
|
}
|
920
977
|
if(this.isEditing()) {
|
921
978
|
this.closeRowEditor(false);
|
@@ -1061,60 +1118,85 @@ InCellEditingPlugin.prototype._onGridKeyDown = function (e) {
|
|
1061
1118
|
* @param {boolean=} bool
|
1062
1119
|
*/
|
1063
1120
|
InCellEditingPlugin.prototype.showStarterText = function (bool) {
|
1064
|
-
|
1121
|
+
this._requestUpdateStarterText();
|
1065
1122
|
};
|
1066
1123
|
|
1067
|
-
|
1068
1124
|
/**
|
1069
|
-
* @
|
1070
|
-
* @
|
1125
|
+
* @description Request to show starter text
|
1126
|
+
* @public
|
1071
1127
|
*/
|
1072
|
-
InCellEditingPlugin.prototype.
|
1128
|
+
InCellEditingPlugin.prototype._requestUpdateStarterText = function () {
|
1073
1129
|
if(!this._realTimeGrid || !this._starterText) {
|
1074
1130
|
return;
|
1075
1131
|
}
|
1076
|
-
|
1077
|
-
|
1132
|
+
if(this._updateStarterTextConflator.conflate()){
|
1133
|
+
return;
|
1134
|
+
}
|
1135
|
+
this._updateStaterText();
|
1136
|
+
};
|
1137
|
+
|
1138
|
+
/**
|
1139
|
+
* @private
|
1140
|
+
* @param {boolean=} force
|
1141
|
+
*/
|
1142
|
+
InCellEditingPlugin.prototype._updateStaterText = function (force) {
|
1143
|
+
if(!this._realTimeGrid || !this._starterText) {
|
1078
1144
|
return;
|
1079
1145
|
}
|
1080
|
-
|
1146
|
+
// TODO: handled grid have ric but no one rows.
|
1147
|
+
let popup;
|
1081
1148
|
if(!this._starterTextPopup) {
|
1082
|
-
|
1149
|
+
popup = this._starterTextPopup = this._createStaterTextElement();
|
1083
1150
|
} else {
|
1084
|
-
|
1151
|
+
popup = this._starterTextPopup;
|
1085
1152
|
}
|
1086
|
-
if(
|
1087
|
-
|
1153
|
+
if(force === false || this._realTimeGrid.hasRic()) {
|
1154
|
+
popup.hide();
|
1088
1155
|
return;
|
1089
1156
|
}
|
1090
1157
|
let grid = this._hosts[0];
|
1091
1158
|
|
1159
|
+
let contentSection = grid.getSection("content");
|
1160
|
+
if(!contentSection || contentSection.getRowCount() <= 0) { // WARNING: Core grid is include title section but realtime grid not include
|
1161
|
+
popup.hide();
|
1162
|
+
return;
|
1163
|
+
}
|
1164
|
+
|
1092
1165
|
let editableColIndex = this._getFirstEditableColumnIndex();
|
1093
1166
|
if(editableColIndex < 0) { // not editable
|
1167
|
+
popup.hide();
|
1094
1168
|
return;
|
1095
1169
|
}
|
1096
|
-
grid.
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1170
|
+
if(grid.getScrollTop()) {
|
1171
|
+
grid.setScrollTop(0);
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
let editableCell = contentSection.getCell(editableColIndex, 0);
|
1175
|
+
let pos = grid.getRelativePosition(editableCell);
|
1176
|
+
if(pos) {
|
1177
|
+
let popupElem = popup.getElement();
|
1178
|
+
popupElem.style.top = pos.y + "px";
|
1179
|
+
popupElem.style.left = pos.x + "px";
|
1180
|
+
}
|
1181
|
+
popup.show(force, grid.getParent());
|
1100
1182
|
};
|
1101
1183
|
|
1102
1184
|
/** @private
|
1103
1185
|
* @return {number}
|
1104
1186
|
*/
|
1105
1187
|
InCellEditingPlugin.prototype._getFirstEditableColumnIndex = function () {
|
1106
|
-
if(this._readonly
|
1188
|
+
if(this._readonly) {
|
1107
1189
|
return -1;
|
1108
1190
|
}
|
1109
|
-
|
1110
1191
|
let colCount = this.getColumnCount();
|
1192
|
+
let editableCol = -1;
|
1111
1193
|
for (let i = 0; i < colCount; i++) {
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1194
|
+
if(this.isColumnEditable(i)) { // this._editableContent already check in this method
|
1195
|
+
editableCol = i;
|
1196
|
+
break;
|
1115
1197
|
}
|
1116
1198
|
}
|
1117
|
-
return
|
1199
|
+
return editableCol;
|
1118
1200
|
};
|
1119
1201
|
|
1120
1202
|
/** @private
|
@@ -1124,9 +1206,14 @@ InCellEditingPlugin.prototype._createStaterTextElement = function () {
|
|
1124
1206
|
let container = document.createElement("div");
|
1125
1207
|
container.textContent = this._starterText;
|
1126
1208
|
container.className = "starter-text";
|
1127
|
-
let popup = new Popup(container, {
|
1128
|
-
|
1129
|
-
|
1209
|
+
let popup = window.popup = new Popup(container, {
|
1210
|
+
positioning: "custom",
|
1211
|
+
autoHiding: false,
|
1212
|
+
autoRepositioning: false,
|
1213
|
+
hideOnScroll: false
|
1214
|
+
});
|
1215
|
+
let popupElement = popup.getElement();
|
1216
|
+
popupElement.style.position = "absolute";
|
1130
1217
|
return popup;
|
1131
1218
|
};
|
1132
1219
|
|
@@ -1550,7 +1637,7 @@ InCellEditingPlugin.prototype._openEditor = function (e, host, arg) {
|
|
1550
1637
|
|
1551
1638
|
// Dispatch an event for user to setup stuff
|
1552
1639
|
t._dispatch("editorOpened", arg); // User may modify the editor
|
1553
|
-
t.
|
1640
|
+
t._updateStaterText(false); // Currently Starter text open doesn't have the ric, it needs to be forcefully hide
|
1554
1641
|
|
1555
1642
|
inputElement.focus();
|
1556
1643
|
if(typeof inputElement.select === "function") {
|
@@ -2078,7 +2165,7 @@ InCellEditingPlugin.prototype._commitText = function (committed, suggestionDetai
|
|
2078
2165
|
Dom.removeParent(t._customElement);
|
2079
2166
|
|
2080
2167
|
let grid = arg["grid"];
|
2081
|
-
this.
|
2168
|
+
this._requestUpdateStarterText(); // Need to updaate starter text when text commit
|
2082
2169
|
if(grid) {
|
2083
2170
|
t._freezeScrolling(grid, false);
|
2084
2171
|
grid.focus();
|
@@ -6,6 +6,7 @@ import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
|
6
6
|
import { isTouchDevice, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
7
7
|
import { ElfDate } from "../../tr-grid-util/es6/ElfDate.js";
|
8
8
|
import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
|
9
|
+
import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
|
9
10
|
|
10
11
|
declare namespace InCellEditingPlugin {
|
11
12
|
|
@@ -85,6 +86,8 @@ declare class InCellEditingPlugin extends GridPlugin {
|
|
85
86
|
|
86
87
|
public showStarterText(bool?: boolean|null): void;
|
87
88
|
|
89
|
+
public _requestUpdateStarterText(): void;
|
90
|
+
|
88
91
|
public isEditing(): boolean;
|
89
92
|
|
90
93
|
public getTextBox(columnIndex?: number|null, grid?: any): Element|null;
|
@@ -293,6 +293,8 @@ declare class Grid extends EventDispatcher {
|
|
293
293
|
|
294
294
|
public getAllRics(): (string)[]|null;
|
295
295
|
|
296
|
+
public hasRic(): boolean;
|
297
|
+
|
296
298
|
public setRowData(rowRef: Grid.RowReference|null, values: any): void;
|
297
299
|
|
298
300
|
public setStaticRowData(rowRef: Grid.RowReference|null, values: any): void;
|
@@ -333,6 +335,8 @@ declare class Grid extends EventDispatcher {
|
|
333
335
|
|
334
336
|
public clearSort(): void;
|
335
337
|
|
338
|
+
public getSortingStates(): (any)[];
|
339
|
+
|
336
340
|
public getDataView(): DataView|null;
|
337
341
|
|
338
342
|
public setPage(pageIndex: number): boolean;
|
package/lib/versions.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"tr-grid-util": "1.3.155",
|
3
3
|
"tr-grid-printer": "1.0.18",
|
4
4
|
"@grid/column-dragging": "1.0.20",
|
5
|
-
"@grid/row-segmenting": "1.0.
|
5
|
+
"@grid/row-segmenting": "1.0.32",
|
6
6
|
"@grid/statistics-row": "1.0.17",
|
7
7
|
"@grid/zoom": "1.0.11",
|
8
8
|
"tr-grid-auto-tooltip": "1.1.6",
|
@@ -16,10 +16,10 @@
|
|
16
16
|
"tr-grid-column-stack": "1.0.75",
|
17
17
|
"tr-grid-conditional-coloring": "1.0.70",
|
18
18
|
"tr-grid-content-wrap": "1.0.20",
|
19
|
-
"tr-grid-contextmenu": "1.0.
|
19
|
+
"tr-grid-contextmenu": "1.0.43",
|
20
20
|
"tr-grid-filter-input": "0.9.41",
|
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.89",
|
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",
|
package/package.json
CHANGED