@refinitiv-ui/efx-grid 6.0.91 → 6.0.93
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/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/filter-dialog/lib/filter-dialog.js +1 -0
- 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-checkbox/es6/Checkbox.js +268 -268
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +60 -32
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +279 -279
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +227 -207
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +11 -11
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +1 -2
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +120 -121
- package/lib/tr-grid-util/es6/CellPainter.js +94 -104
- 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 +41 -41
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.d.ts +3 -3
- package/lib/tr-grid-util/es6/Delay.js +14 -3
- 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 -58
- 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 -87
- 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 +71 -80
- package/lib/tr-grid-util/es6/NumberFormatter.js +23 -23
- 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 +52 -52
- 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/types/es6/RowDragging.d.ts +1 -2
- package/lib/versions.json +12 -12
- 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
|
@@ -5,7 +5,7 @@ import Util from "../util/util.js";
|
|
|
5
5
|
* @constructor
|
|
6
6
|
* @ignore
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
let TrackLayout = function () {
|
|
9
9
|
this._ends = [];
|
|
10
10
|
this._cols = [];
|
|
11
11
|
};
|
|
@@ -56,13 +56,13 @@ TrackLayout.prototype.hitTest = function (val) {
|
|
|
56
56
|
if (val < 0) { return -1; }
|
|
57
57
|
|
|
58
58
|
// getTrackSize has updated the cache for usage. Do not call this._updateEndPoints()
|
|
59
|
-
|
|
59
|
+
let totalSize = this.getTrackSize();
|
|
60
60
|
if (val >= totalSize) { return ~this._laneCount; } // totalSize does not count as a hit
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
let hitIndex = -1;
|
|
63
|
+
let validRange = 0;
|
|
64
64
|
if (this._homogeneous) { // Each row has the same size
|
|
65
|
-
|
|
65
|
+
let laneSize = this._defaultSize;
|
|
66
66
|
hitIndex = Math.floor(val / laneSize);
|
|
67
67
|
validRange = ((hitIndex + 1) * laneSize);
|
|
68
68
|
} else {
|
|
@@ -98,7 +98,7 @@ TrackLayout.prototype.isAtDefaultSize = function (opt_index) {
|
|
|
98
98
|
return false;
|
|
99
99
|
}
|
|
100
100
|
} else {
|
|
101
|
-
for (
|
|
101
|
+
for (let i = this._cols.length; --i >= 0; ) {
|
|
102
102
|
if (!this._isAtDefaultSize(i)) {
|
|
103
103
|
return false;
|
|
104
104
|
}
|
|
@@ -112,7 +112,7 @@ TrackLayout.prototype.isAtDefaultSize = function (opt_index) {
|
|
|
112
112
|
* @return {boolean}
|
|
113
113
|
*/
|
|
114
114
|
TrackLayout.prototype._isAtDefaultSize = function (index) {
|
|
115
|
-
|
|
115
|
+
let col = this._cols[index];
|
|
116
116
|
if (col) {
|
|
117
117
|
if (col.actualSize !== this._defaultSize) {
|
|
118
118
|
return false;
|
|
@@ -139,8 +139,8 @@ TrackLayout.prototype.isHomogeneous = function () {
|
|
|
139
139
|
* @return {boolean}
|
|
140
140
|
*/
|
|
141
141
|
TrackLayout.prototype.isAtMinimumSize = function (opt_index) {
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
let minSize = this._getMinimumScalingSize(opt_index);
|
|
143
|
+
let trackSize = (opt_index != null) ? this.getLaneSize(opt_index) : this.getTrackSize();
|
|
144
144
|
return trackSize <= minSize;
|
|
145
145
|
};
|
|
146
146
|
|
|
@@ -149,7 +149,7 @@ TrackLayout.prototype.isAtMinimumSize = function (opt_index) {
|
|
|
149
149
|
* @return {boolean}
|
|
150
150
|
*/
|
|
151
151
|
TrackLayout.prototype.isFixedSize = function () {
|
|
152
|
-
for (
|
|
152
|
+
for (let i = 0; i < this._laneCount; ++i) {
|
|
153
153
|
if (this.getLaneScalability(i)) {
|
|
154
154
|
return false;
|
|
155
155
|
}
|
|
@@ -210,7 +210,7 @@ TrackLayout.prototype.setDefaultLaneSize = function (val) {
|
|
|
210
210
|
*/
|
|
211
211
|
TrackLayout.prototype.getLaneDefaultSize = function (index) {
|
|
212
212
|
if (index < 0 || index >= this._laneCount) { return -1; }
|
|
213
|
-
|
|
213
|
+
let col = this._newColumn(index);
|
|
214
214
|
if(col.defaultSize) {
|
|
215
215
|
return col.defaultSize;
|
|
216
216
|
} else {
|
|
@@ -224,7 +224,7 @@ TrackLayout.prototype.getLaneDefaultSize = function (index) {
|
|
|
224
224
|
TrackLayout.prototype.setLaneDefaultSize = function (index, val) {
|
|
225
225
|
if (index < 0 || index >= this._laneCount) { return; }
|
|
226
226
|
if (val >= 0) {
|
|
227
|
-
|
|
227
|
+
let col = this._newColumn(index);
|
|
228
228
|
col.defaultSize = val;
|
|
229
229
|
}
|
|
230
230
|
};
|
|
@@ -232,9 +232,9 @@ TrackLayout.prototype.setLaneDefaultSize = function (index, val) {
|
|
|
232
232
|
* @return {boolean}
|
|
233
233
|
*/
|
|
234
234
|
TrackLayout.prototype.resetLaneToDefaultSize = function () {
|
|
235
|
-
|
|
236
|
-
for (
|
|
237
|
-
|
|
235
|
+
let dirty = false;
|
|
236
|
+
for (let i = 0; i < this._laneCount; ++i) {
|
|
237
|
+
let col = this._cols[i];
|
|
238
238
|
if (col) {
|
|
239
239
|
if (!col.invisibility) {
|
|
240
240
|
if (col.defaultSize != null) {
|
|
@@ -290,11 +290,11 @@ TrackLayout.prototype.getTrackSize = function () {
|
|
|
290
290
|
* @return {Array.<number>|null} Array of size adjustment. Return null if there is no change
|
|
291
291
|
*/
|
|
292
292
|
TrackLayout.prototype.setTrackSize = function (targetSize) {
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
let i = 0, fixedSize = 0;
|
|
294
|
+
let indices = [];
|
|
295
295
|
// Collecting current data for calculation
|
|
296
296
|
for (i = 0; i < this._laneCount; ++i) {
|
|
297
|
-
|
|
297
|
+
let col = this._cols[i];
|
|
298
298
|
if (col) {
|
|
299
299
|
if (!col.invisibility) { // If column is visible
|
|
300
300
|
if (this._getLaneScalability(col) !== false) {
|
|
@@ -309,16 +309,16 @@ TrackLayout.prototype.setTrackSize = function (targetSize) {
|
|
|
309
309
|
}
|
|
310
310
|
if (indices.length <= 0) { return null; }
|
|
311
311
|
|
|
312
|
-
|
|
312
|
+
let distributions = this._distributeLaneSize(targetSize - fixedSize, indices);
|
|
313
313
|
|
|
314
314
|
// Find any change to flexible lane size
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
let dirty = false;
|
|
316
|
+
let changes = [];
|
|
317
317
|
for (i = distributions.length; --i >= 0; ) {
|
|
318
318
|
changes[i] = 0;
|
|
319
|
-
|
|
319
|
+
let val = distributions[i];
|
|
320
320
|
if (val != null) {
|
|
321
|
-
|
|
321
|
+
let cal = this.getLaneSize(i);
|
|
322
322
|
this._newColumn(i);
|
|
323
323
|
if (this._setCalculatedLaneSize(i, val)) {
|
|
324
324
|
changes[i] = val - cal;
|
|
@@ -343,8 +343,8 @@ TrackLayout.prototype.getLaneStart = function (index) {
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
this._updateEndPoints();
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
let exceedings = index - this._laneCount;
|
|
347
|
+
let exceededPortion = 0;
|
|
348
348
|
if (exceedings > 0) {
|
|
349
349
|
index -= exceedings;
|
|
350
350
|
exceededPortion = exceedings * this._defaultSize;
|
|
@@ -377,7 +377,7 @@ TrackLayout.prototype.getLaneEnd = function (index) {
|
|
|
377
377
|
*/
|
|
378
378
|
TrackLayout.prototype.getLaneSize = function (index) {
|
|
379
379
|
if (this._visibility) {
|
|
380
|
-
|
|
380
|
+
let col = this._cols[index];
|
|
381
381
|
return (col) ? col.actualSize : this._defaultSize;
|
|
382
382
|
}
|
|
383
383
|
return 0;
|
|
@@ -387,7 +387,7 @@ TrackLayout.prototype.getLaneSize = function (index) {
|
|
|
387
387
|
* @return {number}
|
|
388
388
|
*/
|
|
389
389
|
TrackLayout.prototype.getCustomLaneSize = function (index) {
|
|
390
|
-
|
|
390
|
+
let col = this._cols[index];
|
|
391
391
|
return (col && col.customSize != null) ? col.customSize : this._defaultSize;
|
|
392
392
|
};
|
|
393
393
|
/** @public
|
|
@@ -399,7 +399,7 @@ TrackLayout.prototype.setLaneSize = function (index, val) {
|
|
|
399
399
|
if (index < 0 || index >= this._laneCount) { return false; }
|
|
400
400
|
if (val < 0 || val !== val) { return false; }
|
|
401
401
|
|
|
402
|
-
|
|
402
|
+
let col = this._cols[index];
|
|
403
403
|
if (col == null || col.customSize !== val) {
|
|
404
404
|
col = this._newColumn(index);
|
|
405
405
|
col.customSize = val;
|
|
@@ -418,7 +418,7 @@ TrackLayout.prototype.setLaneSize = function (index, val) {
|
|
|
418
418
|
TrackLayout.prototype.setLaneProperty = function (index, propName, val) {
|
|
419
419
|
if (index < 0 || index >= this._laneCount) { return false; }
|
|
420
420
|
|
|
421
|
-
|
|
421
|
+
let col = this._cols[index];
|
|
422
422
|
if (col == null || col[propName] !== val) {
|
|
423
423
|
col = this._newColumn(index);
|
|
424
424
|
col[propName] = val;
|
|
@@ -433,7 +433,7 @@ TrackLayout.prototype.setLaneProperty = function (index, propName, val) {
|
|
|
433
433
|
* @return {*}
|
|
434
434
|
*/
|
|
435
435
|
TrackLayout.prototype.getLaneProperty = function (index, propName) {
|
|
436
|
-
|
|
436
|
+
let col = this._cols[index];
|
|
437
437
|
return (col && col[propName] != null) ? col[propName] : null;
|
|
438
438
|
};
|
|
439
439
|
/** @public
|
|
@@ -441,7 +441,7 @@ TrackLayout.prototype.getLaneProperty = function (index, propName) {
|
|
|
441
441
|
* @return {number}
|
|
442
442
|
*/
|
|
443
443
|
TrackLayout.prototype.getMinimumLaneSize = function (index) {
|
|
444
|
-
|
|
444
|
+
let col = this._cols[index];
|
|
445
445
|
return (col && col.minSize != null) ? col.minSize : 0;
|
|
446
446
|
};
|
|
447
447
|
/** Minimum lane size governs custom lane size in calculation
|
|
@@ -455,7 +455,7 @@ TrackLayout.prototype.setMinimumLaneSize = function (index, val, proportion) {
|
|
|
455
455
|
if (index < 0 || index >= this._laneCount) { return false; }
|
|
456
456
|
if (val < 0) { val = 0; }
|
|
457
457
|
if (this.getMinimumLaneSize(index) !== val) {
|
|
458
|
-
|
|
458
|
+
let col = this._newColumn(index);
|
|
459
459
|
col.minSize = val;
|
|
460
460
|
|
|
461
461
|
if(proportion) {
|
|
@@ -472,7 +472,7 @@ TrackLayout.prototype.setMinimumLaneSize = function (index, val, proportion) {
|
|
|
472
472
|
* @return {boolean}
|
|
473
473
|
*/
|
|
474
474
|
TrackLayout.prototype.isLaneVisible = function (index) {
|
|
475
|
-
|
|
475
|
+
let col = this._cols[index];
|
|
476
476
|
return col ? !col.invisibility : true;
|
|
477
477
|
};
|
|
478
478
|
/** @public
|
|
@@ -492,10 +492,10 @@ TrackLayout.prototype.showLane = function (index, opt_val) {
|
|
|
492
492
|
TrackLayout.prototype.hideLane = function (index, hidden, bitIndex) {
|
|
493
493
|
if (index < 0 || index >= this._laneCount) { return false; }
|
|
494
494
|
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
let col = this._newColumn(index);
|
|
496
|
+
let prevVis = !col.invisibility;
|
|
497
497
|
|
|
498
|
-
|
|
498
|
+
let bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
|
|
499
499
|
if(hidden !== false) {
|
|
500
500
|
col.invisibility |= bit; // Add invisibility bit
|
|
501
501
|
} else {
|
|
@@ -515,9 +515,9 @@ TrackLayout.prototype.hideLane = function (index, hidden, bitIndex) {
|
|
|
515
515
|
*/
|
|
516
516
|
TrackLayout.prototype.getLaneVisibilityBit = function (index, bitIndex) {
|
|
517
517
|
if (index >= 0 && index < this._laneCount) {
|
|
518
|
-
|
|
518
|
+
let col = this._cols[index];
|
|
519
519
|
if(col) {
|
|
520
|
-
|
|
520
|
+
let bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
|
|
521
521
|
if(col.invisibility & bit) {
|
|
522
522
|
return false;
|
|
523
523
|
}
|
|
@@ -533,7 +533,7 @@ TrackLayout.prototype.show = function (opt_shown) {
|
|
|
533
533
|
if (this._visibility !== opt_shown) {
|
|
534
534
|
this._visibility = opt_shown;
|
|
535
535
|
if (opt_shown) {
|
|
536
|
-
for (
|
|
536
|
+
for (let i = 0; i < this._laneCount; ++i) {
|
|
537
537
|
this._newColumn(i);
|
|
538
538
|
this._setCalculatedLaneSize(i);
|
|
539
539
|
}
|
|
@@ -548,7 +548,7 @@ TrackLayout.prototype.show = function (opt_shown) {
|
|
|
548
548
|
* @return {boolean}
|
|
549
549
|
*/
|
|
550
550
|
TrackLayout.prototype.getLaneScalability = function (index) {
|
|
551
|
-
|
|
551
|
+
let col = this._cols[index];
|
|
552
552
|
return (col && col.scalability != null) ? col.scalability : this._defaultScalability;
|
|
553
553
|
};
|
|
554
554
|
/** @public
|
|
@@ -559,7 +559,7 @@ TrackLayout.prototype.getLaneScalability = function (index) {
|
|
|
559
559
|
TrackLayout.prototype.setLaneScalability = function (index, val) {
|
|
560
560
|
if (index < 0 || index >= this._laneCount) { return false; }
|
|
561
561
|
|
|
562
|
-
|
|
562
|
+
let col = this._cols[index];
|
|
563
563
|
if (!col || col.scalability !== val) {
|
|
564
564
|
col = this._newColumn(index);
|
|
565
565
|
col.scalability = val;
|
|
@@ -584,7 +584,7 @@ TrackLayout.prototype.removeLaneAt = function (index, opt_count) {
|
|
|
584
584
|
}
|
|
585
585
|
|
|
586
586
|
this._markDirtyIndex(index);
|
|
587
|
-
|
|
587
|
+
let userSettings = this.serializeLane(index); // TODO: This is unnecessary
|
|
588
588
|
this._cols.splice(index, opt_count);
|
|
589
589
|
|
|
590
590
|
this._laneCount -= opt_count;
|
|
@@ -596,7 +596,7 @@ TrackLayout.prototype.removeLaneAt = function (index, opt_count) {
|
|
|
596
596
|
*/
|
|
597
597
|
TrackLayout.prototype.insertLane = function (index, opt_json) {
|
|
598
598
|
if (index < 0) { index = 0; }
|
|
599
|
-
|
|
599
|
+
let chunkSize = 1;
|
|
600
600
|
if (Util.isNumber(opt_json)) {
|
|
601
601
|
if (/** @type{number} */(opt_json) <= 0) { return; }
|
|
602
602
|
chunkSize = /** @type{number} */(opt_json);
|
|
@@ -616,8 +616,8 @@ TrackLayout.prototype.insertLane = function (index, opt_json) {
|
|
|
616
616
|
|
|
617
617
|
Util.insertEmptyItems(this._cols, index, chunkSize);
|
|
618
618
|
if (opt_json) {
|
|
619
|
-
|
|
620
|
-
for (
|
|
619
|
+
let toIndex = index + chunkSize;
|
|
620
|
+
for (let i = index; i < toIndex; ++i) {
|
|
621
621
|
this.deserializeLane(i, /** @type{Object} */(opt_json));
|
|
622
622
|
}
|
|
623
623
|
}
|
|
@@ -633,7 +633,7 @@ TrackLayout.prototype.moveLane = function (from, to) {
|
|
|
633
633
|
else if (to > this._laneCount) { to = this._laneCount; }
|
|
634
634
|
if (from === to) { return; }
|
|
635
635
|
|
|
636
|
-
|
|
636
|
+
let minIndex = (from < to) ? from : to;
|
|
637
637
|
this._markDirtyIndex(minIndex);
|
|
638
638
|
|
|
639
639
|
Util.moveArrayItem(this._cols, from, to);
|
|
@@ -646,10 +646,10 @@ TrackLayout.prototype.moveLane = function (from, to) {
|
|
|
646
646
|
TrackLayout.prototype.serializeLane = function (index) {
|
|
647
647
|
if (index < 0 || index >= this._laneCount) { return null; }
|
|
648
648
|
|
|
649
|
-
|
|
649
|
+
let userSettings = {};
|
|
650
650
|
userSettings["index"] = index;
|
|
651
651
|
|
|
652
|
-
|
|
652
|
+
let col = this._cols[index];
|
|
653
653
|
if (!col) { return userSettings; }
|
|
654
654
|
|
|
655
655
|
userSettings["size"] = col.customSize;
|
|
@@ -667,7 +667,7 @@ TrackLayout.prototype.deserializeLane = function (index, opt_json) {
|
|
|
667
667
|
if (!opt_json) { return; }
|
|
668
668
|
if (index < 0 || index >= this._laneCount) { return; }
|
|
669
669
|
|
|
670
|
-
|
|
670
|
+
let val = opt_json["size"];
|
|
671
671
|
if (val != null) {
|
|
672
672
|
this.setLaneSize(index, /** @type{number} */(val));
|
|
673
673
|
}
|
|
@@ -688,13 +688,13 @@ TrackLayout.prototype.deserializeLane = function (index, opt_json) {
|
|
|
688
688
|
/** @private
|
|
689
689
|
*/
|
|
690
690
|
TrackLayout.prototype._updateEndPoints = function () {
|
|
691
|
-
|
|
691
|
+
let dirtyIndex = this._ends.length;
|
|
692
692
|
if (dirtyIndex >= this._laneCount) return;
|
|
693
693
|
|
|
694
694
|
this._ends.length = this._laneCount;
|
|
695
695
|
|
|
696
|
-
|
|
697
|
-
|
|
696
|
+
let i = 0;
|
|
697
|
+
let sum = (dirtyIndex > 0) ? this._ends[dirtyIndex - 1] : 0;
|
|
698
698
|
|
|
699
699
|
for (i = dirtyIndex; i < this._laneCount; ++i) {
|
|
700
700
|
sum += this.getLaneSize(i);
|
|
@@ -709,13 +709,13 @@ TrackLayout.prototype._updateEndPoints = function () {
|
|
|
709
709
|
* @return {boolean}
|
|
710
710
|
*/
|
|
711
711
|
TrackLayout.prototype._setCalculatedLaneSize = function (index, opt_val) {
|
|
712
|
-
|
|
712
|
+
let col = this._cols[index];
|
|
713
713
|
if (this._visibility && !col.invisibility) { // If column is visible
|
|
714
714
|
if (opt_val == null) {
|
|
715
715
|
opt_val = (col.customSize != null) ? col.customSize : this._defaultSize;
|
|
716
716
|
}
|
|
717
717
|
if(!col.scalability) { // minSize doesn't applied when lane scalability
|
|
718
|
-
|
|
718
|
+
let minSize = (col.minSize != null) ? col.minSize : 0;
|
|
719
719
|
if (opt_val < minSize) {
|
|
720
720
|
opt_val = minSize;
|
|
721
721
|
}
|
|
@@ -739,9 +739,9 @@ TrackLayout.prototype._setCalculatedLaneSize = function (index, opt_val) {
|
|
|
739
739
|
* @return {number}
|
|
740
740
|
*/
|
|
741
741
|
TrackLayout.prototype._getMinimumScalingSize = function (opt_index) {
|
|
742
|
-
|
|
742
|
+
let sum = 0;
|
|
743
743
|
if (opt_index != null) {
|
|
744
|
-
|
|
744
|
+
let col = this._cols[opt_index];
|
|
745
745
|
if (!col.invisibility) {
|
|
746
746
|
if (col.minSize != null) {
|
|
747
747
|
if (this._getLaneScalability(col) === false && col.customSize != null) {
|
|
@@ -753,7 +753,7 @@ TrackLayout.prototype._getMinimumScalingSize = function (opt_index) {
|
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
755
|
} else {
|
|
756
|
-
for (
|
|
756
|
+
for (let i = this._laneCount; --i >= 0; ) {
|
|
757
757
|
sum += this._getMinimumScalingSize(i);
|
|
758
758
|
}
|
|
759
759
|
}
|
|
@@ -793,8 +793,8 @@ TrackLayout.prototype._distributeLaneSize = function (availSpace, indices) {
|
|
|
793
793
|
if (indices.length <= 0) { return []; }
|
|
794
794
|
if (availSpace < 0) { availSpace = 0; }
|
|
795
795
|
|
|
796
|
-
|
|
797
|
-
|
|
796
|
+
let i = 0, totalWeight = 0, index = 0, expectedSize = 0;
|
|
797
|
+
let minSizes = [], laneSizes = [], distributions = [];
|
|
798
798
|
|
|
799
799
|
for (i = indices.length; --i >= 0; ) {
|
|
800
800
|
index = indices[i];
|
|
@@ -803,13 +803,13 @@ TrackLayout.prototype._distributeLaneSize = function (availSpace, indices) {
|
|
|
803
803
|
totalWeight += laneSizes[index];
|
|
804
804
|
}
|
|
805
805
|
|
|
806
|
-
|
|
806
|
+
let undistributable = true;
|
|
807
807
|
while(undistributable) { // All lane sizes must at least equal to its minimum width
|
|
808
808
|
undistributable = false;
|
|
809
809
|
for (i = indices.length; --i >= 0; ) {
|
|
810
810
|
index = indices[i];
|
|
811
|
-
|
|
812
|
-
|
|
811
|
+
let minSize = minSizes[index];
|
|
812
|
+
let laneSize = laneSizes[index];
|
|
813
813
|
expectedSize = availSpace * laneSize / totalWeight;
|
|
814
814
|
if (expectedSize <= minSize) {
|
|
815
815
|
undistributable = true;
|
|
@@ -821,13 +821,13 @@ TrackLayout.prototype._distributeLaneSize = function (availSpace, indices) {
|
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
823
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
824
|
+
let lastIndex = indices.length - 1;
|
|
825
|
+
let occupiedSpace = 0;
|
|
826
|
+
let fraction = 0;
|
|
827
827
|
for (i = lastIndex; --i >= 0; ) {
|
|
828
828
|
index = indices[i];
|
|
829
829
|
expectedSize = availSpace * laneSizes[index] / totalWeight;
|
|
830
|
-
|
|
830
|
+
let integerSize = Math.floor(expectedSize);
|
|
831
831
|
fraction += (expectedSize - integerSize);
|
|
832
832
|
if(fraction >= 1) {
|
|
833
833
|
++integerSize;
|
|
@@ -853,7 +853,7 @@ TrackLayout.prototype._markDirtyIndex = function (index) {
|
|
|
853
853
|
* @return {!Object}
|
|
854
854
|
*/
|
|
855
855
|
TrackLayout.prototype._newColumn = function (index) {
|
|
856
|
-
|
|
856
|
+
let col = this._cols[index];
|
|
857
857
|
if (!col) {
|
|
858
858
|
this._cols[index] = col = {};
|
|
859
859
|
// Each bit represents visibility state as the followings:
|
|
@@ -877,16 +877,16 @@ TrackLayout.prototype.copyFrom = function (src, offset) {
|
|
|
877
877
|
}
|
|
878
878
|
if(!offset) { offset = 0; }
|
|
879
879
|
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
880
|
+
let srcCount = src.getLaneCount();
|
|
881
|
+
let curCount = this.getLaneCount();
|
|
882
|
+
let limit = offset + srcCount;
|
|
883
883
|
if(limit > curCount) {
|
|
884
884
|
limit = curCount;
|
|
885
885
|
}
|
|
886
|
-
|
|
887
|
-
for(
|
|
888
|
-
|
|
889
|
-
|
|
886
|
+
let srcIndex = 0;
|
|
887
|
+
for(let i = offset; i < limit; ++i) {
|
|
888
|
+
let val = src.getLaneSize(srcIndex++);
|
|
889
|
+
let col = this._newColumn(i);
|
|
890
890
|
if (col.customSize !== val) {
|
|
891
891
|
col.customSize = val;
|
|
892
892
|
if(col.actualSize !== val) { // WARNING: This does not obey visibility and minSize
|
|
@@ -6,7 +6,7 @@ import TrackLayout from "./TrackLayout.js"; // eslint-disable-line
|
|
|
6
6
|
* @param {!TrackLayout} trackLayout
|
|
7
7
|
* @extends {EventDispatcher}
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
let Virtualizer = function (trackLayout) {
|
|
10
10
|
this._layout = trackLayout;
|
|
11
11
|
this._arg = {};
|
|
12
12
|
this._addEvent("indexChanged");
|
|
@@ -66,7 +66,7 @@ Virtualizer.prototype._getMinIndex = function () {
|
|
|
66
66
|
* @return {number}
|
|
67
67
|
*/
|
|
68
68
|
Virtualizer.prototype._getMaxIndex = function () {
|
|
69
|
-
|
|
69
|
+
let index = this._layout.getLaneCount() - this._endOffsetCount;
|
|
70
70
|
return index > this._startOffsetCount ? index : this._startOffsetCount;
|
|
71
71
|
};
|
|
72
72
|
|
|
@@ -81,8 +81,8 @@ Virtualizer.prototype.getContentStart = function (index) {
|
|
|
81
81
|
* @return {number}
|
|
82
82
|
*/
|
|
83
83
|
Virtualizer.prototype.getContentInViewCount = function () {
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
let first = this.getFirstIndexInView();
|
|
85
|
+
let last = this.getLastIndexInView();
|
|
86
86
|
if (first >= 0 && first < last) {
|
|
87
87
|
return last - first + 1;
|
|
88
88
|
}
|
|
@@ -93,8 +93,8 @@ Virtualizer.prototype.getContentInViewCount = function () {
|
|
|
93
93
|
* @returns {number}
|
|
94
94
|
*/
|
|
95
95
|
Virtualizer.prototype._getContentSizeInBounds = function () {
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
let minIndex = this._getMinIndex();
|
|
97
|
+
let maxIndex = this._getMaxIndex();
|
|
98
98
|
return this._layout.getLaneStart(maxIndex) - this._layout.getLaneStart(minIndex);
|
|
99
99
|
};
|
|
100
100
|
|
|
@@ -110,7 +110,7 @@ Virtualizer.prototype.getViewSize = function () {
|
|
|
110
110
|
* @return {number}
|
|
111
111
|
*/
|
|
112
112
|
Virtualizer.prototype.getViewOffset = function () {
|
|
113
|
-
|
|
113
|
+
let minIndex = this._getMinIndex();
|
|
114
114
|
return this._viewOffset + this._layout.getLaneStart(minIndex);
|
|
115
115
|
};
|
|
116
116
|
/** @public
|
|
@@ -134,8 +134,8 @@ Virtualizer.prototype.getFirstIndexInView = function () {
|
|
|
134
134
|
if (!this._virtualizable) {
|
|
135
135
|
return 0;
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
let vo = this.getViewOffset();
|
|
138
|
+
let trackSize = this._layout.getTrackSize();
|
|
139
139
|
if(vo >= trackSize) {
|
|
140
140
|
vo = trackSize - this._viewSize; // WARNING: View offset already includes minIndex and this will override that
|
|
141
141
|
}
|
|
@@ -152,11 +152,11 @@ Virtualizer.prototype.getLastIndexInView = function () {
|
|
|
152
152
|
if (!this._virtualizable) {
|
|
153
153
|
return this._layout.getLaneCount() - 1;
|
|
154
154
|
} else {
|
|
155
|
-
|
|
155
|
+
let viewEnd = this.getViewOffset() + this._viewSize;
|
|
156
156
|
|
|
157
157
|
// prevent from invalid-index because of verical buffering
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
let maxIndex = this._getMaxIndex();
|
|
159
|
+
let endBound = this._layout.getLaneStart(maxIndex);
|
|
160
160
|
if (viewEnd >= endBound) {
|
|
161
161
|
return maxIndex - 1; // maxIndex is exclusive
|
|
162
162
|
}
|
|
@@ -191,9 +191,9 @@ Virtualizer.prototype.update = function (opt_force) {
|
|
|
191
191
|
|
|
192
192
|
if (this._isEventDispatching("indexChanged")) { return false; }
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
let fi = this.getFirstIndexInView();
|
|
195
|
+
let li = this.getLastIndexInView(); // INCLUSIVE
|
|
196
|
+
let changed = (this._arg["prevFirstIndex"] !== fi) || (this._arg["prevLastIndex"] !== li);
|
|
197
197
|
|
|
198
198
|
if (opt_force || changed) {
|
|
199
199
|
this._arg["firstIndex"] = fi;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @namespace
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
let Util = {};
|
|
5
5
|
|
|
6
6
|
// TODO: move to tr-grid-util
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@ var Util = {};
|
|
|
9
9
|
* @type {boolean}
|
|
10
10
|
*/
|
|
11
11
|
Util.isIE = (function () {
|
|
12
|
-
|
|
12
|
+
let ua = window.navigator.userAgent;
|
|
13
13
|
return (ua.indexOf('MSIE ') > 0) || (ua.indexOf('Trident/') > 0) || (ua.indexOf('Edge/') > 0);
|
|
14
14
|
}());
|
|
15
15
|
/** @const
|
|
@@ -26,9 +26,9 @@ Util.isTouchDevice = (function () {
|
|
|
26
26
|
* @type {boolean}
|
|
27
27
|
*/
|
|
28
28
|
Util.isSafari = (function () {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
let rejectedExpression = /Chrome|Android|CriOS|FxiOS|EdgiOS/i;
|
|
30
|
+
let safariExpression = /Safari/i;
|
|
31
|
+
let agent = navigator.userAgent;
|
|
32
32
|
if (rejectedExpression.test(agent)) {
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
@@ -129,9 +129,9 @@ Util.isFunction = function (val) {
|
|
|
129
129
|
* @return {!Object}
|
|
130
130
|
*/
|
|
131
131
|
Util.getClientPosition = function (target, opt_retObj) {
|
|
132
|
-
|
|
132
|
+
let pos = opt_retObj || {};
|
|
133
133
|
if (target["getBoundingClientRect"]) {
|
|
134
|
-
|
|
134
|
+
let box = target["getBoundingClientRect"]();
|
|
135
135
|
pos["x"] = box.left;
|
|
136
136
|
pos["y"] = box.top;
|
|
137
137
|
} else { // Event
|
|
@@ -151,7 +151,7 @@ Util.getClientPosition = function (target, opt_retObj) {
|
|
|
151
151
|
*/
|
|
152
152
|
Util.getRelativePosition = function (A, B, opt_retObj) {
|
|
153
153
|
opt_retObj = Util.getClientPosition(A, opt_retObj);
|
|
154
|
-
|
|
154
|
+
let bp = Util.getClientPosition(B);
|
|
155
155
|
|
|
156
156
|
opt_retObj["x"] -= bp["x"];
|
|
157
157
|
opt_retObj["y"] -= bp["y"];
|
|
@@ -169,12 +169,12 @@ Util.getRelativePosition = function (A, B, opt_retObj) {
|
|
|
169
169
|
Util.moveArrayItem = function (ary, from, to) {
|
|
170
170
|
if (!ary) { return null; }
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
let len = ary.length;
|
|
173
173
|
if (from >= len && to >= len) {
|
|
174
174
|
return /** @type{Array} */(ary); // No item needs to be moved
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
let item = ary.splice(from, 1)[0];
|
|
178
178
|
if (to < len) {
|
|
179
179
|
ary.splice(to, 0, item);
|
|
180
180
|
} else {
|
|
@@ -189,7 +189,7 @@ Util.moveArrayItem = function (ary, from, to) {
|
|
|
189
189
|
* @return {Array}
|
|
190
190
|
*/
|
|
191
191
|
Util.pushArrayItems = function(ary, items) {
|
|
192
|
-
|
|
192
|
+
let len = items ? items.length : 0;
|
|
193
193
|
if(len > 0) {
|
|
194
194
|
if(len < 1e5) { // Maximum number of arguments that the spread operator can take is exactly 125052
|
|
195
195
|
if(len > 1) {
|
|
@@ -198,8 +198,8 @@ Util.pushArrayItems = function(ary, items) {
|
|
|
198
198
|
ary.push(items[0]);
|
|
199
199
|
}
|
|
200
200
|
} else {
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
let start = 0;
|
|
202
|
+
let end = 0;
|
|
203
203
|
while(start < len) {
|
|
204
204
|
end += 1e5;
|
|
205
205
|
Array.prototype.push.apply(ary, items.slice(start, end));
|
|
@@ -221,7 +221,7 @@ Util.pushArrayItems = function(ary, items) {
|
|
|
221
221
|
Util.insertEmptyItems = function (ary, at, chunkSize) {
|
|
222
222
|
if(chunkSize > 0) {
|
|
223
223
|
if(chunkSize > 1) {
|
|
224
|
-
|
|
224
|
+
let tailEnd = ary.slice(at);
|
|
225
225
|
ary.length = at; // Remove the tail end part
|
|
226
226
|
ary.length += chunkSize;
|
|
227
227
|
Util.pushArrayItems(ary, tailEnd);
|
|
@@ -242,7 +242,7 @@ Util.insertEmptyItems = function (ary, at, chunkSize) {
|
|
|
242
242
|
Util.cycleArray = function (ary, numItems) {
|
|
243
243
|
if(numItems > 0 && ary) {
|
|
244
244
|
if(numItems < ary.length) {
|
|
245
|
-
|
|
245
|
+
let front = ary.splice(0, numItems);
|
|
246
246
|
return ary.concat(front);
|
|
247
247
|
}
|
|
248
248
|
}
|
|
@@ -273,7 +273,7 @@ Util.lowerBound = function (ary, value, left, right, opt_lessFunc) {
|
|
|
273
273
|
opt_lessFunc = Util._defaultLessComparator;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
|
|
276
|
+
let mid = 0;
|
|
277
277
|
while (right > left) {
|
|
278
278
|
mid = (left + right) >> 1;
|
|
279
279
|
if (opt_lessFunc(ary[mid], value)) {
|
|
@@ -296,7 +296,7 @@ Util.lowerBound = function (ary, value, left, right, opt_lessFunc) {
|
|
|
296
296
|
* @return {number} Return the highest index that gives equal or greater than the searched value
|
|
297
297
|
*/
|
|
298
298
|
Util.upperBound = function (ary, value, left, right, opt_lessFunc) {
|
|
299
|
-
|
|
299
|
+
let at = Util.lowerBound(ary, value, left, right, opt_lessFunc);
|
|
300
300
|
while (ary[at] === value) { ++at; }
|
|
301
301
|
return at;
|
|
302
302
|
};
|
|
@@ -307,7 +307,7 @@ Util.upperBound = function (ary, value, left, right, opt_lessFunc) {
|
|
|
307
307
|
* @return {string}
|
|
308
308
|
*/
|
|
309
309
|
Util.stringFormat = function (format) {
|
|
310
|
-
|
|
310
|
+
let args = Array.prototype.slice.call(arguments, 1);
|
|
311
311
|
return format.replace(/{(\d+)}/g, function (match, number) {
|
|
312
312
|
return (args[number] != null) ? args[number] : match;
|
|
313
313
|
});
|
|
@@ -348,7 +348,7 @@ Util.calculatePercent = function (lowVal, lastVal, highVal) {
|
|
|
348
348
|
if (highVal === lowVal) {
|
|
349
349
|
return 50;
|
|
350
350
|
}
|
|
351
|
-
|
|
351
|
+
let percent = (lastVal - lowVal) / (highVal - lowVal);
|
|
352
352
|
if (percent < 0) {
|
|
353
353
|
return 0;
|
|
354
354
|
}
|
|
@@ -366,7 +366,7 @@ Util.calculatePercent = function (lowVal, lastVal, highVal) {
|
|
|
366
366
|
* @return {Element}
|
|
367
367
|
*/
|
|
368
368
|
Util.closestElement = function (elem, classStr) {
|
|
369
|
-
|
|
369
|
+
let n = elem;
|
|
370
370
|
while (n) {
|
|
371
371
|
if(n.classList) { // DocumentFragment does not have classList property
|
|
372
372
|
if (n.classList.contains(classStr)) {
|