@refinitiv-ui/efx-grid 6.0.30 → 6.0.32
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +310 -117
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +53 -28
- package/lib/core/es6/grid/ILayoutGrid.js +3 -3
- package/lib/core/es6/grid/LayoutGrid.js +67 -23
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +92 -55
- package/lib/core/es6/grid/components/Scrollbar.js +19 -1
- package/lib/core/es6/grid/util/SelectionList.d.ts +6 -2
- package/lib/core/es6/grid/util/SelectionList.js +76 -7
- package/lib/filter-dialog/lib/filter-dialog.js +11 -8
- package/lib/filter-dialog/themes/base.less +7 -3
- package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
- package/lib/grid/index.js +1 -1
- package/lib/statistics-row/es6/StatisticsRow.d.ts +25 -25
- package/lib/statistics-row/es6/StatisticsRow.js +9 -4
- package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +2 -0
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +14 -0
- package/lib/tr-grid-content-wrap/es6/ContentWrap.d.ts +4 -4
- package/lib/tr-grid-content-wrap/es6/ContentWrap.js +116 -70
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +23 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +339 -40
- package/lib/tr-grid-util/es6/DragUI.d.ts +2 -0
- package/lib/tr-grid-util/es6/DragUI.js +39 -9
- package/lib/tr-grid-util/es6/Popup.d.ts +3 -1
- package/lib/tr-grid-util/es6/Popup.js +57 -23
- package/lib/types/es6/ContentWrap.d.ts +4 -4
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +4 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +1 -0
- package/lib/versions.json +6 -6
- package/package.json +1 -1
@@ -17,7 +17,7 @@ import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
|
|
17
17
|
var ContentWrapPlugin = function ContentWrapPlugin() {
|
18
18
|
this._onColumnAdded = this._onColumnAdded.bind(this);
|
19
19
|
this._onRecalculation = this._onRecalculation.bind(this);
|
20
|
-
this.
|
20
|
+
this._requestRecalculation = this._requestRecalculation.bind(this);
|
21
21
|
this._hosts = [];
|
22
22
|
};
|
23
23
|
|
@@ -77,10 +77,10 @@ ContentWrapPlugin.prototype.initialize = function (host, options) {
|
|
77
77
|
|
78
78
|
this._hosts.push(host);
|
79
79
|
|
80
|
-
window.addEventListener("load", this.
|
80
|
+
window.addEventListener("load", this._requestRecalculation); // Since CSS can impact font, we need adjust accordingly
|
81
81
|
|
82
|
-
host.listen("widthChanged", this.
|
83
|
-
host.listen("postSectionDataBinding", this.
|
82
|
+
host.listen("widthChanged", this._requestRecalculation);
|
83
|
+
host.listen("postSectionDataBinding", this._requestRecalculation); // In case of lazy loading
|
84
84
|
|
85
85
|
this.config(options);
|
86
86
|
host.listen("columnAdded", this._onColumnAdded);
|
@@ -99,11 +99,13 @@ ContentWrapPlugin.prototype.unload = function (host) {
|
|
99
99
|
|
100
100
|
this._hosts.splice(at, 1);
|
101
101
|
|
102
|
-
window.removeEventListener("load", this.
|
103
|
-
host.unlisten("widthChanged", this.
|
104
|
-
host.unlisten("postSectionDataBinding", this.
|
102
|
+
window.removeEventListener("load", this._requestRecalculation);
|
103
|
+
host.unlisten("widthChanged", this._requestRecalculation);
|
104
|
+
host.unlisten("postSectionDataBinding", this._requestRecalculation);
|
105
105
|
host.unlisten("columnAdded", this._onColumnAdded);
|
106
106
|
|
107
|
+
this._dispose();
|
108
|
+
|
107
109
|
this._clearTimer();
|
108
110
|
};
|
109
111
|
/** @public
|
@@ -182,7 +184,7 @@ ContentWrapPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
182
184
|
|
183
185
|
|
184
186
|
ContentWrapPlugin.prototype.adjustRowHeight = function (sectionRef, from, to) {
|
185
|
-
if (this._adjusting || this._hosts.length
|
187
|
+
if (this._adjusting || !this._hosts.length) {
|
186
188
|
return false; // Quite if grid has not been registered or in the process of adjusting row height
|
187
189
|
}
|
188
190
|
|
@@ -198,17 +200,30 @@ ContentWrapPlugin.prototype.adjustRowHeight = function (sectionRef, from, to) {
|
|
198
200
|
return false;
|
199
201
|
}
|
200
202
|
|
203
|
+
var sectionElem = section.getElement();
|
204
|
+
|
205
|
+
if (!sectionElem || !sectionElem.offsetParent) {
|
206
|
+
return false;
|
207
|
+
}
|
208
|
+
|
201
209
|
this._adjusting = true; // Prevent infinite loop
|
202
210
|
|
203
211
|
var dirtyRows = []; // Collect dirty rows
|
204
212
|
|
205
|
-
var
|
213
|
+
var maxHeight = NaN;
|
214
|
+
var heights = null;
|
206
215
|
|
216
|
+
if (this._evenRowHeight) {
|
217
|
+
maxHeight = this._calcMaxRowHeight(section, dirtyRows, from, to);
|
218
|
+
} else {
|
219
|
+
heights = this._calcRowHeights(section, dirtyRows, from, to);
|
220
|
+
} // Setting row height for multiple rows can cause performance issue
|
207
221
|
|
208
|
-
|
222
|
+
|
223
|
+
var dirtyCount = dirtyRows.length;
|
209
224
|
var prevFState = false;
|
210
225
|
|
211
|
-
if (
|
226
|
+
if (dirtyCount > this._freezingThreshold) {
|
212
227
|
if (section.getFrozenLayout) {
|
213
228
|
prevFState = section.getFrozenLayout();
|
214
229
|
section.setFrozenLayout(true);
|
@@ -219,29 +234,25 @@ ContentWrapPlugin.prototype.adjustRowHeight = function (sectionRef, from, to) {
|
|
219
234
|
var r, rowIndex;
|
220
235
|
|
221
236
|
if (this._evenRowHeight) {
|
222
|
-
|
223
|
-
|
224
|
-
for (r = 0; r < rowCount; ++r) {
|
237
|
+
for (r = 0; r < dirtyCount; ++r) {
|
225
238
|
rowIndex = dirtyRows[r];
|
226
|
-
section.setRowHeight(rowIndex,
|
239
|
+
section.setRowHeight(rowIndex, maxHeight);
|
227
240
|
}
|
228
241
|
} else {
|
229
|
-
|
230
|
-
|
231
|
-
for (r = 0; r < rowCount; ++r) {
|
242
|
+
for (r = 0; r < dirtyCount; ++r) {
|
232
243
|
rowIndex = dirtyRows[r];
|
233
244
|
section.setRowHeight(rowIndex, heights[rowIndex]);
|
234
245
|
}
|
235
246
|
}
|
236
247
|
|
237
|
-
if (
|
248
|
+
if (dirtyCount > this._freezingThreshold) {
|
238
249
|
if (section.setFrozenLayout) {
|
239
250
|
section.setFrozenLayout(prevFState);
|
240
251
|
}
|
241
252
|
}
|
242
253
|
|
243
254
|
this._adjusting = false;
|
244
|
-
return
|
255
|
+
return dirtyCount ? true : false;
|
245
256
|
};
|
246
257
|
/** @public
|
247
258
|
* @param {Object} sectionRef core grid SectionReference object
|
@@ -300,8 +311,8 @@ ContentWrapPlugin.prototype._setColumnContentWrapping = function (colIndex, colu
|
|
300
311
|
/** @private */
|
301
312
|
|
302
313
|
|
303
|
-
ContentWrapPlugin.prototype.
|
304
|
-
if (!this._recalTimer) {
|
314
|
+
ContentWrapPlugin.prototype._requestRecalculation = function () {
|
315
|
+
if (!this._recalTimer && !this._adjusting) {
|
305
316
|
this._recalTimer = setTimeout(this._onRecalculation, 100);
|
306
317
|
}
|
307
318
|
};
|
@@ -328,7 +339,7 @@ ContentWrapPlugin.prototype._clearTimer = function () {
|
|
328
339
|
|
329
340
|
|
330
341
|
ContentWrapPlugin.prototype._getSteppingHeight = function (height) {
|
331
|
-
return Math.
|
342
|
+
return Math.ceil(height) + 14; // Add top and bottom padding
|
332
343
|
};
|
333
344
|
/** @private
|
334
345
|
* @param {Object} section ILayoutGrid
|
@@ -343,25 +354,31 @@ ContentWrapPlugin.prototype._calculateRowHeightAt = function (section, rowIndex)
|
|
343
354
|
var colCount = section.getColumnCount();
|
344
355
|
|
345
356
|
for (var c = 0; c < colCount; ++c) {
|
346
|
-
if (this.isWrappingContent(c)) {
|
347
|
-
|
357
|
+
if (!this.isWrappingContent(c)) {
|
358
|
+
continue;
|
359
|
+
}
|
348
360
|
|
349
|
-
|
350
|
-
var cellContent = cell.getContent();
|
361
|
+
var cell = section.getCell(c, rowIndex, false); // TODO: Handle cell spanning
|
351
362
|
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
return NaN;
|
356
|
-
}
|
363
|
+
if (!cell || !cell.isVisible()) {
|
364
|
+
continue;
|
365
|
+
}
|
357
366
|
|
358
|
-
|
367
|
+
var cellContent = cell.getContent();
|
359
368
|
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
369
|
+
if (!cellContent) {
|
370
|
+
continue;
|
371
|
+
}
|
372
|
+
|
373
|
+
if (!cellContent.offsetParent) {
|
374
|
+
// Cell content is not in the document, so the height cannot be calculated
|
375
|
+
continue;
|
376
|
+
}
|
377
|
+
|
378
|
+
var contentHeight = this._getSteppingHeight(cellContent.offsetHeight);
|
379
|
+
|
380
|
+
if (contentHeight > maxHeight) {
|
381
|
+
maxHeight = contentHeight;
|
365
382
|
}
|
366
383
|
}
|
367
384
|
|
@@ -369,61 +386,90 @@ ContentWrapPlugin.prototype._calculateRowHeightAt = function (section, rowIndex)
|
|
369
386
|
};
|
370
387
|
/** @private
|
371
388
|
* @param {Object} section ILayoutGrid
|
389
|
+
* @param {!Array.<number>} dirtyRows
|
372
390
|
* @param {number=} from
|
373
391
|
* @param {number=} to
|
374
|
-
* @
|
375
|
-
* @return {!Object}
|
392
|
+
* @return {number}
|
376
393
|
*/
|
377
394
|
|
378
395
|
|
379
|
-
ContentWrapPlugin.prototype.
|
380
|
-
if (
|
396
|
+
ContentWrapPlugin.prototype._calcMaxRowHeight = function (section, dirtyRows, from, to) {
|
397
|
+
if (from == null) {
|
398
|
+
from = section.getFirstIndexInView();
|
399
|
+
} else if (!from || from < 0) {
|
381
400
|
from = 0;
|
382
401
|
}
|
383
402
|
|
384
|
-
|
403
|
+
if (to == null) {
|
404
|
+
to = section.getLastIndexInView() + 1;
|
405
|
+
} else {
|
406
|
+
var rowCount = section.getRowCount();
|
385
407
|
|
386
|
-
|
387
|
-
|
408
|
+
if (!to || to > rowCount) {
|
409
|
+
to = rowCount;
|
410
|
+
}
|
388
411
|
}
|
389
412
|
|
390
|
-
var r
|
391
|
-
var
|
413
|
+
var r;
|
414
|
+
var max = 0;
|
392
415
|
|
393
|
-
|
394
|
-
var
|
395
|
-
|
396
|
-
for (r = from; r < to; ++r) {
|
397
|
-
h = this._calculateRowHeightAt(section, r);
|
416
|
+
for (r = from; r < to; ++r) {
|
417
|
+
var h = this._calculateRowHeightAt(section, r);
|
398
418
|
|
399
|
-
|
400
|
-
|
401
|
-
}
|
419
|
+
if (max < h) {
|
420
|
+
max = h;
|
402
421
|
}
|
422
|
+
}
|
403
423
|
|
404
|
-
|
405
|
-
|
424
|
+
if (max) {
|
406
425
|
for (r = from; r < to; ++r) {
|
407
|
-
if (max
|
408
|
-
|
426
|
+
if (max !== section.getRowHeight(r)) {
|
427
|
+
dirtyRows.push(r);
|
409
428
|
}
|
410
429
|
}
|
411
|
-
}
|
412
|
-
var heights = new Array(to);
|
430
|
+
}
|
413
431
|
|
414
|
-
|
415
|
-
|
416
|
-
|
432
|
+
return max;
|
433
|
+
};
|
434
|
+
/** @private
|
435
|
+
* @param {Object} section ILayoutGrid
|
436
|
+
* @param {!Array.<number>} dirtyRows
|
437
|
+
* @param {number=} from
|
438
|
+
* @param {number=} to
|
439
|
+
* @return {!Array.<number>}
|
440
|
+
*/
|
417
441
|
|
418
|
-
|
419
|
-
|
420
|
-
|
442
|
+
|
443
|
+
ContentWrapPlugin.prototype._calcRowHeights = function (section, dirtyRows, from, to) {
|
444
|
+
if (from == null) {
|
445
|
+
from = section.getFirstIndexInView();
|
446
|
+
} else if (!from || from < 0) {
|
447
|
+
from = 0;
|
448
|
+
}
|
449
|
+
|
450
|
+
if (to == null) {
|
451
|
+
to = section.getLastIndexInView() + 1;
|
452
|
+
} else {
|
453
|
+
var rowCount = section.getRowCount();
|
454
|
+
|
455
|
+
if (!to || to > rowCount) {
|
456
|
+
to = rowCount;
|
421
457
|
}
|
458
|
+
}
|
459
|
+
|
460
|
+
var heights = new Array(to);
|
422
461
|
|
423
|
-
|
462
|
+
for (var r = from; r < to; ++r) {
|
463
|
+
var h = this._calculateRowHeightAt(section, r);
|
464
|
+
|
465
|
+
heights[r] = h;
|
466
|
+
|
467
|
+
if (h && h !== section.getRowHeight(r)) {
|
468
|
+
dirtyRows.push(r);
|
469
|
+
}
|
424
470
|
}
|
425
471
|
|
426
|
-
return
|
472
|
+
return heights;
|
427
473
|
};
|
428
474
|
/** @private
|
429
475
|
* @param {number} colIndex
|
@@ -434,7 +480,7 @@ ContentWrapPlugin.prototype._calculateRowHeight = function (section, from, to, o
|
|
434
480
|
ContentWrapPlugin.prototype._wrapContent = function (colIndex, bool) {
|
435
481
|
this._hosts[0].enableColumnClass(colIndex, "wrap", bool, "content");
|
436
482
|
|
437
|
-
this.
|
483
|
+
this._requestRecalculation();
|
438
484
|
};
|
439
485
|
/** @public
|
440
486
|
* @param {number} colIndex
|
@@ -39,7 +39,7 @@ declare class RowDraggingPlugin extends GridPlugin {
|
|
39
39
|
|
40
40
|
public getConfigObject(out_obj?: any): any;
|
41
41
|
|
42
|
-
public startDrag(startRef
|
42
|
+
public startDrag(startRef?: any): void;
|
43
43
|
|
44
44
|
public stopDrag(): void;
|
45
45
|
|
@@ -53,6 +53,28 @@ declare class RowDraggingPlugin extends GridPlugin {
|
|
53
53
|
|
54
54
|
public disableUIs(disabled?: boolean|null): void;
|
55
55
|
|
56
|
+
public allowDrag(allowed?: boolean|null): void;
|
57
|
+
|
58
|
+
public allowDrop(allowed?: boolean|null): void;
|
59
|
+
|
60
|
+
public setDragContent(content: any): void;
|
61
|
+
|
62
|
+
public getDragBox(): Element|null;
|
63
|
+
|
64
|
+
public getDragSource(): string;
|
65
|
+
|
66
|
+
public isDragging(): boolean;
|
67
|
+
|
68
|
+
public disableDragging(disabled?: boolean|null): void;
|
69
|
+
|
70
|
+
public enableJETDragAndDrop(enabled?: boolean|null): void;
|
71
|
+
|
72
|
+
public getJETDragContent(): any;
|
73
|
+
|
74
|
+
public setJETDragContent(content: any): void;
|
75
|
+
|
76
|
+
public setJETDragContent(content: any): void;
|
77
|
+
|
56
78
|
}
|
57
79
|
|
58
80
|
export default RowDraggingPlugin;
|