@refinitiv-ui/efx-grid 6.0.112 → 6.0.113
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +14 -5
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +13 -5
- package/lib/core/es6/grid/components/Cell.js +1 -0
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +20 -10
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +5 -5
- package/lib/tr-grid-contextmenu/es6/ContextMenu.d.ts +1 -1
- package/lib/tr-grid-contextmenu/es6/ContextMenu.js +34 -34
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.js +7 -7
- package/lib/tr-grid-contextmenu/es6/MenuItem.js +13 -13
- package/lib/tr-grid-contextmenu/es6/PopupMenu.js +33 -33
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +11 -3
- package/lib/tr-grid-util/es6/CellPainter.js +6 -0
- package/lib/types/es6/ContextMenu.d.ts +1 -1
- package/lib/types/es6/RowFiltering.d.ts +8 -0
- package/lib/versions.json +3 -3
- package/package.json +2 -1
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -4237,12 +4237,12 @@ Grid.prototype._focusNextCellContent = function(args) {
|
|
4237
4237
|
let grid = this._grid;
|
4238
4238
|
let section = grid.getSection("content");
|
4239
4239
|
let viewInfo = grid.getVerticalViewInfo();
|
4240
|
-
let
|
4240
|
+
let lastFullRow = viewInfo.lastFullRow;
|
4241
4241
|
let rowCount = this.getRowCount();
|
4242
4242
|
for(let r = rowIndex; r < rowCount; r++) {
|
4243
4243
|
for(i = startIdx; i < len; i++) {
|
4244
4244
|
let c = focusableColIndices[i];
|
4245
|
-
if(r >
|
4245
|
+
if(r > lastFullRow) {
|
4246
4246
|
this._requestScroll(args, c, r);
|
4247
4247
|
return;
|
4248
4248
|
} else {
|
@@ -4292,11 +4292,11 @@ Grid.prototype._focusPrevCellContent = function(args) {
|
|
4292
4292
|
let grid = this._grid;
|
4293
4293
|
let section = grid.getSection("content");
|
4294
4294
|
let viewInfo = grid.getVerticalViewInfo();
|
4295
|
-
let
|
4295
|
+
let firstFullRow = viewInfo.firstFullRow;
|
4296
4296
|
for(let r = rowIndex; r >= 0; r--) {
|
4297
4297
|
for(i = startIdx; i >= 0; i--) {
|
4298
4298
|
let c = focusableColIndices[i];
|
4299
|
-
if(r <
|
4299
|
+
if(r < firstFullRow) {
|
4300
4300
|
this._requestScroll(args, c, r);
|
4301
4301
|
return;
|
4302
4302
|
} else {
|
@@ -4350,7 +4350,7 @@ Grid.prototype._onTabNavigation = function(e) {
|
|
4350
4350
|
}
|
4351
4351
|
let startingRowIndex = pos["rowIndex"];
|
4352
4352
|
if(e.onTheEdge) {
|
4353
|
-
let viewInfo = this._grid.
|
4353
|
+
let viewInfo = this._grid.getVerticalViewInfo();
|
4354
4354
|
startingRowIndex = keyEvt.shiftKey ? viewInfo.lastFullRow : viewInfo.firstFullRow;
|
4355
4355
|
}
|
4356
4356
|
let args = {
|
@@ -3,7 +3,7 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
|
|
3
3
|
import MenuEventAPI from "./MenuEventAPI.js";
|
4
4
|
import PopupMenu from "./PopupMenu.js";
|
5
5
|
import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
|
-
import
|
6
|
+
import { rgb2Hex, num2Hex, hex2Num, blendColor, getContrastColor } from "../../tr-grid-util/es6/Color.js";
|
7
7
|
|
8
8
|
declare namespace ContextMenuPlugin {
|
9
9
|
|
@@ -3,7 +3,7 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
|
|
3
3
|
import MenuEventAPI from "./MenuEventAPI.js";
|
4
4
|
import PopupMenu from "./PopupMenu.js";
|
5
5
|
import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
|
-
import
|
6
|
+
import { rgb2Hex, num2Hex, hex2Num, blendColor, getContrastColor } from "../../tr-grid-util/es6/Color.js";
|
7
7
|
|
8
8
|
/** @typedef {"header" | "content" | "footer" | "filterRow"} ContextMenuPlugin~Context
|
9
9
|
* @description All available context types for the extension
|
@@ -71,8 +71,8 @@ import CellPainter from "../../tr-grid-util/es6/CellPainter.js";
|
|
71
71
|
* @extends {GridPlugin}
|
72
72
|
* @param {(ContextMenuPlugin~Options|ContextMenuPlugin~OnMenuEvent)=} options
|
73
73
|
*/
|
74
|
-
|
75
|
-
|
74
|
+
let ContextMenuPlugin = function (options) {
|
75
|
+
let t = this;
|
76
76
|
t._hosts = [];
|
77
77
|
|
78
78
|
t._onItemClicked = t._onItemClicked.bind(t);
|
@@ -126,7 +126,7 @@ ContextMenuPlugin.prototype._contextMenu = null;
|
|
126
126
|
* @return {string}
|
127
127
|
*/
|
128
128
|
ContextMenuPlugin._styleCalculator = function (colors) {
|
129
|
-
|
129
|
+
let css = prettifyCss([
|
130
130
|
".tr-contextmenu", [
|
131
131
|
"outline: none;",
|
132
132
|
"box-sizing: border-box;",
|
@@ -197,10 +197,10 @@ ContextMenuPlugin._styleCalculator = function (colors) {
|
|
197
197
|
]
|
198
198
|
]);
|
199
199
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
200
|
+
let hex = rgb2Hex(colors.tableBg);
|
201
|
+
let triplet = hex2Num(hex);
|
202
|
+
let bw = getContrastColor(triplet);
|
203
|
+
let blendRatio;
|
204
204
|
if (bw === "#000000") { // Light theme
|
205
205
|
blendRatio = 0.1;
|
206
206
|
css = css.replace(/disabledColor/g, "lightgrey");
|
@@ -208,7 +208,7 @@ ContextMenuPlugin._styleCalculator = function (colors) {
|
|
208
208
|
blendRatio = 0.2;
|
209
209
|
css = css.replace(/disabledColor/g, "gray");
|
210
210
|
}
|
211
|
-
|
211
|
+
let hoverd = num2Hex(blendColor(hex, bw, blendRatio));
|
212
212
|
css = css.replace(/hoveredColor/g, hoverd);
|
213
213
|
css = css.replace(/backgroundColor/g, colors.tableBg);
|
214
214
|
css = css.replace(/fontColor/g, colors.tableText);
|
@@ -229,7 +229,7 @@ ContextMenuPlugin.prototype.getName = function () {
|
|
229
229
|
* @param {Object=} options
|
230
230
|
*/
|
231
231
|
ContextMenuPlugin.prototype.initialize = function (host, options) {
|
232
|
-
|
232
|
+
let t = this;
|
233
233
|
if (t._hosts.indexOf(host) >= 0) { return; }
|
234
234
|
t._hosts.push(host);
|
235
235
|
|
@@ -245,7 +245,7 @@ ContextMenuPlugin.prototype.initialize = function (host, options) {
|
|
245
245
|
* @param {Object} host core grid object
|
246
246
|
*/
|
247
247
|
ContextMenuPlugin.prototype.unload = function (host) {
|
248
|
-
|
248
|
+
let at = this._hosts.indexOf(host);
|
249
249
|
if (at < 0) { return; }
|
250
250
|
|
251
251
|
host.unlisten("postSectionRender", this._onPostSectionRender);
|
@@ -266,9 +266,9 @@ ContextMenuPlugin.prototype.unload = function (host) {
|
|
266
266
|
ContextMenuPlugin.prototype.config = function (options) {
|
267
267
|
if (!options) { return; }
|
268
268
|
|
269
|
-
|
269
|
+
let t = this;
|
270
270
|
|
271
|
-
|
271
|
+
let contextMenu = options["contextMenu"];
|
272
272
|
|
273
273
|
if (contextMenu == null) { return; }
|
274
274
|
else if (typeof contextMenu === "object") {
|
@@ -294,7 +294,7 @@ ContextMenuPlugin.prototype.config = function (options) {
|
|
294
294
|
* @return {!Object}
|
295
295
|
*/
|
296
296
|
ContextMenuPlugin.prototype.getConfigObject = function (gridOptions) {
|
297
|
-
|
297
|
+
let obj = gridOptions || {};
|
298
298
|
|
299
299
|
obj.contextMenu = this._contextMenu;
|
300
300
|
|
@@ -313,13 +313,13 @@ ContextMenuPlugin.prototype.getMenuModel = function () {
|
|
313
313
|
* @return {!Object} Mouse related information
|
314
314
|
*/
|
315
315
|
ContextMenuPlugin.prototype._configureMouseInfo = function (e) {
|
316
|
-
|
317
|
-
|
316
|
+
let host = this._hosts[0];
|
317
|
+
let mouseInfo = host.getRelativePosition(e);
|
318
318
|
|
319
319
|
// Supply possibly needed arguments for the event handler
|
320
320
|
mouseInfo.context = this._contextMap[mouseInfo.sectionType] || "";
|
321
|
-
|
322
|
-
|
321
|
+
let colIndex = mouseInfo.colIndex;
|
322
|
+
let columnDef = mouseInfo.columnDef = {};
|
323
323
|
mouseInfo.field = columnDef.field = this.getColumnField(colIndex);
|
324
324
|
mouseInfo.colId = columnDef.id = this.getColumnId(colIndex);
|
325
325
|
|
@@ -331,13 +331,13 @@ ContextMenuPlugin.prototype._configureMouseInfo = function (e) {
|
|
331
331
|
}
|
332
332
|
|
333
333
|
if (this._csp) {
|
334
|
-
|
334
|
+
let selCols = this._csp.getSelectedColumns();
|
335
335
|
mouseInfo.selectedColumns = selCols && selCols.length ? selCols : null;
|
336
336
|
} else {
|
337
337
|
mouseInfo.selectedColumns = null;
|
338
338
|
}
|
339
339
|
if (this._rsp) {
|
340
|
-
|
340
|
+
let selRows = this._rsp.getSelectedRows();
|
341
341
|
mouseInfo.selectedRows = selRows && selRows.length ? selRows : null;
|
342
342
|
} else {
|
343
343
|
mouseInfo.selectedRows = null;
|
@@ -351,21 +351,21 @@ ContextMenuPlugin.prototype._configureMouseInfo = function (e) {
|
|
351
351
|
* @param {Object} e
|
352
352
|
*/
|
353
353
|
ContextMenuPlugin.prototype._rightClickedHandler = function (e) {
|
354
|
-
|
354
|
+
let t = this;
|
355
355
|
|
356
|
-
|
356
|
+
let host = t._hosts[0];
|
357
357
|
|
358
358
|
if (!host) { return; }
|
359
359
|
|
360
|
-
|
360
|
+
let pos = host.getRelativePosition(e);
|
361
361
|
if(pos.rowIndex == null) {
|
362
362
|
return;
|
363
363
|
}
|
364
364
|
|
365
365
|
e.preventDefault(); // Prevent default system menu
|
366
366
|
|
367
|
-
|
368
|
-
|
367
|
+
let mouseInfo = t._mouseInfo = t._configureMouseInfo(e);
|
368
|
+
let contextMenu = t._contextMenu;
|
369
369
|
|
370
370
|
if (!contextMenu || t._disabled) { return; }
|
371
371
|
|
@@ -375,7 +375,7 @@ ContextMenuPlugin.prototype._rightClickedHandler = function (e) {
|
|
375
375
|
t._menuAPI.clear(); // Clear cache everytime
|
376
376
|
mouseInfo.menu = t._menuAPI; // Augment the event argument with Context Menu API
|
377
377
|
|
378
|
-
|
378
|
+
let menuItems;
|
379
379
|
if (contextMenu.onMenu) {
|
380
380
|
contextMenu.onMenu(mouseInfo); // Let user populates menu items based on the context
|
381
381
|
menuItems = mouseInfo.menu.getMenuItems();
|
@@ -390,7 +390,7 @@ ContextMenuPlugin.prototype._rightClickedHandler = function (e) {
|
|
390
390
|
t._popup.dispose();
|
391
391
|
}
|
392
392
|
|
393
|
-
|
393
|
+
let hostElem = host.getElement();
|
394
394
|
|
395
395
|
// TODO: Cannot initiate PopupMenu once because of blur timer trigger in Popup.
|
396
396
|
// Blur timer (10ms) will try to hide popup after mousedown event.
|
@@ -410,24 +410,24 @@ ContextMenuPlugin.prototype._rightClickedHandler = function (e) {
|
|
410
410
|
* @param {Event} e
|
411
411
|
*/
|
412
412
|
ContextMenuPlugin.prototype._onItemClicked = function (e) {
|
413
|
-
|
414
|
-
|
413
|
+
let menuItem = e.item;
|
414
|
+
let subMenu = menuItem.items;
|
415
415
|
if (subMenu && subMenu.length) {
|
416
416
|
return; // The selected item is not a leaf node
|
417
417
|
}
|
418
418
|
|
419
|
-
|
419
|
+
let pathArray = this._menuAPI.findItem(menuItem.id);
|
420
420
|
if (!pathArray) {
|
421
421
|
return; // Invalid item id
|
422
422
|
}
|
423
423
|
|
424
424
|
// User don't need to specify callback for each individual item.
|
425
425
|
// User can specify call back at the parent item as a fallback method
|
426
|
-
|
427
|
-
for (
|
428
|
-
|
426
|
+
let len = pathArray.length;
|
427
|
+
for (let i = 0; i < len; ++i) {
|
428
|
+
let itemModel = pathArray[i];
|
429
429
|
if (itemModel.callback) {
|
430
|
-
for (
|
430
|
+
for (let propName in this._mouseInfo) {
|
431
431
|
e[propName] = this._mouseInfo[propName];
|
432
432
|
}
|
433
433
|
itemModel.callback(e);
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* @param {Array} columnGroups
|
7
7
|
* @param {Array} legacyColumnGroups
|
8
8
|
*/
|
9
|
-
|
9
|
+
let MenuEventAPI = function (menuModel) {
|
10
10
|
this._model = menuModel;
|
11
11
|
this._items = [];
|
12
12
|
this._runningId = 0;
|
@@ -52,8 +52,8 @@ MenuEventAPI.prototype._addItem = function (item, level) {
|
|
52
52
|
this._addItem(this._model.items[item], level + 1);
|
53
53
|
}
|
54
54
|
} else if (Array.isArray(item)) { // The item is an item list
|
55
|
-
|
56
|
-
for (
|
55
|
+
let len = item.length;
|
56
|
+
for (let i = 0; i < len; ++i) {
|
57
57
|
this._addItem(item[i], level + 1);
|
58
58
|
}
|
59
59
|
} else { // Assume the item has an object type
|
@@ -88,12 +88,12 @@ MenuEventAPI.prototype.findItem = function (id) { // For internal use
|
|
88
88
|
* @returns {string}
|
89
89
|
*/
|
90
90
|
MenuEventAPI.prototype._findItem = function (id, item) {
|
91
|
-
|
91
|
+
let foundItemPath;
|
92
92
|
if (!item) {
|
93
93
|
return null;
|
94
94
|
} else if (Array.isArray(item)) {
|
95
|
-
|
96
|
-
for (
|
95
|
+
let len = item.length;
|
96
|
+
for (let i = 0; i < len; ++i) {
|
97
97
|
foundItemPath = this._findItem(id, item[i]);
|
98
98
|
if (foundItemPath) {
|
99
99
|
return foundItemPath;
|
@@ -116,7 +116,7 @@ MenuEventAPI.prototype._findItem = function (id, item) {
|
|
116
116
|
*/
|
117
117
|
MenuEventAPI.prototype._assignId = function (items) {
|
118
118
|
if (Array.isArray(items)) {
|
119
|
-
for (
|
119
|
+
for (let i = 0; i < items.length; i++) {
|
120
120
|
this._assignId(items[i]);
|
121
121
|
}
|
122
122
|
} else {
|
@@ -5,8 +5,8 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
|
|
5
5
|
* @extends {EventDispatcher}
|
6
6
|
* @param {Object} options
|
7
7
|
*/
|
8
|
-
|
9
|
-
|
8
|
+
let MenuItem = function (options) {
|
9
|
+
let t = this;
|
10
10
|
|
11
11
|
t._onItemHovered = t._onItemHovered.bind(t);
|
12
12
|
t._onItemClicked = t._onItemClicked.bind(t);
|
@@ -33,9 +33,9 @@ MenuItem.prototype._isSelectable = true;
|
|
33
33
|
* @param {Object} options
|
34
34
|
*/
|
35
35
|
MenuItem.prototype._init = function(options) {
|
36
|
-
|
36
|
+
let t = this;
|
37
37
|
|
38
|
-
|
38
|
+
let li = document.createElement("li");
|
39
39
|
li.className = "tr-contextmenu-item";
|
40
40
|
li.addEventListener("mouseover", t._onItemHovered);
|
41
41
|
li.addEventListener("click", t._onItemClicked);
|
@@ -45,7 +45,7 @@ MenuItem.prototype._init = function(options) {
|
|
45
45
|
|
46
46
|
/** @public */
|
47
47
|
MenuItem.prototype.dispose = function() {
|
48
|
-
|
48
|
+
let t = this;
|
49
49
|
t.removeAllEventListeners();
|
50
50
|
t._elem.removeEventListener("mouseover", t._onItemHovered);
|
51
51
|
t._elem.removeEventListener("click", t._onItemClicked);
|
@@ -58,9 +58,9 @@ MenuItem.prototype.dispose = function() {
|
|
58
58
|
MenuItem.prototype._config = function(opt_model) {
|
59
59
|
if (!opt_model) opt_model = {};
|
60
60
|
|
61
|
-
|
61
|
+
let pref;
|
62
62
|
|
63
|
-
|
63
|
+
let t = this;
|
64
64
|
|
65
65
|
pref = opt_model["id"];
|
66
66
|
if (pref) {
|
@@ -111,7 +111,7 @@ MenuItem.prototype._config = function(opt_model) {
|
|
111
111
|
* @param {Object} e
|
112
112
|
*/
|
113
113
|
MenuItem.prototype._onItemHovered = function(e) {
|
114
|
-
|
114
|
+
let t = this;
|
115
115
|
|
116
116
|
// Cannot be hover if disabled or has no children
|
117
117
|
if (!t.isSelectable()) { return; }
|
@@ -124,7 +124,7 @@ MenuItem.prototype._onItemHovered = function(e) {
|
|
124
124
|
* @param {Object} e
|
125
125
|
*/
|
126
126
|
MenuItem.prototype._onItemClicked = function(e) {
|
127
|
-
|
127
|
+
let t = this;
|
128
128
|
|
129
129
|
// Cannot be clicked if disabled or has children
|
130
130
|
if (!t.isSelectable() || Array.isArray(t.getItems())) { return; }
|
@@ -137,7 +137,7 @@ MenuItem.prototype._onItemClicked = function(e) {
|
|
137
137
|
* @param {*} id
|
138
138
|
*/
|
139
139
|
MenuItem.prototype.setId = function(id) {
|
140
|
-
|
140
|
+
let t = this;
|
141
141
|
t._elem.setAttribute("id", id);
|
142
142
|
this._id = id;
|
143
143
|
};
|
@@ -153,7 +153,7 @@ MenuItem.prototype.getId = function() {
|
|
153
153
|
* @param {*} text
|
154
154
|
*/
|
155
155
|
MenuItem.prototype.setText = function(text) {
|
156
|
-
|
156
|
+
let t = this;
|
157
157
|
t._elem.textContent = text + "";
|
158
158
|
this._text = text;
|
159
159
|
};
|
@@ -183,7 +183,7 @@ MenuItem.prototype.getValue = function() {
|
|
183
183
|
* @param {boolean=} selectable
|
184
184
|
*/
|
185
185
|
MenuItem.prototype.setSelectable = function(selectable) {
|
186
|
-
|
186
|
+
let t = this;
|
187
187
|
if (selectable) {
|
188
188
|
t._elem.removeAttribute("data-unselectable");
|
189
189
|
t._elem.removeAttribute("disabled");
|
@@ -205,7 +205,7 @@ MenuItem.prototype.isSelectable = function() {
|
|
205
205
|
* @param {Array} items
|
206
206
|
*/
|
207
207
|
MenuItem.prototype.setItems = function(items) {
|
208
|
-
|
208
|
+
let t = this;
|
209
209
|
t._items = items;
|
210
210
|
t._elem.classList.add("has-child");
|
211
211
|
};
|
@@ -7,8 +7,8 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
|
|
7
7
|
* @extends {EventDispatcher}
|
8
8
|
* @param {Element} parentElement
|
9
9
|
*/
|
10
|
-
|
11
|
-
|
10
|
+
let PopupMenu = function (parentElement) {
|
11
|
+
let t = this;
|
12
12
|
|
13
13
|
t.show = t.show.bind(t);
|
14
14
|
t.attachTo = t.attachTo.bind(t);
|
@@ -64,11 +64,11 @@ PopupMenu.prototype._isMounted;
|
|
64
64
|
* @param {Element} parentElement
|
65
65
|
*/
|
66
66
|
PopupMenu.prototype._init = function(parentElement) {
|
67
|
-
|
67
|
+
let t = this;
|
68
68
|
|
69
|
-
|
69
|
+
let topNode = document.createElement("div");
|
70
70
|
topNode.className = "tr-contextmenu-popup";
|
71
|
-
|
71
|
+
let ul = document.createElement("ul");
|
72
72
|
ul.className = "tr-contextmenu";
|
73
73
|
topNode.appendChild(ul);
|
74
74
|
|
@@ -98,7 +98,7 @@ PopupMenu.prototype.isDisposed = function () {
|
|
98
98
|
|
99
99
|
/** @public */
|
100
100
|
PopupMenu.prototype.dispose = function () {
|
101
|
-
|
101
|
+
let t = this;
|
102
102
|
if (t._isMounted) {
|
103
103
|
t.removeAllEventListeners();
|
104
104
|
t._popup.dispose();
|
@@ -109,7 +109,7 @@ PopupMenu.prototype.dispose = function () {
|
|
109
109
|
|
110
110
|
/** @private */
|
111
111
|
PopupMenu.prototype._disposeChildren = function () {
|
112
|
-
|
112
|
+
let t = this;
|
113
113
|
t._children.forEach(function (child) {
|
114
114
|
if (child) {
|
115
115
|
child.dispose();
|
@@ -126,7 +126,7 @@ PopupMenu.prototype._disposeChildren = function () {
|
|
126
126
|
|
127
127
|
/** @public */
|
128
128
|
PopupMenu.prototype.show = function () {
|
129
|
-
|
129
|
+
let t = this;
|
130
130
|
t._popup.show(true, t._parentElement);
|
131
131
|
t.setPosition(t._popup._positioning, t._x, t._y);
|
132
132
|
};
|
@@ -152,19 +152,19 @@ PopupMenu.prototype.attachTo = function (elem, positioning) {
|
|
152
152
|
* @param {number} y
|
153
153
|
*/
|
154
154
|
PopupMenu.prototype.setPosition = function(positioning, x, y) {
|
155
|
-
|
155
|
+
let t = this;
|
156
156
|
|
157
157
|
if (positioning === "custom") {
|
158
158
|
t._x = x;
|
159
159
|
t._y = y;
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
160
|
+
let ww = window.innerWidth;
|
161
|
+
let wh = window.innerHeight;
|
162
|
+
let sx = (window.scrollX != null) ? window.scrollX : window.pageXOffset;
|
163
|
+
let sy = (window.scrollY != null) ? window.scrollY : window.pageYOffset;
|
164
|
+
let rb = ww + sx; // view port right bound
|
165
|
+
let bb = wh + sy; // view port bottom boundnd
|
166
|
+
let aw = t._popup._elem.offsetWidth;
|
167
|
+
let ah = t._popup._elem.offsetHeight;
|
168
168
|
|
169
169
|
if (x + aw > rb) { // Do not overflow right bound
|
170
170
|
x = rb - aw;
|
@@ -196,7 +196,7 @@ PopupMenu.prototype.addPopupChild = function(element, popupMenu) {
|
|
196
196
|
PopupMenu.prototype.setMenu = function (menuItems) {
|
197
197
|
if (!menuItems || !Array.isArray(menuItems)) { return; }
|
198
198
|
|
199
|
-
|
199
|
+
let t = this;
|
200
200
|
|
201
201
|
// Clear existing before set a new items.
|
202
202
|
if (Array.isArray(t._menuItems)) {
|
@@ -205,16 +205,16 @@ PopupMenu.prototype.setMenu = function (menuItems) {
|
|
205
205
|
|
206
206
|
t._menuItems = menuItems;
|
207
207
|
|
208
|
-
for (
|
209
|
-
|
208
|
+
for (let i = 0; i < menuItems.length; i++) {
|
209
|
+
let item = menuItems[i];
|
210
210
|
|
211
|
-
|
211
|
+
let menuItem = new MenuItem(item);
|
212
212
|
menuItem.addEventListener("itemHovered", t._hoveredItem);
|
213
213
|
menuItem.addEventListener("itemClicked", t._clickedItem);
|
214
214
|
t._childrenItem.push(menuItem);
|
215
215
|
|
216
216
|
if (Array.isArray(menuItem.getItems())) {
|
217
|
-
|
217
|
+
let pm = new PopupMenu(t._parentElement);
|
218
218
|
pm._id = menuItem.getId();
|
219
219
|
pm.setMenu(menuItem.getItems());
|
220
220
|
pm.addEventListener("itemHovered", t._hoveredChildItem);
|
@@ -230,7 +230,7 @@ PopupMenu.prototype.setMenu = function (menuItems) {
|
|
230
230
|
* @param {Event} e
|
231
231
|
*/
|
232
232
|
PopupMenu.prototype._hoveredChildItem = function (e) {
|
233
|
-
|
233
|
+
let t = this;
|
234
234
|
t._dispatch("itemHovered", e);
|
235
235
|
};
|
236
236
|
|
@@ -238,7 +238,7 @@ PopupMenu.prototype._hoveredChildItem = function (e) {
|
|
238
238
|
* @param {Event} e
|
239
239
|
*/
|
240
240
|
PopupMenu.prototype._clickedChildItem = function (e) {
|
241
|
-
|
241
|
+
let t = this;
|
242
242
|
t._dispatch("itemClicked", e);
|
243
243
|
t.hide();
|
244
244
|
};
|
@@ -247,14 +247,14 @@ PopupMenu.prototype._clickedChildItem = function (e) {
|
|
247
247
|
* @param {Event} e
|
248
248
|
*/
|
249
249
|
PopupMenu.prototype._hoveredItem = function (e) {
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
250
|
+
let t = this;
|
251
|
+
let evt = t._evtArg;
|
252
|
+
let element = e.srcElement;
|
253
|
+
let children = t._children;
|
254
254
|
|
255
255
|
if (element && !!children.length) {
|
256
|
-
for (
|
257
|
-
|
256
|
+
for (let i = 0; i < children.length; i++) {
|
257
|
+
let child = children[i];
|
258
258
|
if (child._id === element.getAttribute("id")) {
|
259
259
|
child.show();
|
260
260
|
} else {
|
@@ -272,10 +272,10 @@ PopupMenu.prototype._hoveredItem = function (e) {
|
|
272
272
|
* @param {Event} e
|
273
273
|
*/
|
274
274
|
PopupMenu.prototype._clickedItem = function(e) {
|
275
|
-
|
275
|
+
let t = this;
|
276
276
|
if (e.item && e.item.id) {
|
277
|
-
for (
|
278
|
-
|
277
|
+
for (let i = 0; i < t._menuItems.length; i++) {
|
278
|
+
let menuItem = t._menuItems[i];
|
279
279
|
if (menuItem.id === e.item.id) {
|
280
280
|
t._evtArg["item"] = menuItem;
|
281
281
|
break;
|
@@ -162,13 +162,20 @@ const BlankValues = {
|
|
162
162
|
* @function
|
163
163
|
* @param {Array} ary
|
164
164
|
* @param {string} str
|
165
|
+
* @param {*=} orignalValue
|
165
166
|
* @returns {boolean} Returns true if there is any change
|
166
167
|
*/
|
167
|
-
let _pushRawValue = function(ary, str) {
|
168
|
+
let _pushRawValue = function(ary, str, orignalValue) {
|
168
169
|
if(str) {
|
169
170
|
if(!BlankValues[str]) {
|
170
171
|
let dateObj = stringToDateObject(str);
|
171
172
|
if(dateObj !== str) {
|
173
|
+
if(orignalValue && typeof orignalValue === "number") {
|
174
|
+
let originalDate = new Date(orignalValue);
|
175
|
+
if(originalDate.getTime()) {
|
176
|
+
dateObj = originalDate;
|
177
|
+
}
|
178
|
+
}
|
172
179
|
ary.push(dateObj);
|
173
180
|
} else {
|
174
181
|
try {
|
@@ -1890,7 +1897,7 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
|
|
1890
1897
|
} else if(typeof exp === "function" || typeof exp === "string" || typeof exp === "object") {
|
1891
1898
|
if(typeof exp === "object") {
|
1892
1899
|
for(let expKey in exp) {
|
1893
|
-
_pushRawValue(userInputs, expKey);
|
1900
|
+
_pushRawValue(userInputs, expKey, exp[expKey]);
|
1894
1901
|
}
|
1895
1902
|
}
|
1896
1903
|
}
|
@@ -2244,7 +2251,8 @@ RowFilteringPlugin.prototype._onDialogFilterChanged = function(e) {
|
|
2244
2251
|
|
2245
2252
|
let jLen = rawVals.length;
|
2246
2253
|
for(let j = 0; j < jLen; ++j) {
|
2247
|
-
|
2254
|
+
let rawVal = rawVals[j];
|
2255
|
+
itemMap[rawVal] = (rawVal instanceof Date) ? rawVal.getTime() : rawVal;
|
2248
2256
|
}
|
2249
2257
|
}
|
2250
2258
|
if(atLeastOne) {
|
@@ -758,6 +758,12 @@ CellPainter.prototype._getStyles = function(rowData, min, max) {
|
|
758
758
|
* @return {Array.<number>} resultColor
|
759
759
|
*/
|
760
760
|
CellPainter.blendColor = blendColor; // For backward compatability
|
761
|
+
/** @private
|
762
|
+
* @function
|
763
|
+
* @param {Array.<number>} triplet
|
764
|
+
* @return {string} resultColor
|
765
|
+
*/
|
766
|
+
CellPainter.blackAndWhite = getContrastColor; // For backward compatability
|
761
767
|
/** @public
|
762
768
|
* @function
|
763
769
|
* @param {string} rgbCode
|
@@ -3,7 +3,7 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
|
|
3
3
|
import MenuEventAPI from "./MenuEventAPI.js";
|
4
4
|
import PopupMenu from "./PopupMenu.js";
|
5
5
|
import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
|
-
import
|
6
|
+
import { rgb2Hex, num2Hex, hex2Num, blendColor, getContrastColor } from "../../tr-grid-util/es6/Color.js";
|
7
7
|
|
8
8
|
declare namespace ContextMenuPlugin {
|
9
9
|
|
@@ -32,12 +32,20 @@ declare namespace RowFilteringPlugin {
|
|
32
32
|
rawDataAccessor?: ((...params: any[]) => any)|null,
|
33
33
|
formattedDataAccessor?: ((...params: any[]) => any)|null,
|
34
34
|
sortLogic?: ((...params: any[]) => any)|null,
|
35
|
+
groupCriteria?: ((...params: any[]) => any)|null,
|
36
|
+
groupSortLogic?: ((...params: any[]) => any)|null,
|
35
37
|
itemList?: any[]|null,
|
36
38
|
additionalItems?: any[]|null,
|
37
39
|
compactMode?: boolean|null,
|
38
40
|
blankValues?: (boolean|string)|null
|
39
41
|
};
|
40
42
|
|
43
|
+
type FilterEntry = {
|
44
|
+
type?: string|null,
|
45
|
+
label: string,
|
46
|
+
checked: boolean
|
47
|
+
};
|
48
|
+
|
41
49
|
type Options = {
|
42
50
|
emptySegmentFiltering?: boolean|null,
|
43
51
|
separatorFiltering?: boolean|null,
|
package/lib/versions.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"tr-grid-util": "1.3.
|
2
|
+
"tr-grid-util": "1.3.155",
|
3
3
|
"tr-grid-printer": "1.0.18",
|
4
4
|
"@grid/column-dragging": "1.0.20",
|
5
5
|
"@grid/row-segmenting": "1.0.31",
|
@@ -16,7 +16,7 @@
|
|
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.42",
|
20
20
|
"tr-grid-filter-input": "0.9.41",
|
21
21
|
"tr-grid-heat-map": "1.0.29",
|
22
22
|
"tr-grid-in-cell-editing": "1.0.87",
|
@@ -24,7 +24,7 @@
|
|
24
24
|
"tr-grid-percent-bar": "1.0.24",
|
25
25
|
"tr-grid-range-bar": "2.0.8",
|
26
26
|
"tr-grid-row-dragging": "1.0.35",
|
27
|
-
"tr-grid-row-filtering": "1.0.
|
27
|
+
"tr-grid-row-filtering": "1.0.80",
|
28
28
|
"tr-grid-row-grouping": "1.0.88",
|
29
29
|
"tr-grid-row-selection": "1.0.30",
|
30
30
|
"tr-grid-rowcoloring": "1.0.25",
|
package/package.json
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
"description": "Grid Components Library",
|
4
4
|
"author": "Refinitiv",
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
6
|
+
"type": "module",
|
6
7
|
"main": "./lib/grid/index.js",
|
7
8
|
"module": "./lib/grid/index.js",
|
8
9
|
"types": "./lib/types/index.d.ts",
|
@@ -68,5 +69,5 @@
|
|
68
69
|
"publishConfig": {
|
69
70
|
"access": "public"
|
70
71
|
},
|
71
|
-
"version": "6.0.
|
72
|
+
"version": "6.0.113"
|
72
73
|
}
|