@refinitiv-ui/efx-grid 6.0.37 → 6.0.39
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +165 -20
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.d.ts +2 -0
- package/lib/core/es6/grid/Core.js +62 -5
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +3 -0
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +41 -7
- package/lib/core/es6/grid/util/TrackLayout.d.ts +3 -1
- package/lib/core/es6/grid/util/TrackLayout.js +23 -5
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +158 -48
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +4 -3
- package/lib/rt-grid/es6/Grid.d.ts +1 -1
- package/lib/rt-grid/es6/Grid.js +63 -29
- package/lib/rt-grid/es6/RowDefinition.js +6 -6
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +180 -421
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -0
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +221 -2
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +7 -1
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +281 -69
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +83 -3
- package/lib/tr-grid-row-selection/es6/RowSelection.js +18 -40
- package/lib/tr-grid-util/es6/GridPlugin.js +91 -42
- package/lib/types/es6/ColumnGrouping.d.ts +4 -0
- package/lib/types/es6/ColumnStack.d.ts +7 -1
- package/lib/types/es6/Core/grid/Core.d.ts +2 -0
- package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +3 -1
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +1 -1
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -2
- package/lib/versions.json +6 -6
- package/package.json +1 -1
@@ -359,6 +359,8 @@ declare class Core extends ElementWrapper {
|
|
359
359
|
|
360
360
|
public synchronizeVScrollbar(subGrid: Core|null): void;
|
361
361
|
|
362
|
+
public synchronizeHScrollbar(subGrid: Core|null): void;
|
363
|
+
|
362
364
|
public updateRowData(sectionRef?: Core.SectionReference|null, fromRowIndex?: number|null, lastRowIndex?: number|null, userParam?: any): void;
|
363
365
|
|
364
366
|
public rerender(): void;
|
@@ -91,6 +91,7 @@ var Core = function (opt_initializer) {
|
|
91
91
|
_t._onVScroll = _t._onVScroll.bind(_t);
|
92
92
|
_t._onHScroll = _t._onHScroll.bind(_t);
|
93
93
|
_t._onSyncVScroll = _t._onSyncVScroll.bind(_t);
|
94
|
+
_t._onSyncHScroll = _t._onSyncHScroll.bind(_t);
|
94
95
|
_t.updateLayout = _t.updateLayout.bind(_t);
|
95
96
|
_t._onRowRefresh = _t._onRowRefresh.bind(_t);
|
96
97
|
_t._onVScrollEnabled = _t._onVScrollEnabled.bind(_t);
|
@@ -203,7 +204,8 @@ var Core = function (opt_initializer) {
|
|
203
204
|
"rowPositionChanged",
|
204
205
|
"beforeColumnBoundUpdate",
|
205
206
|
"beforeBatchOperation",
|
206
|
-
"afterBatchOperation"
|
207
|
+
"afterBatchOperation",
|
208
|
+
"pinningChanged"
|
207
209
|
);
|
208
210
|
|
209
211
|
// For debugging in advanced optimization mode
|
@@ -552,7 +554,7 @@ Core.prototype._batches = null;
|
|
552
554
|
* @return {string}
|
553
555
|
*/
|
554
556
|
Core.getVersion = function () {
|
555
|
-
return "5.1.
|
557
|
+
return "5.1.55";
|
556
558
|
};
|
557
559
|
/** {@link ElementWrapper#dispose}
|
558
560
|
* @override
|
@@ -594,6 +596,12 @@ Core.prototype.dispose = function () {
|
|
594
596
|
mainScrolbar.unlisten("scroll", this._onSyncVScroll);
|
595
597
|
this._vscrollbar._mainScrollbar = null;
|
596
598
|
}
|
599
|
+
mainScrolbar = this._hscrollbar._mainScrollbar;
|
600
|
+
if(mainScrolbar) {
|
601
|
+
mainScrolbar.unlisten("scroll", this._onSyncHScroll);
|
602
|
+
this._hscrollbar._mainScrollbar = null;
|
603
|
+
}
|
604
|
+
|
597
605
|
this._vscrollbar.dispose();
|
598
606
|
this._hscrollbar.dispose();
|
599
607
|
this._rowHeightConflator.dispose();
|
@@ -2907,10 +2915,14 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
|
|
2907
2915
|
var colCount = this.getColumnCount();
|
2908
2916
|
var leftPinnedCount = 0;
|
2909
2917
|
var rightPinnedCount = 0;
|
2918
|
+
var dirty = false;
|
2910
2919
|
if (frozenColIndex || frozenColIndex === 0) {
|
2911
2920
|
this._hScrollbarEnabled = true;
|
2912
2921
|
leftPinnedCount = (frozenColIndex >= 0) ? frozenColIndex + 1 : 0;
|
2913
|
-
this._pinnedLeftColumnCount
|
2922
|
+
if (this._pinnedLeftColumnCount !== leftPinnedCount) {
|
2923
|
+
dirty = true;
|
2924
|
+
this._pinnedLeftColumnCount = leftPinnedCount; // This variable is used for caching
|
2925
|
+
}
|
2914
2926
|
|
2915
2927
|
for (i = 0; i < colCount; ++i) {
|
2916
2928
|
colDef = this._getColumnDef(i);
|
@@ -2921,7 +2933,10 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
|
|
2921
2933
|
}
|
2922
2934
|
if(numRightColumn != null) {
|
2923
2935
|
rightPinnedCount = numRightColumn > 0 ? numRightColumn : 0;
|
2924
|
-
this._pinnedRightColumnCount
|
2936
|
+
if (this._pinnedRightColumnCount !== rightPinnedCount) {
|
2937
|
+
dirty = true;
|
2938
|
+
this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
|
2939
|
+
}
|
2925
2940
|
|
2926
2941
|
for (i = colCount; --i >= 0;) {
|
2927
2942
|
colDef = this._getColumnDef(i);
|
@@ -2932,6 +2947,12 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
|
|
2932
2947
|
this._onColumnCountChanged(); // Activate horizontal scrollbar and column virtualization
|
2933
2948
|
this._updateScrollbarWidth(true, true);
|
2934
2949
|
this._updateColumnSeparators();
|
2950
|
+
|
2951
|
+
if (dirty) {
|
2952
|
+
if (!this._isEventDispatching("pinningChanged")) {
|
2953
|
+
this._dispatch("pinningChanged", {});
|
2954
|
+
}
|
2955
|
+
}
|
2935
2956
|
};
|
2936
2957
|
|
2937
2958
|
/** @private
|
@@ -3756,6 +3777,26 @@ Core.prototype.synchronizeVScrollbar = function (subGrid) {
|
|
3756
3777
|
this._vscrollbar.listen("scroll", subGrid._onSyncVScroll);
|
3757
3778
|
};
|
3758
3779
|
|
3780
|
+
/** Synchronize two horizontal scrollbars of two grid, by hiding its scrollbar and using the one from the given grid
|
3781
|
+
* @public
|
3782
|
+
* @param {Core} subGrid
|
3783
|
+
*/
|
3784
|
+
Core.prototype.synchronizeHScrollbar = function (subGrid) {
|
3785
|
+
subGrid.unlisten("mousemove", subGrid._onMouseMove);
|
3786
|
+
subGrid.listen("mousemove", this._onMouseMove);
|
3787
|
+
|
3788
|
+
var hscrollbar = subGrid.getHScrollbar();
|
3789
|
+
hscrollbar._mainScrollbar = this._hscrollbar; // HACK
|
3790
|
+
|
3791
|
+
hscrollbar.setStyle("visibility", "hidden");
|
3792
|
+
hscrollbar.setStyle("pointerEvents", "none");
|
3793
|
+
hscrollbar.disableMouseWheel(); // Disable sub-grid wheel behavior
|
3794
|
+
hscrollbar.attachToExternalElement(this._hscrollbar.getParent()); // MouseWheel event is still available on the main
|
3795
|
+
|
3796
|
+
// TODO: Check if we need to re-append this._hscrollbar to move it to the front over other grid elements.
|
3797
|
+
this._hscrollbar.listen("scroll", subGrid._onSyncHScroll);
|
3798
|
+
};
|
3799
|
+
|
3759
3800
|
/** Fires data binding event without actual change in the data source. <br>
|
3760
3801
|
* This will force visual elements to be re-rendered with the latest data in the data source.
|
3761
3802
|
* @public
|
@@ -3898,7 +3939,7 @@ Core.prototype.getHorizontalLayout = function () {
|
|
3898
3939
|
* @ignore
|
3899
3940
|
* @param {number} colIndex
|
3900
3941
|
* @param {boolean} bool
|
3901
|
-
* @param {number} flag
|
3942
|
+
* @param {number} flag
|
3902
3943
|
* @return {boolean}
|
3903
3944
|
*/
|
3904
3945
|
Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
|
@@ -3918,6 +3959,16 @@ Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
|
|
3918
3959
|
}
|
3919
3960
|
return false;
|
3920
3961
|
};
|
3962
|
+
/** Get visibility state for the specified flag. This is for internal use only
|
3963
|
+
* @public
|
3964
|
+
* @ignore
|
3965
|
+
* @param {number} colIndex
|
3966
|
+
* @param {number=} flag
|
3967
|
+
* @return {boolean}
|
3968
|
+
*/
|
3969
|
+
Core.prototype.getColumnVisibility = function (colIndex, flag) {
|
3970
|
+
return this._layoutX.getLaneVisibilityBit(colIndex, flag);
|
3971
|
+
};
|
3921
3972
|
|
3922
3973
|
/** @public
|
3923
3974
|
* @param {number} size
|
@@ -5411,6 +5462,12 @@ Core.prototype._onSyncVScroll = function (e) {
|
|
5411
5462
|
this._vscrollbar.setScrollTop(e.scrollTop);
|
5412
5463
|
};
|
5413
5464
|
/** @private
|
5465
|
+
* @param {Object} e
|
5466
|
+
*/
|
5467
|
+
Core.prototype._onSyncHScroll = function (e) {
|
5468
|
+
this._hscrollbar.setScrollLeft(e.scrollLeft);
|
5469
|
+
};
|
5470
|
+
/** @private
|
5414
5471
|
* @return {number} index of footer section
|
5415
5472
|
*/
|
5416
5473
|
Core.prototype._getFooterStartIndex = function () {
|
@@ -12,6 +12,7 @@ declare namespace SortableTitlePlugin {
|
|
12
12
|
|
13
13
|
type InitialSort = {
|
14
14
|
colIndex: number,
|
15
|
+
field: string,
|
15
16
|
sortOrder?: SortableTitlePlugin.SortOrder|null,
|
16
17
|
order?: SortableTitlePlugin.SortOrder|null
|
17
18
|
};
|
@@ -19,6 +20,8 @@ declare namespace SortableTitlePlugin {
|
|
19
20
|
type ColumnOptions = {
|
20
21
|
sortable?: boolean|null,
|
21
22
|
sortBy?: string|null,
|
23
|
+
sort?: string|null,
|
24
|
+
sortOrder?: string|null,
|
22
25
|
sortLogic?: DataTable.SortLogic|null,
|
23
26
|
sortingLogic?: DataTable.SortLogic|null,
|
24
27
|
sorter?: DataTable.SortLogic|null,
|
@@ -82,6 +82,7 @@ Ext.inherits(SortableTitlePlugin, EventDispatcher);
|
|
82
82
|
/** The sorting object which will be used for initialSort config.
|
83
83
|
* @typedef {Object} SortableTitlePlugin~InitialSort
|
84
84
|
* @property {number} colIndex Index of the column
|
85
|
+
* @property {string} field field of the column
|
85
86
|
* @property {SortableTitlePlugin~SortOrder=} sortOrder=null Set to "d" for descending order and "a" for ascending order
|
86
87
|
* @property {SortableTitlePlugin~SortOrder=} order Alias of sortOrder
|
87
88
|
*/
|
@@ -91,6 +92,8 @@ SortableTitlePlugin.InitialSort;
|
|
91
92
|
* @typedef {Object} SortableTitlePlugin~ColumnOptions
|
92
93
|
* @property {boolean=} sortable=false If enable, the column can be sorted by user click
|
93
94
|
* @property {string=} sortBy Field to be used for sorting. If defined, user can click at the header section to sort the column
|
95
|
+
* @property {string=} sort="" Deprecated Alias to `sortOrder`
|
96
|
+
* @property {string=} sortOrder="" The column can be sorted in ascending and descending order by specifying the order "a", "d". This option will sort the column when it is initialized or inserted at runtime.
|
94
97
|
* @property {DataTable.SortLogic=} sortLogic=null Custom compare function for sorting
|
95
98
|
* @property {DataTable.SortLogic=} sortingLogic Alias to `sortLogic`
|
96
99
|
* @property {DataTable.SortLogic=} sorter Alias to `sortLogic`
|
@@ -295,7 +298,7 @@ SortableTitlePlugin.prototype.afterInit = function () {
|
|
295
298
|
// Set logic to the data source, since the data source not available during the initialization
|
296
299
|
t.setSortLogics(t._sortLogic);
|
297
300
|
|
298
|
-
var userInput = t._initialSort;
|
301
|
+
var userInput = t._initialSort; // This will be passed from the user when they want to start with initialize sort
|
299
302
|
if (userInput != null) {
|
300
303
|
if(Array.isArray(userInput)) {
|
301
304
|
if(t._maxCount === 1) { // TODO: max count could be part of sortColumns method
|
@@ -444,14 +447,32 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
|
|
444
447
|
|
445
448
|
if (!host) return obj;
|
446
449
|
|
447
|
-
var
|
448
|
-
var col,
|
449
|
-
|
450
|
+
var sortedColumns = this.getSortedColumns();
|
451
|
+
var col, i, len;
|
452
|
+
// Multiple column sorting cannot retain the sort order in the column option.
|
453
|
+
if(this._maxCount === 1 && sortedColumns != null) {
|
454
|
+
// assign sorting state to each columns
|
455
|
+
len = sortedColumns.length;
|
456
|
+
for (i = 0; i < len; i++) {
|
457
|
+
var sortedColumn = sortedColumns[i];
|
458
|
+
var colIndex = sortedColumn["colIndex"];
|
459
|
+
col = columns[colIndex];
|
460
|
+
if (!col) {
|
461
|
+
col = columns[colIndex] = {};
|
462
|
+
}
|
463
|
+
col["sortOrder"] = sortedColumn["sortOrder"];
|
464
|
+
}
|
465
|
+
}
|
466
|
+
|
467
|
+
len = host.getColumnCount();
|
468
|
+
var opt, field;
|
469
|
+
for(i = 0; i < len; ++i) {
|
450
470
|
col = columns[i];
|
451
471
|
if (!col) {
|
452
472
|
col = columns[i] = {};
|
453
473
|
}
|
454
474
|
|
475
|
+
// TODO: We should get the state from the core, instead of getting the sort options.
|
455
476
|
opt = this._getSortOptions(i);
|
456
477
|
|
457
478
|
if (!opt) { continue; }
|
@@ -465,7 +486,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
|
|
465
486
|
}
|
466
487
|
field = opt["field"];
|
467
488
|
if (field) {
|
468
|
-
if(col["field"] !== field) {
|
489
|
+
if(col["field"] != null && col["field"] !== field) { // Core does not have field properties, so when you try to call getConfigObject in Core, it will return sortBy too.
|
469
490
|
col["sortBy"] = field;
|
470
491
|
} // else The default value is an empty sortBy, which refers to the same column field by default.
|
471
492
|
|
@@ -481,7 +502,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
|
|
481
502
|
extOptions = obj["sorting"] = {};
|
482
503
|
}
|
483
504
|
|
484
|
-
var val =
|
505
|
+
var val = sortedColumns;
|
485
506
|
if(val != null) {
|
486
507
|
extOptions["initialSort"] = val;
|
487
508
|
}
|
@@ -988,7 +1009,14 @@ SortableTitlePlugin.prototype.disableTwoStateSorting = function (disabled) {
|
|
988
1009
|
* @param {boolean=} bool=true, if set to false it will be unfreeze indicator
|
989
1010
|
*/
|
990
1011
|
SortableTitlePlugin.prototype.freezeIndicator = function (bool) {
|
1012
|
+
var prevState = this._frozenIndicator;
|
991
1013
|
this._frozenIndicator = bool !== false;
|
1014
|
+
if(prevState && !this._frozenIndicator) { // from frozen to unfrozen, update the ui
|
1015
|
+
for (var i = this._hosts.length; --i >= 0;) {
|
1016
|
+
this._updateSortableIndicator(i);
|
1017
|
+
}
|
1018
|
+
}
|
1019
|
+
|
992
1020
|
};
|
993
1021
|
/** @public
|
994
1022
|
* @param {boolean=} disabled
|
@@ -1064,7 +1092,7 @@ SortableTitlePlugin.prototype._initialSortByColumnField = function (options) {
|
|
1064
1092
|
var colCount = columns ? columns.length : 0;
|
1065
1093
|
for (var i = 0; i < colCount; i++) {
|
1066
1094
|
var column = columns[i];
|
1067
|
-
var sortOrder = column["defaultSort"]
|
1095
|
+
var sortOrder = column["defaultSort"]; // composite and rt grid option for default sort order
|
1068
1096
|
if (sortOrder) {
|
1069
1097
|
// TODO: Support multi-column sorting
|
1070
1098
|
return {
|
@@ -1494,6 +1522,12 @@ SortableTitlePlugin.prototype._onColumnAdded = function (e) {
|
|
1494
1522
|
} else {
|
1495
1523
|
t.disableColumnSorting(colIndex, true);
|
1496
1524
|
}
|
1525
|
+
|
1526
|
+
var sortOrder = column["sortOrder"] || column["sort"];
|
1527
|
+
if(sortOrder != null) {
|
1528
|
+
t.clearSortState(); // clear previous sorting state
|
1529
|
+
t.sortColumn(colIndex, sortOrder);
|
1530
|
+
}
|
1497
1531
|
};
|
1498
1532
|
|
1499
1533
|
/** @private
|
@@ -60,7 +60,9 @@ declare class TrackLayout {
|
|
60
60
|
|
61
61
|
public showLane(index: number, opt_val?: boolean|null): boolean;
|
62
62
|
|
63
|
-
public hideLane(index: number,
|
63
|
+
public hideLane(index: number, hidden?: boolean|null, bitIndex?: number|null): boolean;
|
64
|
+
|
65
|
+
public getLaneVisibilityBit(index: number, bitIndex?: number|null): boolean;
|
64
66
|
|
65
67
|
public show(opt_shown?: boolean|null): void;
|
66
68
|
|
@@ -477,18 +477,18 @@ TrackLayout.prototype.showLane = function (index, opt_val) {
|
|
477
477
|
};
|
478
478
|
/** @public
|
479
479
|
* @param {number} index
|
480
|
-
* @param {boolean=}
|
481
|
-
* @param {number=}
|
480
|
+
* @param {boolean=} hidden
|
481
|
+
* @param {number=} bitIndex
|
482
482
|
* @return {boolean}
|
483
483
|
*/
|
484
|
-
TrackLayout.prototype.hideLane = function (index,
|
484
|
+
TrackLayout.prototype.hideLane = function (index, hidden, bitIndex) {
|
485
485
|
if (index < 0 || index >= this._laneCount) { return false; }
|
486
486
|
|
487
487
|
var col = this._newColumn(index);
|
488
488
|
var prevVis = !col.invisibility;
|
489
489
|
|
490
|
-
var bit = (
|
491
|
-
if(
|
490
|
+
var bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
|
491
|
+
if(hidden !== false) {
|
492
492
|
col.invisibility |= bit; // Add invisibility bit
|
493
493
|
} else {
|
494
494
|
col.invisibility &= ~bit; // Remove invisibility bit
|
@@ -499,6 +499,24 @@ TrackLayout.prototype.hideLane = function (index, opt_hidden, opt_bitIndex) {
|
|
499
499
|
}
|
500
500
|
return false;
|
501
501
|
};
|
502
|
+
/** Return true if the lane does not exist nor is not hidden. Return false only if the lane is hidden by the specified bit
|
503
|
+
* @public
|
504
|
+
* @param {number} index
|
505
|
+
* @param {number=} bitIndex
|
506
|
+
* @return {boolean}
|
507
|
+
*/
|
508
|
+
TrackLayout.prototype.getLaneVisibilityBit = function (index, bitIndex) {
|
509
|
+
if (index >= 0 && index < this._laneCount) {
|
510
|
+
var col = this._cols[index];
|
511
|
+
if(col) {
|
512
|
+
var bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
|
513
|
+
if(col.invisibility & bit) {
|
514
|
+
return false;
|
515
|
+
}
|
516
|
+
}
|
517
|
+
}
|
518
|
+
return true;
|
519
|
+
};
|
502
520
|
/** @public
|
503
521
|
* @param {boolean=} opt_shown
|
504
522
|
*/
|
package/lib/grid/index.js
CHANGED