@refinitiv-ui/efx-grid 6.0.101 → 6.0.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/dist/core.js +289 -532
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataCache.d.ts +0 -12
- package/lib/core/es6/data/DataCache.js +11 -371
- package/lib/core/es6/data/WrappedView.d.ts +1 -0
- package/lib/core/es6/data/WrappedView.js +1 -0
- package/lib/core/es6/grid/Core.js +1 -1
- package/lib/core/es6/grid/LayoutGrid.d.ts +1 -0
- package/lib/core/es6/grid/LayoutGrid.js +25 -2
- package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +1 -0
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +24 -104
- package/lib/core/es6/grid/util/CellBoundPainter.d.ts +16 -0
- package/lib/core/es6/grid/util/CellBoundPainter.js +171 -0
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +9 -0
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/RowDefinition.js +9 -0
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +22 -8
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +8 -0
- package/lib/types/es6/Core/grid/LayoutGrid.d.ts +1 -0
- package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +1 -0
- package/lib/types/es6/Core/grid/util/CellBoundPainter.d.ts +16 -0
- package/lib/versions.json +2 -2
- package/package.json +1 -1
@@ -7,24 +7,10 @@ import ILayoutGrid from "./ILayoutGrid.js";
|
|
7
7
|
import LayoutGrid from "./LayoutGrid.js";
|
8
8
|
import ElementWrapper from "./components/ElementWrapper.js";
|
9
9
|
import HScrollbar from "./components/HScrollbar.js";
|
10
|
+
import CellBoundPainter from "./util/CellBoundPainter.js";
|
10
11
|
/* eslint-enable */
|
11
12
|
|
12
13
|
|
13
|
-
/** @private
|
14
|
-
* @function
|
15
|
-
* @param {number} idx
|
16
|
-
* @param {number} limit
|
17
|
-
* @return {number}
|
18
|
-
*/
|
19
|
-
let _validateIndex = function(idx, limit) {
|
20
|
-
if(idx > limit) {
|
21
|
-
return limit;
|
22
|
-
} else if(idx < 0) {
|
23
|
-
return 0;
|
24
|
-
}
|
25
|
-
return idx;
|
26
|
-
};
|
27
|
-
|
28
14
|
/** @constructor
|
29
15
|
* @ignore
|
30
16
|
* @param {Object=} options
|
@@ -109,26 +95,10 @@ VirtualizedLayoutGrid.prototype._rowBoundCache = null;
|
|
109
95
|
* @private
|
110
96
|
*/
|
111
97
|
VirtualizedLayoutGrid.prototype._rowSelDirty = false;
|
112
|
-
/** @type {
|
113
|
-
* @private
|
114
|
-
*/
|
115
|
-
VirtualizedLayoutGrid.prototype._cellBound = null;
|
116
|
-
/** @type {number}
|
98
|
+
/** @type {Object}
|
117
99
|
* @private
|
118
100
|
*/
|
119
|
-
VirtualizedLayoutGrid.prototype.
|
120
|
-
/** @type {number}
|
121
|
-
* @private
|
122
|
-
*/
|
123
|
-
VirtualizedLayoutGrid.prototype._cbRgtIdx = 0;
|
124
|
-
/** @type {number}
|
125
|
-
* @private
|
126
|
-
*/
|
127
|
-
VirtualizedLayoutGrid.prototype._cbTopIdx = 0;
|
128
|
-
/** @type {number}
|
129
|
-
* @private
|
130
|
-
*/
|
131
|
-
VirtualizedLayoutGrid.prototype._cbBtmIdx = 0;
|
101
|
+
VirtualizedLayoutGrid.prototype._cellBoundPainter = null;
|
132
102
|
/** @type {number}
|
133
103
|
* @private
|
134
104
|
*/
|
@@ -181,6 +151,9 @@ VirtualizedLayoutGrid.prototype.dispose = function () {
|
|
181
151
|
clearTimeout(this._rowBoundTimer);
|
182
152
|
this._rowBoundTimer = 0;
|
183
153
|
}
|
154
|
+
if(this._cellBoundPainter) {
|
155
|
+
this._cellBoundPainter.dispose();
|
156
|
+
}
|
184
157
|
};
|
185
158
|
/** @override */
|
186
159
|
VirtualizedLayoutGrid.prototype.setWidth = function (px) {
|
@@ -1008,26 +981,20 @@ VirtualizedLayoutGrid.prototype.selectCell = function (colIndex, rowIndex, selec
|
|
1008
981
|
* @param {number} height
|
1009
982
|
*/
|
1010
983
|
VirtualizedLayoutGrid.prototype.setCellBounds = function (colIndex, rowIndex, width, height) {
|
1011
|
-
let
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
984
|
+
let boundLayer = this._initBoundLayer();
|
985
|
+
let cellBoundPainter = this._cellBoundPainter;
|
986
|
+
if(!cellBoundPainter) {
|
987
|
+
cellBoundPainter = this._cellBoundPainter = new CellBoundPainter({
|
988
|
+
boundLayer: boundLayer,
|
989
|
+
layoutX: this.getHorizontalLayout(),
|
990
|
+
layoutY: this._layoutY,
|
991
|
+
hscrollbar: this._hscrollbar,
|
992
|
+
calculateColumnBounds: this.calculateColumnBounds.bind(this)
|
993
|
+
});
|
1015
994
|
}
|
1016
|
-
this._initBoundLayer();
|
1017
|
-
|
1018
|
-
// Validate inputs
|
1019
|
-
let rgtIndex = colIndex + width; // Exclusive
|
1020
|
-
let btmIndex = rowIndex + height; // Exclusive
|
1021
995
|
|
1022
996
|
let colCount = this.getColumnCount();
|
1023
|
-
|
1024
|
-
|
1025
|
-
this._cbLftIdx = _validateIndex(colIndex, colCount);
|
1026
|
-
this._cbRgtIdx = _validateIndex(rgtIndex, colCount);
|
1027
|
-
this._cbTopIdx = _validateIndex(rowIndex, rowCount);
|
1028
|
-
this._cbBtmIdx = _validateIndex(btmIndex, rowCount);
|
1029
|
-
|
1030
|
-
this._updateCellBounds();
|
997
|
+
cellBoundPainter.setCellBounds(colIndex, rowIndex, width, height, colCount);
|
1031
998
|
};
|
1032
999
|
/** @public
|
1033
1000
|
* @ignore
|
@@ -1046,59 +1013,6 @@ VirtualizedLayoutGrid.prototype.getHorizontalLayout = function () {
|
|
1046
1013
|
VirtualizedLayoutGrid.prototype.calculateColumnBounds = function (lftIdx, rgtIdx, outPositions, outNoBorders) {
|
1047
1014
|
this._grid.calculateColumnBounds(lftIdx, rgtIdx, outPositions, outNoBorders);
|
1048
1015
|
};
|
1049
|
-
/** @private
|
1050
|
-
*/
|
1051
|
-
VirtualizedLayoutGrid.prototype._updateCellBounds = function () {
|
1052
|
-
let cellBound = this._cellBound;
|
1053
|
-
if(!cellBound) {
|
1054
|
-
return;
|
1055
|
-
}
|
1056
|
-
|
1057
|
-
let layoutX = this.getHorizontalLayout();
|
1058
|
-
let layoutY = this._layoutY;
|
1059
|
-
let lftIdx = this._cbLftIdx;
|
1060
|
-
let rgtIdx = this._cbRgtIdx; // Exclusive
|
1061
|
-
let topIdx = this._cbTopIdx;
|
1062
|
-
let btmIdx = this._cbBtmIdx; // Exclusive
|
1063
|
-
let lftPx, rgtPx, topPx, btmPx;
|
1064
|
-
lftPx = rgtPx = topPx = btmPx = 0;
|
1065
|
-
if(lftIdx < rgtIdx && topIdx < btmIdx) {
|
1066
|
-
lftPx = layoutX.getLaneStart(lftIdx);
|
1067
|
-
rgtPx = layoutX.getLaneEnd(rgtIdx - 1);
|
1068
|
-
topPx = layoutY.getLaneStart(topIdx);
|
1069
|
-
btmPx = layoutY.getLaneEnd(btmIdx - 1);
|
1070
|
-
}
|
1071
|
-
|
1072
|
-
let width = rgtPx - lftPx;
|
1073
|
-
let height = btmPx - topPx;
|
1074
|
-
let noBorders = [false, false];
|
1075
|
-
if(width > 0 && height > 0 && this._hscrollbar) {
|
1076
|
-
let positions = [0, 0];
|
1077
|
-
this.calculateColumnBounds(lftIdx, rgtIdx - 1, positions, noBorders);
|
1078
|
-
lftPx = positions[0];
|
1079
|
-
rgtPx = positions[1];
|
1080
|
-
width = rgtPx - lftPx;
|
1081
|
-
}
|
1082
|
-
|
1083
|
-
if(width > 0) {
|
1084
|
-
cellBound.style.left = lftPx + "px";
|
1085
|
-
cellBound.style.top = topPx + "px";
|
1086
|
-
cellBound.style.width = width + "px";
|
1087
|
-
cellBound.style.height = height + "px";
|
1088
|
-
|
1089
|
-
cellBound.classList.toggle("no-left-bound", noBorders[0]);
|
1090
|
-
cellBound.classList.toggle("no-right-bound", noBorders[1]);
|
1091
|
-
|
1092
|
-
if(this._boundLayer) {
|
1093
|
-
this._boundLayer.appendChild(cellBound);
|
1094
|
-
}
|
1095
|
-
} else {
|
1096
|
-
let pn = cellBound.parentNode;
|
1097
|
-
if(pn) {
|
1098
|
-
pn.removeChild(cellBound);
|
1099
|
-
}
|
1100
|
-
}
|
1101
|
-
};
|
1102
1016
|
/** @public
|
1103
1017
|
* @ignore
|
1104
1018
|
* @param {!Array.<Array>} posAry Left and right bound positions in pixel
|
@@ -1116,6 +1030,7 @@ VirtualizedLayoutGrid.prototype.updateColumnSeparators = function () {
|
|
1116
1030
|
this._grid.updateColumnSeparators();
|
1117
1031
|
};
|
1118
1032
|
/** @private
|
1033
|
+
* @return {Element}
|
1119
1034
|
*/
|
1120
1035
|
VirtualizedLayoutGrid.prototype._initBoundLayer = function () {
|
1121
1036
|
let boundLayer = this._boundLayer;
|
@@ -1124,6 +1039,7 @@ VirtualizedLayoutGrid.prototype._initBoundLayer = function () {
|
|
1124
1039
|
boundLayer.className = "cover-layer";
|
1125
1040
|
this._element.appendChild(boundLayer);
|
1126
1041
|
}
|
1042
|
+
return boundLayer;
|
1127
1043
|
};
|
1128
1044
|
/** @private
|
1129
1045
|
*/
|
@@ -1136,7 +1052,11 @@ VirtualizedLayoutGrid.prototype._requestUpdatingRowBounds = function () {
|
|
1136
1052
|
*/
|
1137
1053
|
VirtualizedLayoutGrid.prototype._updateRowBounds = function () {
|
1138
1054
|
this._rowBoundTimer = 0;
|
1139
|
-
|
1055
|
+
|
1056
|
+
let cellBoundPainter = this._cellBoundPainter;
|
1057
|
+
if(cellBoundPainter) {
|
1058
|
+
cellBoundPainter.updateCellBounds();
|
1059
|
+
}
|
1140
1060
|
|
1141
1061
|
if(!this._rowSelDirty) {
|
1142
1062
|
return;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
declare class CellBoundPainter {
|
4
|
+
|
5
|
+
constructor(ctx: any);
|
6
|
+
|
7
|
+
public dispose(): void;
|
8
|
+
|
9
|
+
public setCellBounds(colIndex: number, rowIndex: number, width: number, height: number, colCount: number): void;
|
10
|
+
|
11
|
+
public updateCellBounds(): void;
|
12
|
+
|
13
|
+
}
|
14
|
+
|
15
|
+
export default CellBoundPainter;
|
16
|
+
export { CellBoundPainter };
|
@@ -0,0 +1,171 @@
|
|
1
|
+
/** @private
|
2
|
+
* @function
|
3
|
+
* @param {number} idx
|
4
|
+
* @param {number} limit
|
5
|
+
* @return {number}
|
6
|
+
*/
|
7
|
+
let _validateIndex = function(idx, limit) {
|
8
|
+
if(idx > limit) {
|
9
|
+
return limit;
|
10
|
+
} else if(idx < 0) {
|
11
|
+
return 0;
|
12
|
+
}
|
13
|
+
return idx;
|
14
|
+
};
|
15
|
+
|
16
|
+
/** @constructor
|
17
|
+
* @param {Object} ctx
|
18
|
+
*/
|
19
|
+
let CellBoundPainter = function (ctx) {
|
20
|
+
this._boundLayer = ctx.boundLayer;
|
21
|
+
this._layoutX = ctx.layoutX;
|
22
|
+
this._layoutY = ctx.layoutY;
|
23
|
+
this._hscrollbar = ctx.hscrollbar;
|
24
|
+
this._calculateColumnBounds = ctx.calculateColumnBounds;
|
25
|
+
};
|
26
|
+
|
27
|
+
/** @type {Element}
|
28
|
+
* @private
|
29
|
+
*/
|
30
|
+
CellBoundPainter.prototype._boundLayer = null;
|
31
|
+
/** @type {!TrackLayout}
|
32
|
+
* @private
|
33
|
+
*/
|
34
|
+
CellBoundPainter.prototype._layoutX;
|
35
|
+
/** @type {!TrackLayout}
|
36
|
+
* @private
|
37
|
+
*/
|
38
|
+
CellBoundPainter.prototype._layoutY;
|
39
|
+
/** @type {HScrollbar}
|
40
|
+
* @private
|
41
|
+
*/
|
42
|
+
CellBoundPainter.prototype._hscrollbar;
|
43
|
+
/** @type {Function}
|
44
|
+
* @private
|
45
|
+
*/
|
46
|
+
CellBoundPainter.prototype._calculateColumnBounds;
|
47
|
+
/** @type {Element}
|
48
|
+
* @private
|
49
|
+
*/
|
50
|
+
CellBoundPainter.prototype._cellBound = null;
|
51
|
+
/** @type {number}
|
52
|
+
* @private
|
53
|
+
*/
|
54
|
+
CellBoundPainter.prototype._cbLftIdx = 0;
|
55
|
+
/** @type {number}
|
56
|
+
* @private
|
57
|
+
*/
|
58
|
+
CellBoundPainter.prototype._cbRgtIdx = 0;
|
59
|
+
/** @type {number}
|
60
|
+
* @private
|
61
|
+
*/
|
62
|
+
CellBoundPainter.prototype._cbTopIdx = 0;
|
63
|
+
/** @type {number}
|
64
|
+
* @private
|
65
|
+
*/
|
66
|
+
CellBoundPainter.prototype._cbBtmIdx = 0;
|
67
|
+
|
68
|
+
/** @public
|
69
|
+
*/
|
70
|
+
CellBoundPainter.prototype.dispose = function () {
|
71
|
+
let cellBound = this._cellBound;
|
72
|
+
if(cellBound) {
|
73
|
+
let pn = cellBound.parentNode;
|
74
|
+
if(pn) {
|
75
|
+
pn.removeChild(cellBound);
|
76
|
+
}
|
77
|
+
this._cellBound = null;
|
78
|
+
}
|
79
|
+
this._boundLayer = null;
|
80
|
+
this._layoutX = null;
|
81
|
+
this._layoutY = null;
|
82
|
+
this._hscrollbar = null;
|
83
|
+
this._calculateColumnBounds = null;
|
84
|
+
};
|
85
|
+
|
86
|
+
/** @public
|
87
|
+
* @param {number} colIndex
|
88
|
+
* @param {number} rowIndex
|
89
|
+
* @param {number} width
|
90
|
+
* @param {number} height
|
91
|
+
* @param {number} colCount
|
92
|
+
*/
|
93
|
+
CellBoundPainter.prototype.setCellBounds = function (colIndex, rowIndex, width, height, colCount) {
|
94
|
+
let cellBound = this._cellBound;
|
95
|
+
if(!cellBound) {
|
96
|
+
cellBound = this._cellBound = document.createElement("div");
|
97
|
+
cellBound.className = "selection-bound";
|
98
|
+
}
|
99
|
+
|
100
|
+
// Validate inputs
|
101
|
+
let rgtIndex = colIndex + width; // Exclusive
|
102
|
+
let btmIndex = rowIndex + height; // Exclusive
|
103
|
+
|
104
|
+
let rowCount = this._layoutY.getLaneCount();
|
105
|
+
|
106
|
+
this._cbLftIdx = _validateIndex(colIndex, colCount);
|
107
|
+
this._cbRgtIdx = _validateIndex(rgtIndex, colCount);
|
108
|
+
this._cbTopIdx = _validateIndex(rowIndex, rowCount);
|
109
|
+
this._cbBtmIdx = _validateIndex(btmIndex, rowCount);
|
110
|
+
|
111
|
+
this.updateCellBounds();
|
112
|
+
};
|
113
|
+
|
114
|
+
/** @public
|
115
|
+
*/
|
116
|
+
CellBoundPainter.prototype.updateCellBounds = function() {
|
117
|
+
let cellBound = this._cellBound;
|
118
|
+
if(!cellBound) {
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
|
122
|
+
let layoutX = this._layoutX;
|
123
|
+
let layoutY = this._layoutY;
|
124
|
+
let lftIdx = this._cbLftIdx;
|
125
|
+
let rgtIdx = this._cbRgtIdx; // Exclusive
|
126
|
+
let topIdx = this._cbTopIdx;
|
127
|
+
let btmIdx = this._cbBtmIdx; // Exclusive
|
128
|
+
let lftPx, rgtPx, topPx, btmPx;
|
129
|
+
lftPx = rgtPx = topPx = btmPx = 0;
|
130
|
+
if(lftIdx < rgtIdx && topIdx < btmIdx) {
|
131
|
+
lftPx = layoutX.getLaneStart(lftIdx);
|
132
|
+
rgtPx = layoutX.getLaneEnd(rgtIdx - 1);
|
133
|
+
topPx = layoutY.getLaneStart(topIdx);
|
134
|
+
btmPx = layoutY.getLaneEnd(btmIdx - 1);
|
135
|
+
}
|
136
|
+
|
137
|
+
let width = rgtPx - lftPx;
|
138
|
+
let height = btmPx - topPx;
|
139
|
+
let noBorders = [false, false];
|
140
|
+
if(width > 0 && height > 0 && this._hscrollbar) {
|
141
|
+
let positions = [0, 0];
|
142
|
+
this._calculateColumnBounds(lftIdx, rgtIdx - 1, positions, noBorders);
|
143
|
+
lftPx = positions[0];
|
144
|
+
rgtPx = positions[1];
|
145
|
+
width = rgtPx - lftPx;
|
146
|
+
}
|
147
|
+
|
148
|
+
if(width > 0) {
|
149
|
+
cellBound.style.left = lftPx + "px";
|
150
|
+
cellBound.style.top = topPx + "px";
|
151
|
+
cellBound.style.width = width + "px";
|
152
|
+
cellBound.style.height = height + "px";
|
153
|
+
|
154
|
+
cellBound.classList.toggle("no-left-bound", noBorders[0]);
|
155
|
+
cellBound.classList.toggle("no-right-bound", noBorders[1]);
|
156
|
+
|
157
|
+
if(this._boundLayer) {
|
158
|
+
this._boundLayer.appendChild(cellBound);
|
159
|
+
}
|
160
|
+
} else {
|
161
|
+
let pn = cellBound.parentNode;
|
162
|
+
if(pn) {
|
163
|
+
pn.removeChild(cellBound);
|
164
|
+
}
|
165
|
+
}
|
166
|
+
};
|
167
|
+
|
168
|
+
CellBoundPainter._proto = CellBoundPainter.prototype;
|
169
|
+
|
170
|
+
export default CellBoundPainter;
|
171
|
+
export { CellBoundPainter };
|
package/lib/grid/index.js
CHANGED
@@ -14372,6 +14372,11 @@ RowDefinition.prototype._toRealTimeRow = function() {
|
|
14372
14372
|
this._parent = null;
|
14373
14373
|
this._depthLevel = 0;
|
14374
14374
|
|
14375
|
+
// Add static value to the new allocated row
|
14376
|
+
if(this._staticValues) {
|
14377
|
+
this.setRowData(this._staticValues);
|
14378
|
+
}
|
14379
|
+
|
14375
14380
|
this.subscribeForUpdates();
|
14376
14381
|
};
|
14377
14382
|
|
@@ -14390,8 +14395,12 @@ RowDefinition.prototype.unlinkChain = function() {
|
|
14390
14395
|
}
|
14391
14396
|
}
|
14392
14397
|
|
14398
|
+
let staticData = this._getStaticRowData();
|
14393
14399
|
this.unsubscribeForUpdates();
|
14394
14400
|
|
14401
|
+
// Restore static data
|
14402
|
+
this.setStaticRowData(staticData);
|
14403
|
+
|
14395
14404
|
let view = this._view;
|
14396
14405
|
if(view) {
|
14397
14406
|
let rid = this.getRowId();
|