@refinitiv-ui/efx-grid 6.0.115 → 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 +219 -47
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +14 -7
- 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
@@ -337,9 +337,12 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
|
|
337
337
|
|
338
338
|
this._setField(field, columnOption); // Perform some field manipulation
|
339
339
|
|
340
|
-
val = columnOption["name"]
|
340
|
+
val = columnOption["name"];
|
341
|
+
if(val == null) {
|
342
|
+
val = columnOption["title"]; // For backward compatability
|
343
|
+
}
|
341
344
|
if(val != null) { // Name can be empty string
|
342
|
-
this._name = val;
|
345
|
+
this._name = (typeof val === "string") ? val : (val + "");
|
343
346
|
this._defaultName = false;
|
344
347
|
}
|
345
348
|
|
@@ -53,6 +53,14 @@ DataConnector.prototype.getAllRics = function () {
|
|
53
53
|
return this._rics.getAllReferences();
|
54
54
|
};
|
55
55
|
|
56
|
+
/**
|
57
|
+
* @public
|
58
|
+
* @returns {boolean}
|
59
|
+
*/
|
60
|
+
DataConnector.prototype.hasRic = function () {
|
61
|
+
return this._rics.hasReference();
|
62
|
+
};
|
63
|
+
|
56
64
|
/** @public
|
57
65
|
* @returns {Array.<RowDefinition>}
|
58
66
|
*/
|
@@ -256,6 +256,8 @@ declare class Grid extends EventDispatcher {
|
|
256
256
|
|
257
257
|
public getAllRics(): (string)[]|null;
|
258
258
|
|
259
|
+
public hasRic(): boolean;
|
260
|
+
|
259
261
|
public setRowData(rowRef: Grid.RowReference|null, values: any): void;
|
260
262
|
|
261
263
|
public setStaticRowData(rowRef: Grid.RowReference|null, values: any): void;
|
@@ -296,6 +298,8 @@ declare class Grid extends EventDispatcher {
|
|
296
298
|
|
297
299
|
public clearSort(): void;
|
298
300
|
|
301
|
+
public getSortingStates(): (any)[];
|
302
|
+
|
299
303
|
public getDataView(): DataView|null;
|
300
304
|
|
301
305
|
public setPage(pageIndex: number): boolean;
|
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -600,6 +600,12 @@ Grid.prototype._focusingArgs = null;
|
|
600
600
|
* @private
|
601
601
|
*/
|
602
602
|
Grid.prototype._scrolledRow = -1;
|
603
|
+
/** @type {boolean}
|
604
|
+
* @private
|
605
|
+
*/
|
606
|
+
Grid.prototype._unlinking = false;
|
607
|
+
|
608
|
+
|
603
609
|
/** @public
|
604
610
|
*/
|
605
611
|
Grid.prototype.dispose = function() {
|
@@ -2770,7 +2776,9 @@ Grid.prototype.unlinkChain = function(rowRef) {
|
|
2770
2776
|
return;
|
2771
2777
|
}
|
2772
2778
|
|
2779
|
+
this._unlinking = true;
|
2773
2780
|
rowDef.unlinkChain();
|
2781
|
+
this._unlinking = false;
|
2774
2782
|
};
|
2775
2783
|
|
2776
2784
|
/** Alias to setRic
|
@@ -3076,6 +3084,14 @@ Grid.prototype.setRicData = function(ric, values) {
|
|
3076
3084
|
Grid.prototype.getAllRics = function() {
|
3077
3085
|
return this._connector.getAllRics();
|
3078
3086
|
};
|
3087
|
+
|
3088
|
+
/** Returns true if there is at least 1 RIC in the grid. This method includes RICs not in the row.
|
3089
|
+
* @public
|
3090
|
+
* @return {boolean}
|
3091
|
+
*/
|
3092
|
+
Grid.prototype.hasRic = function() {
|
3093
|
+
return this._connector.hasRic();
|
3094
|
+
};
|
3079
3095
|
/** A shorthand to set row data based on index of the specified row. It is better to keep rowDefinition object for updating data directly as row index can be changed by sorting and filtering.
|
3080
3096
|
* @public
|
3081
3097
|
* @param {Grid~RowReference} rowRef
|
@@ -3459,6 +3475,28 @@ Grid.prototype.getSortOrder = function() {
|
|
3459
3475
|
Grid.prototype.clearSort = function() {
|
3460
3476
|
this._stp.clearSortState(); // WARNING: No event is dispatched
|
3461
3477
|
};
|
3478
|
+
/** Get sorting states from sorting columns
|
3479
|
+
* @public
|
3480
|
+
* @return {!Array.<Object>} Array of sorting states ordered by priority. If there is no sorting column, an empty array is returned
|
3481
|
+
*/
|
3482
|
+
Grid.prototype.getSortingStates = function () { // This method is mainly for backward compatability
|
3483
|
+
let ary = [];
|
3484
|
+
let states = this._stp.getSortingStates();
|
3485
|
+
let stateCount = states.length;
|
3486
|
+
|
3487
|
+
for (let i = 0; i < stateCount; i++) {
|
3488
|
+
let state = states[i];
|
3489
|
+
let colIndex = this._stp.getSortedColumnIndex(i);
|
3490
|
+
|
3491
|
+
ary.push({
|
3492
|
+
"colId": this.getColumnId(colIndex),
|
3493
|
+
"colIndex": colIndex,
|
3494
|
+
"order": state["sortOrder"]
|
3495
|
+
});
|
3496
|
+
}
|
3497
|
+
|
3498
|
+
return ary;
|
3499
|
+
};
|
3462
3500
|
|
3463
3501
|
/**
|
3464
3502
|
* @private
|
@@ -3478,7 +3516,7 @@ Grid.prototype._onQuote2PostUpdate = function (e) {
|
|
3478
3516
|
*/
|
3479
3517
|
Grid.prototype._onDataChanged = function(e) {
|
3480
3518
|
let rowData = e["rowData"]; // Use rowData to retrieve corresponding subscription object
|
3481
|
-
if (!rowData) {
|
3519
|
+
if (!rowData || this._unlinking) {
|
3482
3520
|
return; // This must be a global change
|
3483
3521
|
}
|
3484
3522
|
let rowDef = rowData[ROW_DEF];
|
@@ -40,6 +40,16 @@ ReferenceCounter.prototype.getAllReferences = function() {
|
|
40
40
|
return Object.keys(this._counter);
|
41
41
|
};
|
42
42
|
|
43
|
+
/** @public
|
44
|
+
* @return {boolean}
|
45
|
+
*/
|
46
|
+
ReferenceCounter.prototype.hasReference = function() {
|
47
|
+
for (const key in this._counter) {
|
48
|
+
return true;
|
49
|
+
}
|
50
|
+
return false;
|
51
|
+
};
|
52
|
+
|
43
53
|
/** @public
|
44
54
|
* @return {!Array.<string>}
|
45
55
|
*/
|
@@ -12,7 +12,7 @@ import { DataTable } from "../../core/es6/data/DataTable.js";
|
|
12
12
|
* @property {Array.<string>=} fields=null Field that corresponds to the given static values
|
13
13
|
* @property {boolean=} asChain=false The given ric will be treated as a chain
|
14
14
|
* @property {string=} chainRic="" RIC to be used for chain request (overiding ric property)
|
15
|
-
* @property {boolean=} collapsed
|
15
|
+
* @property {boolean=} collapsed Chain is collapsed by default. Segment is expanded by default.
|
16
16
|
* @property {(string|null)=} label=null
|
17
17
|
* @property {boolean=} hidden=true When this row is hidden
|
18
18
|
* @property {boolean=} realTime=true Realtime row, able to request for JET/RTK
|
@@ -139,7 +139,7 @@ RowDefinition.prototype._subId = "";
|
|
139
139
|
/** @type {boolean|null}
|
140
140
|
* @private
|
141
141
|
*/
|
142
|
-
RowDefinition.prototype.
|
142
|
+
RowDefinition.prototype._collapsed = null;
|
143
143
|
/** @type {boolean}
|
144
144
|
* @private
|
145
145
|
*/
|
@@ -271,17 +271,15 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
271
271
|
this._realTime = val;
|
272
272
|
}
|
273
273
|
|
274
|
-
val = rowOptions["collapsed"];
|
275
|
-
let collapsed = extractedOptions["collapsed"];
|
276
|
-
if(val != null || !collapsed){
|
277
|
-
this._expanded = !collapsed;
|
278
|
-
}
|
279
|
-
|
280
274
|
val = rowOptions["asSegment"];
|
281
275
|
if(val != null) {
|
282
276
|
this._asSegment = val ? true : false;
|
283
277
|
}
|
284
278
|
|
279
|
+
if(this._isChain) {
|
280
|
+
this._collapsed = extractedOptions["collapsed"]; // Temporary state
|
281
|
+
}
|
282
|
+
|
285
283
|
val = rowOptions["keepModel"];
|
286
284
|
if(val) {
|
287
285
|
this._userModel = rowOptions;
|
@@ -403,12 +401,11 @@ RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
|
|
403
401
|
this.resetUpdates(); // Remove all previous data updates because a new content is just entered
|
404
402
|
|
405
403
|
this._userInput = userInput;
|
404
|
+
let collapsed = extractedOptions["collapsed"];
|
406
405
|
if(realtimeRow) {
|
407
|
-
let expanded = !extractedOptions["collapsed"];
|
408
406
|
let chainRic = extractedOptions["chainRic"];
|
409
407
|
if(asChain === true){
|
410
|
-
this._ric =
|
411
|
-
this._expanded = expanded; // Only chain can be expanded by 0#
|
408
|
+
this._ric = collapsed === true ? userInput : userInput.replace("0#", "");
|
412
409
|
} else {
|
413
410
|
this._ric = userInput;
|
414
411
|
}
|
@@ -435,15 +432,12 @@ RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
|
|
435
432
|
if(this._isChain) {
|
436
433
|
dv.setSegmentSeparator(this._rowId, true);
|
437
434
|
}
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
}
|
442
|
-
} else {
|
443
|
-
if (!this._expanded) {
|
444
|
-
this.collapseChain();
|
445
|
-
}
|
435
|
+
|
436
|
+
if(collapsed !== this.isChainCollapsed()) {
|
437
|
+
dv.collapseSegment(this._rowId, collapsed);
|
446
438
|
}
|
439
|
+
this._collapsed = null;
|
440
|
+
|
447
441
|
_stallSorting(dv, false, stalledSorting);
|
448
442
|
if(segmentId) { // If data id is changed and the row is a child of a segment, then segment child data id must be updated
|
449
443
|
dv.addSegmentChild(segmentId, this._rowId, this._dataId);
|
@@ -519,9 +513,9 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
519
513
|
obj["asChain"] = val;
|
520
514
|
}
|
521
515
|
|
522
|
-
val = this.
|
516
|
+
val = this._collapsed;
|
523
517
|
if(val != null) {
|
524
|
-
obj["collapsed"] =
|
518
|
+
obj["collapsed"] = val;
|
525
519
|
}
|
526
520
|
|
527
521
|
// check row hidden
|
@@ -1029,8 +1023,9 @@ RowDefinition.prototype.registerToView = function(view, rowId) {
|
|
1029
1023
|
if(isSegment) {
|
1030
1024
|
view.setSegmentSeparator(newRowId);
|
1031
1025
|
_stallSorting(view, false, stalledSorting);
|
1032
|
-
if(
|
1033
|
-
view.collapseSegment(newRowId);
|
1026
|
+
if(this._collapsed != null) {
|
1027
|
+
view.collapseSegment(newRowId, this._collapsed);
|
1028
|
+
this._collapsed = null;
|
1034
1029
|
}
|
1035
1030
|
} else if(!this._parent && parentRowId) { // Constituent cannot be added to another segment
|
1036
1031
|
view.addSegmentChild(parentRowId, newRowId, this._dataId);
|
@@ -1148,23 +1143,22 @@ RowDefinition.prototype._toRealTimeRow = function() {
|
|
1148
1143
|
if(!this._ric) { // Empty row
|
1149
1144
|
return;
|
1150
1145
|
}
|
1151
|
-
if(this.isRowHeader()) {
|
1152
|
-
return;
|
1146
|
+
if(this.isRowHeader() || !this._parent) {
|
1147
|
+
return; // If the row is already a normal row or row header, it cannot be converted
|
1153
1148
|
}
|
1154
1149
|
|
1155
|
-
this.
|
1150
|
+
this._realTime = true;
|
1151
|
+
this._dc.setRowData(this._dataId, null); // Remove existing data. WARNING: Trigger data update immediately
|
1156
1152
|
this._dataId = this._rowId + this._ric; // JET/RTK will generate data id to be rowId (given from this rowDef) + ric;
|
1157
1153
|
|
1158
1154
|
this._autoGenerated = false;
|
1159
1155
|
this._parent = null;
|
1160
1156
|
this._depthLevel = 0;
|
1161
1157
|
|
1162
|
-
|
1163
|
-
if(this._staticValues) {
|
1158
|
+
this.subscribeForUpdates();
|
1159
|
+
if(this._staticValues) { // Add static value to the new allocated row
|
1164
1160
|
this.setRowData(this._staticValues);
|
1165
1161
|
}
|
1166
|
-
|
1167
|
-
this.subscribeForUpdates();
|
1168
1162
|
};
|
1169
1163
|
|
1170
1164
|
/** @public
|
@@ -1198,7 +1192,7 @@ RowDefinition.prototype.unlinkChain = function() {
|
|
1198
1192
|
view.setSegmentSeparator(rid, false);
|
1199
1193
|
}
|
1200
1194
|
|
1201
|
-
this._isChain =
|
1195
|
+
this._isChain = false;
|
1202
1196
|
this._chainRic = "";
|
1203
1197
|
this._userInput = this._ric;
|
1204
1198
|
this._children = null;
|
@@ -1211,7 +1205,6 @@ RowDefinition.prototype.unlinkChain = function() {
|
|
1211
1205
|
*/
|
1212
1206
|
RowDefinition.prototype.collapseChain = function() {
|
1213
1207
|
if(this._isChain && this._view) {
|
1214
|
-
this._expanded = false;
|
1215
1208
|
return this._view.collapseSegment(this._rowId, true);
|
1216
1209
|
}
|
1217
1210
|
return false;
|
@@ -1227,7 +1220,6 @@ RowDefinition.prototype.collapseChain = function() {
|
|
1227
1220
|
*/
|
1228
1221
|
RowDefinition.prototype.expandChain = function() {
|
1229
1222
|
if(this._isChain && this._view) {
|
1230
|
-
this._expanded = true;
|
1231
1223
|
return this._view.collapseSegment(this._rowId, false);
|
1232
1224
|
}
|
1233
1225
|
return false;
|
@@ -1240,7 +1232,7 @@ RowDefinition.prototype.expandChain = function() {
|
|
1240
1232
|
* @return {boolean} Returns true if there is a change in view
|
1241
1233
|
*/
|
1242
1234
|
RowDefinition.prototype.toggleChain = function() {
|
1243
|
-
if(this.
|
1235
|
+
if(this.isChainExpanded()) {
|
1244
1236
|
return this.collapseChain();
|
1245
1237
|
} else {
|
1246
1238
|
return this.expandChain();
|
@@ -1421,6 +1413,8 @@ RowDefinition.extractRowOptions = function(rowOptions) {
|
|
1421
1413
|
asChain = true;
|
1422
1414
|
}
|
1423
1415
|
expanded = true;
|
1416
|
+
} else if(asChain) {
|
1417
|
+
expanded = false;
|
1424
1418
|
}
|
1425
1419
|
|
1426
1420
|
let extractedOptions = {};
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @param {Array} legacyColumnGroups
|
8
8
|
*/
|
9
9
|
let MenuEventAPI = function (menuModel) {
|
10
|
-
this._model = menuModel;
|
10
|
+
this._model = menuModel || null; // for mapping string value
|
11
11
|
this._items = [];
|
12
12
|
this._runningId = 0;
|
13
13
|
};
|
@@ -48,8 +48,10 @@ MenuEventAPI.prototype._addItem = function (item, level) {
|
|
48
48
|
if (typeof item === "string") { // The item is referencing another item
|
49
49
|
if (item === "SEPARATOR" || item.match(/-{3,}/)) { // Special keyword
|
50
50
|
this.addSeparator();
|
51
|
-
} else {
|
52
|
-
|
51
|
+
} else if(this._model) {
|
52
|
+
if(this._model.items) {
|
53
|
+
this._addItem(this._model.items[item], level + 1);
|
54
|
+
}
|
53
55
|
}
|
54
56
|
} else if (Array.isArray(item)) { // The item is an item list
|
55
57
|
let len = item.length;
|
@@ -67,7 +69,8 @@ MenuEventAPI.prototype.addSeparator = function () {
|
|
67
69
|
this._items.push({ type: "separator" });
|
68
70
|
};
|
69
71
|
|
70
|
-
/**
|
72
|
+
/** Get immidiate child menu items
|
73
|
+
* @public
|
71
74
|
* @returns {Array}
|
72
75
|
*/
|
73
76
|
MenuEventAPI.prototype.getMenuItems = function () {
|
@@ -76,7 +79,7 @@ MenuEventAPI.prototype.getMenuItems = function () {
|
|
76
79
|
|
77
80
|
/** @public
|
78
81
|
* @param {number} id
|
79
|
-
* @returns {Array
|
82
|
+
* @returns {Array} Array of items (ordered by leaf node to root node)
|
80
83
|
*/
|
81
84
|
MenuEventAPI.prototype.findItem = function (id) { // For internal use
|
82
85
|
return this._findItem(id, this._items);
|
@@ -85,13 +88,15 @@ MenuEventAPI.prototype.findItem = function (id) { // For internal use
|
|
85
88
|
/** @private
|
86
89
|
* @param {number} id
|
87
90
|
* @param {Array.<string> | Object} item
|
88
|
-
* @returns {
|
91
|
+
* @returns {Array}
|
89
92
|
*/
|
90
93
|
MenuEventAPI.prototype._findItem = function (id, item) {
|
91
|
-
let foundItemPath;
|
92
94
|
if (!item) {
|
93
95
|
return null;
|
94
|
-
}
|
96
|
+
}
|
97
|
+
|
98
|
+
let foundItemPath;
|
99
|
+
if (Array.isArray(item)) {
|
95
100
|
let len = item.length;
|
96
101
|
for (let i = 0; i < len; ++i) {
|
97
102
|
foundItemPath = this._findItem(id, item[i]);
|
@@ -23,11 +23,31 @@ MenuItem.prototype._elem;
|
|
23
23
|
/** @type {Object}
|
24
24
|
* @private
|
25
25
|
*/
|
26
|
-
MenuItem.prototype._options;
|
26
|
+
MenuItem.prototype._options = null;
|
27
27
|
/** @type {boolean}
|
28
28
|
* @private
|
29
29
|
*/
|
30
30
|
MenuItem.prototype._isSelectable = true;
|
31
|
+
/** @type {string}
|
32
|
+
* @private
|
33
|
+
*/
|
34
|
+
MenuItem.prototype._id = "";
|
35
|
+
/** @type {string}
|
36
|
+
* @private
|
37
|
+
*/
|
38
|
+
MenuItem.prototype._type = "";
|
39
|
+
/** @type {string}
|
40
|
+
* @private
|
41
|
+
*/
|
42
|
+
MenuItem.prototype._text = "";
|
43
|
+
/** @type {*}
|
44
|
+
* @private
|
45
|
+
*/
|
46
|
+
MenuItem.prototype._value = null;
|
47
|
+
/** @type {Array}
|
48
|
+
* @private
|
49
|
+
*/
|
50
|
+
MenuItem.prototype._items = null;
|
31
51
|
|
32
52
|
/** @private
|
33
53
|
* @param {Object} options
|
@@ -40,16 +60,20 @@ MenuItem.prototype._init = function(options) {
|
|
40
60
|
li.addEventListener("mouseover", t._onItemHovered);
|
41
61
|
li.addEventListener("click", t._onItemClicked);
|
42
62
|
t._elem = li;
|
43
|
-
t._options = options;
|
63
|
+
t._options = options || null;
|
44
64
|
};
|
45
|
-
|
46
65
|
/** @public */
|
47
66
|
MenuItem.prototype.dispose = function() {
|
48
67
|
let t = this;
|
49
68
|
t.removeAllEventListeners();
|
50
69
|
t._elem.removeEventListener("mouseover", t._onItemHovered);
|
51
70
|
t._elem.removeEventListener("click", t._onItemClicked);
|
52
|
-
|
71
|
+
|
72
|
+
let pn = t._elem.parentNode;
|
73
|
+
if(pn) {
|
74
|
+
pn.removeChild(t._elem);
|
75
|
+
}
|
76
|
+
t._elem = t._options = t._value = t._items = null;
|
53
77
|
};
|
54
78
|
|
55
79
|
/** @private
|
@@ -133,6 +157,17 @@ MenuItem.prototype._onItemClicked = function(e) {
|
|
133
157
|
t._dispatch("itemClicked", e);
|
134
158
|
};
|
135
159
|
|
160
|
+
/** @public
|
161
|
+
* @ignore
|
162
|
+
* @returns {Object}
|
163
|
+
*/
|
164
|
+
MenuItem.prototype._getEventHandlers = function() {
|
165
|
+
return {
|
166
|
+
mouseover: this._onItemHovered,
|
167
|
+
click: this._onItemClicked
|
168
|
+
};
|
169
|
+
};
|
170
|
+
|
136
171
|
/** @public
|
137
172
|
* @param {*} id
|
138
173
|
*/
|
@@ -146,7 +181,7 @@ MenuItem.prototype.setId = function(id) {
|
|
146
181
|
* @returns {*}
|
147
182
|
*/
|
148
183
|
MenuItem.prototype.getId = function() {
|
149
|
-
return this._id;
|
184
|
+
return this._id || "";
|
150
185
|
};
|
151
186
|
|
152
187
|
/** @public
|
@@ -162,7 +197,7 @@ MenuItem.prototype.setText = function(text) {
|
|
162
197
|
* @returns {string}
|
163
198
|
*/
|
164
199
|
MenuItem.prototype.getText = function() {
|
165
|
-
return this._text;
|
200
|
+
return this._text || "";
|
166
201
|
};
|
167
202
|
|
168
203
|
/** @public
|
@@ -206,8 +241,13 @@ MenuItem.prototype.isSelectable = function() {
|
|
206
241
|
*/
|
207
242
|
MenuItem.prototype.setItems = function(items) {
|
208
243
|
let t = this;
|
209
|
-
|
210
|
-
|
244
|
+
if(Array.isArray(items)) {
|
245
|
+
t._items = items;
|
246
|
+
t._elem.classList.add("has-child");
|
247
|
+
} else {
|
248
|
+
t._items = null;
|
249
|
+
t._elem.classList.remove("has-child");
|
250
|
+
}
|
211
251
|
};
|
212
252
|
|
213
253
|
/** @public
|
@@ -229,7 +269,7 @@ MenuItem.prototype.setType = function(type) {
|
|
229
269
|
* @returns {string}
|
230
270
|
*/
|
231
271
|
MenuItem.prototype.getType = function() {
|
232
|
-
return this._type;
|
272
|
+
return this._type || "";
|
233
273
|
};
|
234
274
|
|
235
275
|
/** @public
|
@@ -107,19 +107,22 @@ PopupMenu.prototype.dispose = function () {
|
|
107
107
|
}
|
108
108
|
};
|
109
109
|
|
110
|
-
/** @private
|
110
|
+
/** @private
|
111
|
+
* @function
|
112
|
+
* @param {*} obj
|
113
|
+
*/
|
114
|
+
let _disposeObject = function(obj) {
|
115
|
+
if(obj) {
|
116
|
+
obj.dispose();
|
117
|
+
}
|
118
|
+
};
|
119
|
+
|
120
|
+
/** @private
|
121
|
+
*/
|
111
122
|
PopupMenu.prototype._disposeChildren = function () {
|
112
123
|
let t = this;
|
113
|
-
t._children.forEach(
|
114
|
-
|
115
|
-
child.dispose();
|
116
|
-
}
|
117
|
-
});
|
118
|
-
t._childrenItem.forEach(function (child) {
|
119
|
-
if (child) {
|
120
|
-
child.dispose();
|
121
|
-
}
|
122
|
-
});
|
124
|
+
t._children.forEach(_disposeObject);
|
125
|
+
t._childrenItem.forEach(_disposeObject);
|
123
126
|
t._children.length = 0;
|
124
127
|
t._childrenItem.length = 0;
|
125
128
|
};
|
@@ -162,9 +165,11 @@ PopupMenu.prototype.setPosition = function(positioning, x, y) {
|
|
162
165
|
let sx = (window.scrollX != null) ? window.scrollX : window.pageXOffset;
|
163
166
|
let sy = (window.scrollY != null) ? window.scrollY : window.pageYOffset;
|
164
167
|
let rb = ww + sx; // view port right bound
|
165
|
-
let bb = wh + sy; // view port bottom
|
166
|
-
|
167
|
-
let
|
168
|
+
let bb = wh + sy; // view port bottom bound
|
169
|
+
|
170
|
+
let popupElem = t._popup.getElement();
|
171
|
+
let aw = popupElem.offsetWidth;
|
172
|
+
let ah = popupElem.offsetHeight;
|
168
173
|
|
169
174
|
if (x + aw > rb) { // Do not overflow right bound
|
170
175
|
x = rb - aw;
|
@@ -173,8 +178,8 @@ PopupMenu.prototype.setPosition = function(positioning, x, y) {
|
|
173
178
|
y = bb - ah;
|
174
179
|
}
|
175
180
|
|
176
|
-
|
177
|
-
|
181
|
+
popupElem.style.left = (x - sx) + "px"; // Due to fixed position we have to subtract window scrolling
|
182
|
+
popupElem.style.top = (y - sy) + "px";
|
178
183
|
}
|
179
184
|
};
|
180
185
|
|
@@ -230,17 +235,15 @@ PopupMenu.prototype.setMenu = function (menuItems) {
|
|
230
235
|
* @param {Event} e
|
231
236
|
*/
|
232
237
|
PopupMenu.prototype._hoveredChildItem = function (e) {
|
233
|
-
|
234
|
-
t._dispatch("itemHovered", e);
|
238
|
+
this._dispatch("itemHovered", e);
|
235
239
|
};
|
236
240
|
|
237
241
|
/** @private
|
238
242
|
* @param {Event} e
|
239
243
|
*/
|
240
244
|
PopupMenu.prototype._clickedChildItem = function (e) {
|
241
|
-
|
242
|
-
|
243
|
-
t.hide();
|
245
|
+
this._dispatch("itemClicked", e);
|
246
|
+
this.hide();
|
244
247
|
};
|
245
248
|
|
246
249
|
/** @private
|
@@ -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;
|