@refinitiv-ui/efx-grid 6.0.91 → 6.0.92
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-dragging/es6/ColumnDragging.d.ts +1 -1
- package/lib/column-dragging/es6/ColumnDragging.js +144 -34
- package/lib/core/dist/core.js +2410 -2621
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.js +14 -14
- package/lib/core/es6/data/DataCache.js +118 -118
- package/lib/core/es6/data/DataTable.d.ts +3 -1
- package/lib/core/es6/data/DataTable.js +208 -190
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +291 -291
- package/lib/core/es6/data/Segment.js +79 -79
- package/lib/core/es6/data/SegmentCollection.js +81 -81
- package/lib/core/es6/data/WrappedView.js +41 -41
- package/lib/core/es6/grid/Core.js +635 -635
- package/lib/core/es6/grid/ILayoutGrid.js +1 -1
- package/lib/core/es6/grid/LayoutGrid.js +183 -183
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +91 -91
- package/lib/core/es6/grid/components/Cell.js +29 -29
- package/lib/core/es6/grid/components/CellFloatingPanel.js +11 -11
- package/lib/core/es6/grid/components/CellSpan.js +7 -7
- package/lib/core/es6/grid/components/CellSpans.js +36 -34
- package/lib/core/es6/grid/components/Column.js +40 -40
- package/lib/core/es6/grid/components/ElementWrapper.js +17 -17
- package/lib/core/es6/grid/components/HScrollbar.js +31 -31
- package/lib/core/es6/grid/components/Scrollbar.js +77 -77
- package/lib/core/es6/grid/components/StretchedCells.js +49 -49
- package/lib/core/es6/grid/components/VScrollbar.js +11 -11
- package/lib/core/es6/grid/components/VirtualItems.js +3 -3
- package/lib/core/es6/grid/event/EventDispatcher.js +9 -9
- package/lib/core/es6/grid/event/EventListeners.js +4 -4
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +186 -186
- package/lib/core/es6/grid/util/Conflator.js +4 -4
- package/lib/core/es6/grid/util/Reverter.js +1 -1
- package/lib/core/es6/grid/util/SectionSettings.js +20 -20
- package/lib/core/es6/grid/util/SelectionList.js +23 -23
- package/lib/core/es6/grid/util/TrackLayout.js +74 -74
- package/lib/core/es6/grid/util/Virtualizer.js +15 -15
- package/lib/core/es6/grid/util/util.js +20 -20
- package/lib/core/es6/index.d.ts +0 -2
- package/lib/core/es6/index.js +0 -3
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +193 -70
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +46 -30
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -1
- package/lib/rt-grid/es6/RowDefinition.js +74 -16
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +56 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +29 -1
- package/lib/tr-grid-util/es6/CellPainter.js +94 -93
- package/lib/tr-grid-util/es6/Conflator.js +4 -4
- package/lib/tr-grid-util/es6/CoralItems.js +6 -6
- package/lib/tr-grid-util/es6/DateTime.js +39 -39
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.js +1 -1
- package/lib/tr-grid-util/es6/Dom.js +26 -26
- package/lib/tr-grid-util/es6/DragUI.js +17 -17
- package/lib/tr-grid-util/es6/ElementObserver.js +12 -12
- package/lib/tr-grid-util/es6/ElementWrapper.js +2 -2
- package/lib/tr-grid-util/es6/ElfDate.js +4 -4
- package/lib/tr-grid-util/es6/ElfUtil.js +37 -37
- package/lib/tr-grid-util/es6/EventDispatcher.js +12 -12
- package/lib/tr-grid-util/es6/ExpanderIcon.js +6 -6
- package/lib/tr-grid-util/es6/ExpressionParser.js +43 -43
- package/lib/tr-grid-util/es6/Ext.js +6 -6
- package/lib/tr-grid-util/es6/FieldFormatter.js +17 -17
- package/lib/tr-grid-util/es6/FilterBuilder.js +57 -57
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +12 -1
- package/lib/tr-grid-util/es6/FilterOperators.js +13 -2
- package/lib/tr-grid-util/es6/GridPlugin.js +86 -86
- package/lib/tr-grid-util/es6/GroupDefinitions.js +90 -90
- package/lib/tr-grid-util/es6/Icon.js +4 -4
- package/lib/tr-grid-util/es6/MouseDownTrait.js +6 -6
- package/lib/tr-grid-util/es6/MultiTableManager.js +68 -68
- package/lib/tr-grid-util/es6/NumberFormatter.js +22 -22
- package/lib/tr-grid-util/es6/PercentBar.js +17 -17
- package/lib/tr-grid-util/es6/Perf.js +5 -5
- package/lib/tr-grid-util/es6/Popup.js +42 -42
- package/lib/tr-grid-util/es6/RangeBar.js +5 -5
- package/lib/tr-grid-util/es6/RequestQueue.js +5 -5
- package/lib/tr-grid-util/es6/RowPainter.js +23 -23
- package/lib/tr-grid-util/es6/SubTable.js +94 -94
- package/lib/tr-grid-util/es6/Table.js +51 -51
- package/lib/tr-grid-util/es6/TextHighlighter.js +49 -49
- package/lib/tr-grid-util/es6/TickCodes.js +2 -2
- package/lib/tr-grid-util/es6/Timer.js +2 -2
- package/lib/tr-grid-util/es6/TouchProxy.js +7 -7
- package/lib/tr-grid-util/es6/Util.js +50 -50
- package/lib/tr-grid-util/es6/formula/ADCService.js +2 -2
- package/lib/tr-grid-util/es6/formula/ADCSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/AdFinService.js +2 -2
- package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/Engine.js +56 -56
- package/lib/tr-grid-util/es6/formula/Formula.js +62 -62
- package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +3 -3
- package/lib/tr-grid-util/es6/formula/Realtime.js +15 -15
- package/lib/tr-grid-util/es6/formula/RealtimeService.js +15 -15
- package/lib/tr-grid-util/es6/formula/TSIService.js +2 -2
- package/lib/tr-grid-util/es6/formula/TSISubscription.js +104 -104
- package/lib/tr-grid-util/es6/formula/VariableToken.js +20 -20
- package/lib/tr-grid-util/es6/formula/functions/AdFin.js +10 -10
- package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
- package/lib/tr-grid-util/es6/formula/functions/Info.js +2 -2
- package/lib/tr-grid-util/es6/formula/functions/Internal.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Logic.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Math.js +46 -46
- package/lib/tr-grid-util/es6/formula/functions/Statistics.js +27 -27
- package/lib/tr-grid-util/es6/formula/functions/Text.js +19 -19
- package/lib/tr-grid-util/es6/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/Adc.js +36 -36
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +11 -11
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +95 -95
- package/lib/tr-grid-util/es6/jet/DataSet.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockArchive.js +5 -5
- package/lib/tr-grid-util/es6/jet/MockJET.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockQuotes.js +13 -13
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +100 -100
- package/lib/tr-grid-util/es6/jet/MockRTK.js +4 -4
- package/lib/tr-grid-util/es6/jet/MockUtil.js +2 -2
- package/lib/tr-grid-util/es6/jet/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.js +15 -15
- package/lib/tr-grid-util/es6/locale/translation-de.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-en.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-ja.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation.js +1 -1
- package/lib/types/es6/ColumnDragging.d.ts +1 -1
- package/lib/types/es6/ColumnGrouping.d.ts +3 -1
- package/lib/types/es6/Core/data/DataTable.d.ts +4 -0
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
- package/lib/types/es6/Core/index.d.ts +0 -2
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -1
- package/lib/versions.json +4 -4
- package/package.json +1 -1
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/core/es6/grid/util/ElementFrameWork.js +0 -227
- package/lib/core/es6/grid/util/HttpRequest.d.ts +0 -53
- package/lib/core/es6/grid/util/HttpRequest.js +0 -371
- package/lib/core/es6/grid/util/PercentBar.d.ts +0 -43
- package/lib/core/es6/grid/util/PercentBar.js +0 -390
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/core/es6/grid/util/PercentBarRenderer.js +0 -316
- package/lib/core/es6/grid/util/RangeBar.d.ts +0 -25
- package/lib/core/es6/grid/util/RangeBar.js +0 -255
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +0 -53
- package/lib/types/es6/Core/grid/util/PercentBar.d.ts +0 -43
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +0 -25
@@ -10,7 +10,7 @@ import Cell from "./Cell.js";
|
|
10
10
|
* @param {TrackLayout} trackY
|
11
11
|
* @param {number} rowIndex
|
12
12
|
*/
|
13
|
-
|
13
|
+
let _updateYAxis = function (cell, trackY, rowIndex) {
|
14
14
|
cell.setTop(trackY.getLaneStart(rowIndex));
|
15
15
|
cell.setHeight(trackY.getLaneSize(rowIndex));
|
16
16
|
};
|
@@ -21,9 +21,9 @@ var _updateYAxis = function (cell, trackY, rowIndex) {
|
|
21
21
|
* @param {number} colIndex
|
22
22
|
* @param {number} width
|
23
23
|
*/
|
24
|
-
|
24
|
+
let _updateXAxis = function (cell, trackX, colIndex, width) {
|
25
25
|
if(colIndex) {
|
26
|
-
|
26
|
+
let leftStart = trackX.getLaneStart(colIndex);
|
27
27
|
cell.setLeft(leftStart);
|
28
28
|
cell.setWidth(width - leftStart);
|
29
29
|
} else {
|
@@ -39,7 +39,7 @@ var _updateXAxis = function (cell, trackX, colIndex, width) {
|
|
39
39
|
* @param {!TrackLayout} trackY
|
40
40
|
* @param {!ILayoutGrid} section
|
41
41
|
*/
|
42
|
-
|
42
|
+
let StretchedCells = function (trackX, trackY, section) {
|
43
43
|
this._trackX = trackX;
|
44
44
|
this._trackY = trackY;
|
45
45
|
this._section = section;
|
@@ -73,11 +73,11 @@ StretchedCells.prototype._stretchSize = 0;
|
|
73
73
|
/** @public
|
74
74
|
*/
|
75
75
|
StretchedCells.prototype.dispose = function () {
|
76
|
-
|
76
|
+
let cells = this._cells;
|
77
77
|
if(this._activeCount) {
|
78
78
|
this._activeCount = 0;
|
79
|
-
for(
|
80
|
-
|
79
|
+
for(let i = cells.length; --i >= 0;) {
|
80
|
+
let cell = cells[i];
|
81
81
|
if(cell) {
|
82
82
|
cell.dispose();
|
83
83
|
}
|
@@ -106,8 +106,8 @@ StretchedCells.prototype.getStretchSize = function() {
|
|
106
106
|
* @param {number} count
|
107
107
|
*/
|
108
108
|
StretchedCells.prototype.setCellCount = function (count) {
|
109
|
-
|
110
|
-
|
109
|
+
let cells = this._cells;
|
110
|
+
let len = cells.length;
|
111
111
|
if(len < count) {
|
112
112
|
cells.length = count;
|
113
113
|
while(len < count) {
|
@@ -115,7 +115,7 @@ StretchedCells.prototype.setCellCount = function (count) {
|
|
115
115
|
}
|
116
116
|
} else if(len > count) {
|
117
117
|
while(--len >= count) {
|
118
|
-
|
118
|
+
let cell = cells[len];
|
119
119
|
if(cell) {
|
120
120
|
cell.dispose();
|
121
121
|
}
|
@@ -129,7 +129,7 @@ StretchedCells.prototype.setCellCount = function (count) {
|
|
129
129
|
* @return {Cell}
|
130
130
|
*/
|
131
131
|
StretchedCells.prototype.getCell = function (rowIndex) {
|
132
|
-
|
132
|
+
let cell = this._cells[rowIndex];
|
133
133
|
if(cell && cell["getParent"]()) {
|
134
134
|
return cell;
|
135
135
|
}
|
@@ -140,12 +140,12 @@ StretchedCells.prototype.getCell = function (rowIndex) {
|
|
140
140
|
* @return {Array.<Cell>}
|
141
141
|
*/
|
142
142
|
StretchedCells.prototype.getCells = function () {
|
143
|
-
|
143
|
+
let outAry = [];
|
144
144
|
if(this._activeCount) {
|
145
|
-
|
146
|
-
|
147
|
-
for(
|
148
|
-
|
145
|
+
let cells = this._cells;
|
146
|
+
let rowCount = cells.length;
|
147
|
+
for(let r = 0; r < rowCount; ++r) {
|
148
|
+
let cell = cells[r];
|
149
149
|
if(cell && cell.getParent()) {
|
150
150
|
outAry.push(cell);
|
151
151
|
}
|
@@ -162,7 +162,7 @@ StretchedCells.prototype.getCells = function () {
|
|
162
162
|
StretchedCells.prototype.getColumnIndex = function (cellRef) {
|
163
163
|
if(cellRef) {
|
164
164
|
if(cellRef["getElement"]) {
|
165
|
-
|
165
|
+
let cellElement = cellRef["getElement"]();
|
166
166
|
if(cellElement) {
|
167
167
|
return cellElement._colIndex != null ? cellElement._colIndex : -1;
|
168
168
|
}
|
@@ -182,10 +182,10 @@ StretchedCells.prototype.getRowIndex = function (cellRef) {
|
|
182
182
|
if(cellRef["getElement"]) {
|
183
183
|
return cellRef["getParent"]() ? this._cells.indexOf(cellRef) : -1;
|
184
184
|
} else {
|
185
|
-
|
186
|
-
|
187
|
-
for(
|
188
|
-
|
185
|
+
let cells = this._cells;
|
186
|
+
let rowCount = cells.length;
|
187
|
+
for(let r = 0; r < rowCount; ++r) {
|
188
|
+
let cell = cells[r];
|
189
189
|
if(cell && cell["getParent"]() && cell["getElement"]() === cellRef) {
|
190
190
|
return r;
|
191
191
|
}
|
@@ -208,14 +208,14 @@ StretchedCells.prototype.stretchCell = function (rowIndex, colIndex) {
|
|
208
208
|
colIndex = 0;
|
209
209
|
}
|
210
210
|
|
211
|
-
|
211
|
+
let cell = this._cells[rowIndex] || null;
|
212
212
|
if(!cell) {
|
213
213
|
cell = new Cell(null, this._section);
|
214
214
|
cell.addClass("tr-stretched");
|
215
215
|
cell["stretched"] = true;
|
216
216
|
this._cells[rowIndex] = cell;
|
217
217
|
}
|
218
|
-
|
218
|
+
let cellElem = cell["getElement"]();
|
219
219
|
cellElem["stretched"] = true;
|
220
220
|
if(cellElem._colIndex !== colIndex) {
|
221
221
|
cellElem._colIndex = colIndex;
|
@@ -229,7 +229,7 @@ StretchedCells.prototype.stretchCell = function (rowIndex, colIndex) {
|
|
229
229
|
cellElem._rowIndex = rowIndex;
|
230
230
|
}
|
231
231
|
|
232
|
-
|
232
|
+
let width = this._stretchSize || this._trackX.getTrackSize();
|
233
233
|
_updateXAxis(cell, this._trackX, colIndex, width);
|
234
234
|
_updateYAxis(cell, this._trackY, rowIndex);
|
235
235
|
|
@@ -241,7 +241,7 @@ StretchedCells.prototype.stretchCell = function (rowIndex, colIndex) {
|
|
241
241
|
* @return {Cell}
|
242
242
|
*/
|
243
243
|
StretchedCells.prototype.unstretchCell = function(rowIndex) {
|
244
|
-
|
244
|
+
let cell = this._cells[rowIndex] || null;
|
245
245
|
if(cell) {
|
246
246
|
cell.setParent(null);
|
247
247
|
}
|
@@ -252,9 +252,9 @@ StretchedCells.prototype.unstretchCell = function(rowIndex) {
|
|
252
252
|
StretchedCells.prototype.unstretchAllCells = function () {
|
253
253
|
if(this._activeCount) {
|
254
254
|
this._activeCount = 0;
|
255
|
-
|
256
|
-
for(
|
257
|
-
|
255
|
+
let cells = this._cells;
|
256
|
+
for(let i = cells.length; --i >= 0;) {
|
257
|
+
let cell = cells[i];
|
258
258
|
if(cell) {
|
259
259
|
cell.setParent(null);
|
260
260
|
}
|
@@ -268,14 +268,14 @@ StretchedCells.prototype.unstretchAllCells = function () {
|
|
268
268
|
*/
|
269
269
|
StretchedCells.prototype.updateCells = function() {
|
270
270
|
if(this._activeCount) {
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
for(
|
278
|
-
|
271
|
+
let activeCount = 0;
|
272
|
+
let cells = this._cells;
|
273
|
+
let rowCount = cells.length;
|
274
|
+
let trackX = this._trackX;
|
275
|
+
let trackY = this._trackY;
|
276
|
+
let width = this._stretchSize || trackX.getTrackSize();
|
277
|
+
for(let r = 0; r < rowCount; ++r) {
|
278
|
+
let cell = cells[r];
|
279
279
|
if(cell && cell.getParent()) {
|
280
280
|
++activeCount;
|
281
281
|
_updateXAxis(cell, trackX, cell.getElement()._colIndex, width);
|
@@ -291,13 +291,13 @@ StretchedCells.prototype.updateCells = function() {
|
|
291
291
|
*/
|
292
292
|
StretchedCells.prototype.updateXAxis = function() {
|
293
293
|
if(this._activeCount) {
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
for(
|
300
|
-
|
294
|
+
let activeCount = 0;
|
295
|
+
let cells = this._cells;
|
296
|
+
let rowCount = cells.length;
|
297
|
+
let trackX = this._trackX;
|
298
|
+
let width = this._stretchSize || trackX.getTrackSize();
|
299
|
+
for(let r = 0; r < rowCount; ++r) {
|
300
|
+
let cell = cells[r];
|
301
301
|
if(cell && cell.getParent()) {
|
302
302
|
++activeCount;
|
303
303
|
_updateXAxis(cell, trackX, cell.getElement()._colIndex, width);
|
@@ -312,12 +312,12 @@ StretchedCells.prototype.updateXAxis = function() {
|
|
312
312
|
*/
|
313
313
|
StretchedCells.prototype.updateYAxis = function () {
|
314
314
|
if(this._activeCount) {
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
for(
|
320
|
-
|
315
|
+
let activeCount = 0;
|
316
|
+
let cells = this._cells;
|
317
|
+
let rowCount = cells.length;
|
318
|
+
let trackY = this._trackY;
|
319
|
+
for(let r = 0; r < rowCount; ++r) {
|
320
|
+
let cell = cells[r];
|
321
321
|
if(cell && cell.getParent()) {
|
322
322
|
++activeCount;
|
323
323
|
_updateYAxis(cell, trackY, r);
|
@@ -7,8 +7,8 @@ import Scrollbar from "./Scrollbar.js";
|
|
7
7
|
/** @constructor
|
8
8
|
* @extends {Scrollbar}
|
9
9
|
*/
|
10
|
-
|
11
|
-
|
10
|
+
let VScrollbar = function () {
|
11
|
+
let t = this; // Create a shorthand to shorthen file size
|
12
12
|
t._vertical = true;
|
13
13
|
t._hostClassName = "vscrollbar-host";
|
14
14
|
VScrollbar.base(this, 'constructor'); // Call base constructor
|
@@ -39,22 +39,22 @@ Ext.inherits(VScrollbar, Scrollbar);
|
|
39
39
|
VScrollbar.prototype.setScrollContent = function (grid, sections, startingSection) {
|
40
40
|
this._clearAllPanes();
|
41
41
|
|
42
|
-
|
42
|
+
let sectionCount = sections.length;
|
43
43
|
if(sectionCount <= 0) { return; }
|
44
44
|
|
45
45
|
// Insert panes in the correct slot
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
let section;
|
47
|
+
let pane = this._panes[0]; // Vertical scrollbar has only one pane and one paneSlider
|
48
|
+
let paneSlider = this._paneSliders[0];
|
49
49
|
|
50
|
-
|
50
|
+
let s = 0;
|
51
51
|
while(s < startingSection) {
|
52
52
|
section = sections[s++];
|
53
53
|
section.setParent(grid);
|
54
54
|
}
|
55
55
|
|
56
56
|
pane.setParent(grid);
|
57
|
-
|
57
|
+
let dest = sectionCount - this._footerCount;
|
58
58
|
|
59
59
|
while(s < dest) {
|
60
60
|
section = sections[s++];
|
@@ -103,9 +103,9 @@ VScrollbar.prototype.isEndOfVerticalScroll = function () {
|
|
103
103
|
* @return {number}
|
104
104
|
*/
|
105
105
|
VScrollbar.prototype.getContentHeight = function () {
|
106
|
-
|
107
|
-
|
108
|
-
for (
|
106
|
+
let nodeList = this._paneSliders[0].getContent(true);
|
107
|
+
let sum = 0;
|
108
|
+
for (let i = nodeList.length; --i >= 0; ) {
|
109
109
|
sum += nodeList[i].offsetHeight; // TODO: Slow
|
110
110
|
}
|
111
111
|
return sum;
|
@@ -3,7 +3,7 @@ import Util from "../util/util.js";
|
|
3
3
|
/** @constructor
|
4
4
|
* @ignore
|
5
5
|
*/
|
6
|
-
|
6
|
+
let VirtualItems = function () {
|
7
7
|
this._items = [];
|
8
8
|
};
|
9
9
|
/** @type {Array.<!Object>}
|
@@ -22,8 +22,8 @@ VirtualItems.prototype.dispose = function () {
|
|
22
22
|
* @param {number} count
|
23
23
|
*/
|
24
24
|
VirtualItems.prototype.setItemCount = function (count) {
|
25
|
-
|
26
|
-
|
25
|
+
let ary = this._items;
|
26
|
+
let len = ary.length;
|
27
27
|
if(len !== count) {
|
28
28
|
ary.length = count;
|
29
29
|
while(len < count) {
|
@@ -3,7 +3,7 @@ import EventListeners from "./EventListeners.js";
|
|
3
3
|
/** Abstract base class that provides event management methods for derived class
|
4
4
|
* @constructor
|
5
5
|
*/
|
6
|
-
|
6
|
+
let EventDispatcher = function () {
|
7
7
|
/* throw("Cannot instantiate an abstract class"); */
|
8
8
|
/*
|
9
9
|
this._addEvent("customEvent"); // Add this line in your derived class, if you want to add custom event to your class object
|
@@ -22,7 +22,7 @@ EventDispatcher.prototype._customEvents = null;
|
|
22
22
|
* @param {Function} handler Callback method
|
23
23
|
* @param {number=} opt_priority The higher the priority, the sooner the listener get executed. Undefined priority listener will be executed last
|
24
24
|
* @example
|
25
|
-
*
|
25
|
+
* let grid = new Core();
|
26
26
|
* grid.listen("click", function(e) { console.log("Grid is clicked"); });
|
27
27
|
*/
|
28
28
|
EventDispatcher.prototype.listen = function (type, handler, opt_priority) {
|
@@ -47,7 +47,7 @@ EventDispatcher.prototype.unlisten = function (type, handler) {
|
|
47
47
|
*/
|
48
48
|
EventDispatcher.prototype.unlistenAll = function (type) {
|
49
49
|
if(!type) {
|
50
|
-
for (
|
50
|
+
for (let key in this._customEvents) {
|
51
51
|
this._customEvents[key].unlistenAll();
|
52
52
|
}
|
53
53
|
} else if(this._customEvents && this._customEvents[type]) {
|
@@ -68,7 +68,7 @@ EventDispatcher.prototype._addEvent = function (type) {
|
|
68
68
|
if(!this._customEvents) {
|
69
69
|
this._customEvents = {};
|
70
70
|
}
|
71
|
-
|
71
|
+
let e = this._customEvents[type];
|
72
72
|
if(!e) {
|
73
73
|
this._customEvents[type] = new EventListeners(this);
|
74
74
|
}
|
@@ -79,9 +79,9 @@ EventDispatcher.prototype._addEvent = function (type) {
|
|
79
79
|
* @param {...string} types
|
80
80
|
*/
|
81
81
|
EventDispatcher.prototype._addEvents = function (types) {
|
82
|
-
|
83
|
-
|
84
|
-
for(
|
82
|
+
let ary = Array.isArray(types) ? types : arguments;
|
83
|
+
let len = ary.length;
|
84
|
+
for(let i = 0; i < len; ++i) {
|
85
85
|
this._addEvent(ary[i]);
|
86
86
|
}
|
87
87
|
};
|
@@ -92,7 +92,7 @@ EventDispatcher.prototype._addEvents = function (types) {
|
|
92
92
|
* @return {boolean} Returns false if the event is not dispatching
|
93
93
|
*/
|
94
94
|
EventDispatcher.prototype._isEventDispatching = function (type) {
|
95
|
-
|
95
|
+
let evt = this._customEvents[type];
|
96
96
|
if(evt) {
|
97
97
|
return evt.isDispatching();
|
98
98
|
}
|
@@ -105,7 +105,7 @@ EventDispatcher.prototype._isEventDispatching = function (type) {
|
|
105
105
|
* @param {boolean=} disabled
|
106
106
|
*/
|
107
107
|
EventDispatcher.prototype._disableEvent = function (type, disabled) {
|
108
|
-
|
108
|
+
let evt = this._customEvents[type];
|
109
109
|
if(evt) {
|
110
110
|
evt.disable(disabled);
|
111
111
|
}
|
@@ -3,7 +3,7 @@ import Util from "../util/util.js";
|
|
3
3
|
/** @constructor
|
4
4
|
* @param {*|null=} opt_sender The "sender" reference added automatically to event argument when dispatching event
|
5
5
|
*/
|
6
|
-
|
6
|
+
let EventListeners = function (opt_sender) {
|
7
7
|
this.dispatch = this.dispatch.bind(this);
|
8
8
|
|
9
9
|
this._listeners = [];
|
@@ -22,7 +22,7 @@ EventListeners.prototype.listen = function (listener, opt_priority) {
|
|
22
22
|
this._listeners.push(listener);
|
23
23
|
} else {
|
24
24
|
listener._priority = opt_priority;
|
25
|
-
|
25
|
+
let at = Util.lowerBound(this._listeners, listener, 0, this._listeners.length, EventListeners.listenerComparer);
|
26
26
|
this._listeners.splice(at, 0, listener);
|
27
27
|
}
|
28
28
|
}
|
@@ -33,7 +33,7 @@ EventListeners.prototype.listen = function (listener, opt_priority) {
|
|
33
33
|
*/
|
34
34
|
EventListeners.prototype.unlisten = function (listener) {
|
35
35
|
if (listener) {
|
36
|
-
|
36
|
+
let index = this._listeners.indexOf(listener);
|
37
37
|
if (index >= 0) {
|
38
38
|
this._listeners.splice(index, 1);
|
39
39
|
}
|
@@ -79,7 +79,7 @@ EventListeners.prototype.dispatch = function (eventArg) {
|
|
79
79
|
this._extender(/** @type{Object} */(eventArg));
|
80
80
|
}
|
81
81
|
|
82
|
-
for (
|
82
|
+
for (let i = 0; i < this._listeners.length; i++) {
|
83
83
|
this._listeners[i](eventArg);
|
84
84
|
}
|
85
85
|
|