@refinitiv-ui/efx-grid 6.0.91 → 6.0.92
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/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
|
@@ -7,8 +7,8 @@ import Scrollbar from "./Scrollbar.js";
|
|
|
7
7
|
/** @constructor
|
|
8
8
|
* @extends {Scrollbar}
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
let HScrollbar = function () {
|
|
11
|
+
let t = this; // Create a shorthand to shorthen file size
|
|
12
12
|
t._vertical = false;
|
|
13
13
|
t._onDeactivated = t._onDeactivated.bind(t);
|
|
14
14
|
t._onActivated = t._onActivated.bind(t);
|
|
@@ -46,36 +46,36 @@ HScrollbar.prototype._pinnedRightColumnCount = 0;
|
|
|
46
46
|
HScrollbar.prototype.setScrollContent = function (grid, sections, startColIndex, pinnedRightColumn) {
|
|
47
47
|
this._clearAllPanes();
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
let sectionCount = sections.length;
|
|
50
50
|
if(sectionCount <= 0) { return; }
|
|
51
51
|
|
|
52
52
|
this._pinnedLeftColumnCount = startColIndex >= 0 ? startColIndex : 0;
|
|
53
53
|
this._pinnedRightColumnCount = pinnedRightColumn > 0 ? pinnedRightColumn : 0;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
let section = sections[0];
|
|
55
|
+
let colCount = section.getColumnCount();
|
|
56
|
+
let endColIndex = colCount - pinnedRightColumn; // WARNING: If number of pinned column is greater than the scrollable range, the pinning will not be applied
|
|
57
57
|
if(!endColIndex || endColIndex < 0) {
|
|
58
58
|
endColIndex = colCount;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// Insert panes in the correct slot
|
|
62
|
-
for (
|
|
62
|
+
for (let s = 0; s < sectionCount; ++s) {
|
|
63
63
|
section = sections[s];
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
let pane = this._addPaneAt(s);
|
|
66
|
+
let paneSlider = this._paneSliders[s];
|
|
67
|
+
let paneElem = pane.getElement();
|
|
68
|
+
let sliderElem = paneSlider.getElement();
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
let c;
|
|
71
|
+
let column;
|
|
72
72
|
for (c = 0; c < startColIndex; ++c) {
|
|
73
73
|
column = /** @type{Column} */(section.getColumn(c));
|
|
74
74
|
column.setScrollState(paneElem, null, false);
|
|
75
75
|
}
|
|
76
76
|
pane.setParent(section.getColumnHost());
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
let columns = [];
|
|
78
|
+
let content = [];
|
|
79
79
|
for (c = startColIndex; c < endColIndex; ++c) {
|
|
80
80
|
column = /** @type{Column} */(section.getColumn(c));
|
|
81
81
|
column.setScrollState(null, sliderElem, this.isActive());
|
|
@@ -88,7 +88,7 @@ HScrollbar.prototype.setScrollContent = function (grid, sections, startColIndex,
|
|
|
88
88
|
column.setScrollState(null, null, false);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
let rs = section.getReservedSpace();
|
|
92
92
|
if(rs) {
|
|
93
93
|
if(!this._pinnedRightColumnCount) {
|
|
94
94
|
paneSlider.addContent(rs);
|
|
@@ -146,8 +146,8 @@ HScrollbar.prototype.getPinnedRightColumnCount = function () {
|
|
|
146
146
|
* @param {number} val
|
|
147
147
|
*/
|
|
148
148
|
HScrollbar.prototype.setPaneLeft = function (val) {
|
|
149
|
-
|
|
150
|
-
for (
|
|
149
|
+
let px = val && this.isActive() ? (-val + "px") : "";
|
|
150
|
+
for (let i = this._panes.length; --i >= 0; ) {
|
|
151
151
|
this._paneSliders[i].setStyle("marginLeft", px);
|
|
152
152
|
}
|
|
153
153
|
};
|
|
@@ -163,13 +163,13 @@ HScrollbar.prototype.isEndOfHorizontalScroll = function () {
|
|
|
163
163
|
* @return {number}
|
|
164
164
|
*/
|
|
165
165
|
HScrollbar.prototype.getContentWidth = function () {
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
let paneSlider = this._paneSliders[0]; // Get content width from the first pane slider
|
|
167
|
+
let sum = 0;
|
|
168
168
|
if (paneSlider) {
|
|
169
|
-
|
|
170
|
-
for (
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
let colList = /** @type{Array} */(paneSlider._content);
|
|
170
|
+
for (let i = colList.length; --i >= 0; ) {
|
|
171
|
+
let elem = colList[i];
|
|
172
|
+
let width = elem ? elem.style.width : 0; // HACK
|
|
173
173
|
if(width) {
|
|
174
174
|
sum += parseFloat(width); // TODO: parseFloat is not fast
|
|
175
175
|
}
|
|
@@ -218,13 +218,13 @@ HScrollbar.prototype._onDeactivated = function (e) {
|
|
|
218
218
|
* @param {boolean} bool
|
|
219
219
|
*/
|
|
220
220
|
HScrollbar.prototype._updateActivation = function (bool) {
|
|
221
|
-
|
|
222
|
-
for(
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
for(
|
|
227
|
-
|
|
221
|
+
let sectCount = this._paneSliders.length;
|
|
222
|
+
for(let s = 0; s < sectCount; ++s) {
|
|
223
|
+
let paneSlider = this._paneSliders[s];
|
|
224
|
+
let columns = paneSlider._columns;
|
|
225
|
+
let colCount = columns ? columns.length : 0;
|
|
226
|
+
for(let c = 0; c < colCount; ++c) {
|
|
227
|
+
let column = columns[c];
|
|
228
228
|
if(column.getElement()) { // Column may have been disposed
|
|
229
229
|
column.enableAbsolutePosition(bool);
|
|
230
230
|
}
|
|
@@ -8,8 +8,8 @@ import Reverter from "../util/Reverter.js";
|
|
|
8
8
|
/** @constructor
|
|
9
9
|
* @extends {ElementWrapper}
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
let Scrollbar = function () {
|
|
12
|
+
let t = this; // Create a shorthand to shorthen file size
|
|
13
13
|
t._addEvents(
|
|
14
14
|
"scroll",
|
|
15
15
|
"activated",
|
|
@@ -260,9 +260,9 @@ Scrollbar._listeners = null;
|
|
|
260
260
|
* @return {boolean}
|
|
261
261
|
*/
|
|
262
262
|
Scrollbar.prototype._updateEffectiveArea = function() {
|
|
263
|
-
|
|
263
|
+
let thickness = this.getTrackThickness();
|
|
264
264
|
if(thickness) {
|
|
265
|
-
|
|
265
|
+
let prop = (this._vertical) ? "width" : "height";
|
|
266
266
|
this._element.style[prop] = (thickness + 1) + "px";
|
|
267
267
|
}
|
|
268
268
|
return thickness ? true : false;
|
|
@@ -277,7 +277,7 @@ Scrollbar._queryNativeTrackThickness = function (listener) {
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
if(listener && Scrollbar._trackThickness <= 0) {
|
|
280
|
-
|
|
280
|
+
let listeners = Scrollbar._listeners;
|
|
281
281
|
if(!listeners) {
|
|
282
282
|
listeners = Scrollbar._listeners = [];
|
|
283
283
|
}
|
|
@@ -312,8 +312,8 @@ Scrollbar._retrieveNativeTrackThinkness = function () {
|
|
|
312
312
|
return true;
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
let inner = Scrollbar._innerDummy;
|
|
316
|
+
let outer = Scrollbar._outerDummy;
|
|
317
317
|
if(!inner) {
|
|
318
318
|
inner = Scrollbar._innerDummy = document.createElement('p');
|
|
319
319
|
inner.style.width = "100%";
|
|
@@ -331,16 +331,16 @@ Scrollbar._retrieveNativeTrackThinkness = function () {
|
|
|
331
331
|
|
|
332
332
|
outer.style.overflow = "hidden";
|
|
333
333
|
document.body.appendChild(outer);
|
|
334
|
-
|
|
334
|
+
let w1 = inner.offsetWidth;
|
|
335
335
|
outer.style.overflow = 'scroll';
|
|
336
|
-
|
|
336
|
+
let w2 = inner.offsetWidth;
|
|
337
337
|
|
|
338
338
|
// Sometimes, w1 may be equal to w2 on certain browsers or devices, such as a Macbook when opened on the built-in screen. In such cases, the outer.style.overflow scroll may not change the offsetWidth, and the outer.clientWidth will be the same as the inner offsetWidth. As a result, the native track thickness may not be found
|
|
339
339
|
if(w1 == w2) {
|
|
340
340
|
w2 = outer.clientWidth;
|
|
341
341
|
}
|
|
342
342
|
document.body.removeChild(outer);
|
|
343
|
-
|
|
343
|
+
let scrollbarWidth = Scrollbar._trackThickness = (w1 - w2);
|
|
344
344
|
if(scrollbarWidth > 0) {
|
|
345
345
|
Scrollbar._clearStaticResources();
|
|
346
346
|
return true;
|
|
@@ -352,12 +352,12 @@ Scrollbar._retrieveNativeTrackThinkness = function () {
|
|
|
352
352
|
*/
|
|
353
353
|
Scrollbar._clearStaticResources = function () {
|
|
354
354
|
Scrollbar._innerDummy = Scrollbar._outerDummy = null;
|
|
355
|
-
|
|
355
|
+
let listeners = Scrollbar._listeners;
|
|
356
356
|
if(listeners) {
|
|
357
357
|
Scrollbar._listeners = null;
|
|
358
358
|
|
|
359
|
-
|
|
360
|
-
for(
|
|
359
|
+
let arg = {};
|
|
360
|
+
for(let i = listeners.length; --i >= 0;) {
|
|
361
361
|
listeners[i](arg);
|
|
362
362
|
}
|
|
363
363
|
}
|
|
@@ -376,9 +376,9 @@ Scrollbar.updateTrackThickness = function () {
|
|
|
376
376
|
/** @override */
|
|
377
377
|
Scrollbar.prototype.dispose = function () {
|
|
378
378
|
|
|
379
|
-
|
|
379
|
+
let sbListeners = Scrollbar._listeners;
|
|
380
380
|
if(sbListeners) {
|
|
381
|
-
|
|
381
|
+
let idx = sbListeners.indexOf(this._onThicknessChanged);
|
|
382
382
|
if(idx >= 0 ) {
|
|
383
383
|
sbListeners.splice(idx, 1);
|
|
384
384
|
this._onThicknessChanged = null;
|
|
@@ -393,7 +393,7 @@ Scrollbar.prototype.dispose = function () {
|
|
|
393
393
|
|
|
394
394
|
this._active = this._layoutChanged = false;
|
|
395
395
|
this._dispose();
|
|
396
|
-
for(
|
|
396
|
+
for(let i = this._panes.length; --i >= 0;) {
|
|
397
397
|
this._panes[i].dispose();
|
|
398
398
|
this._paneSliders[i].dispose();
|
|
399
399
|
}
|
|
@@ -409,9 +409,9 @@ Scrollbar.prototype.getParent = function () {
|
|
|
409
409
|
};
|
|
410
410
|
/** @override */
|
|
411
411
|
Scrollbar.prototype.setParent = function (p, opt_prepend) {
|
|
412
|
-
|
|
412
|
+
let elem = Util.getElement(p);
|
|
413
413
|
|
|
414
|
-
|
|
414
|
+
let isDifferentParent = this._parentNode !== elem;
|
|
415
415
|
if(isDifferentParent && this._parentNode) {
|
|
416
416
|
this.removeWheelListener(this._parentNode);
|
|
417
417
|
this._parentNode.classList.remove(this._hostClassName);
|
|
@@ -435,7 +435,7 @@ Scrollbar.prototype.setParent = function (p, opt_prepend) {
|
|
|
435
435
|
*/
|
|
436
436
|
Scrollbar.prototype.attachToExternalElement = function (host) {
|
|
437
437
|
this.setParent(host);
|
|
438
|
-
|
|
438
|
+
let scrollElem = this.getElement();
|
|
439
439
|
scrollElem.style.right = "0";
|
|
440
440
|
if(this._vertical) {
|
|
441
441
|
scrollElem.style.overflowX = "hidden";
|
|
@@ -450,9 +450,9 @@ Scrollbar.prototype.attachToExternalElement = function (host) {
|
|
|
450
450
|
/** @private
|
|
451
451
|
*/
|
|
452
452
|
Scrollbar.prototype._onActiveStateChange = function () {
|
|
453
|
-
|
|
453
|
+
let t = this; // Minimize file size
|
|
454
454
|
t._scrollTo(0, true); // WARNING: Reset scroll position
|
|
455
|
-
|
|
455
|
+
let i;
|
|
456
456
|
if(t._active) {
|
|
457
457
|
// t._element.style.display = "";
|
|
458
458
|
if(t._parentNode) {
|
|
@@ -475,7 +475,7 @@ Scrollbar.prototype._onActiveStateChange = function () {
|
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
// Remove scrollbar on all panes
|
|
478
|
-
|
|
478
|
+
let prop = (t._vertical) ? "height" : "width";
|
|
479
479
|
for (i = t._panes.length; --i >= 0; ) {
|
|
480
480
|
t._panes[i].addClass("scroll-disabled");
|
|
481
481
|
t._panes[i].setStyle(prop, "");
|
|
@@ -491,7 +491,7 @@ Scrollbar.prototype._onActiveStateChange = function () {
|
|
|
491
491
|
/** @private
|
|
492
492
|
*/
|
|
493
493
|
Scrollbar.prototype._onEnablingStateChange = function () {
|
|
494
|
-
|
|
494
|
+
let t = this; // Minimize file size
|
|
495
495
|
if(t._enabled) {
|
|
496
496
|
t._dispatch("enabled", {});
|
|
497
497
|
} else {
|
|
@@ -583,7 +583,7 @@ Scrollbar.prototype.calculateContentSize = function () { return 0; };
|
|
|
583
583
|
Scrollbar.prototype.update = function () {
|
|
584
584
|
if(this._contentDirty) { // WARNING: Causes page recalculation
|
|
585
585
|
this._contentDirty = false;
|
|
586
|
-
|
|
586
|
+
let size = this.calculateContentSize();
|
|
587
587
|
if(!size || size < 0) {
|
|
588
588
|
size = 0;
|
|
589
589
|
}
|
|
@@ -627,8 +627,8 @@ Scrollbar.prototype.invalidateContent = function () {
|
|
|
627
627
|
* @return {boolean}
|
|
628
628
|
*/
|
|
629
629
|
Scrollbar.prototype.isScrollPosValid = function(contentSize) {
|
|
630
|
-
|
|
631
|
-
|
|
630
|
+
let scrollGap = contentSize - this.getPaneSize();
|
|
631
|
+
let pScrollVal = this._pScrollVal;
|
|
632
632
|
return (pScrollVal === 0) || ((pScrollVal > 0) &&
|
|
633
633
|
(scrollGap > 0) && (pScrollVal < scrollGap));
|
|
634
634
|
};
|
|
@@ -657,7 +657,7 @@ Scrollbar.prototype._scrollTo = function (pScrollVal, layoutChanged) {
|
|
|
657
657
|
}
|
|
658
658
|
pScrollVal = this._calcProperScrollValue(pScrollVal);
|
|
659
659
|
|
|
660
|
-
|
|
660
|
+
let dirty = false;
|
|
661
661
|
if(this._pScrollVal !== pScrollVal) {
|
|
662
662
|
this._pScrollVal = pScrollVal; // Fix asynchronous of tracking issue
|
|
663
663
|
dirty = true;
|
|
@@ -686,14 +686,14 @@ Scrollbar.prototype._calcProperScrollValue = function (scrollVal) {
|
|
|
686
686
|
return this._pScrollVal; // Zooming could cause recalculation errors, so we try to snap the value to the end of the scrollbar
|
|
687
687
|
}
|
|
688
688
|
|
|
689
|
-
|
|
689
|
+
let scrollGap = this.getScrollGap();
|
|
690
690
|
if(scrollGap <= 0) { // Scrollbar is disabled or inactive
|
|
691
691
|
return 0;
|
|
692
692
|
} else if(scrollVal + 0.5 >= scrollGap) {
|
|
693
693
|
return scrollGap;
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
-
|
|
696
|
+
let step = this._step;
|
|
697
697
|
if(step) { // Step scrolling
|
|
698
698
|
scrollVal = Math.round(scrollVal / step) * step;
|
|
699
699
|
if(scrollVal - step / 2 <= 0) {
|
|
@@ -712,7 +712,7 @@ Scrollbar.prototype._convertTrackToPane = function (tScrollVal) {
|
|
|
712
712
|
tScrollVal = Math.round(tScrollVal); // tScrollVal may not be an integer due to zooming
|
|
713
713
|
|
|
714
714
|
// Track scroll could be changed due to browser's zoom. We need to avoid unnecessary changes
|
|
715
|
-
|
|
715
|
+
let trackGap = this._getTrackGap();
|
|
716
716
|
if(this._tPercentVal >= 1) {
|
|
717
717
|
if(Math.abs(this._tScrollVal - tScrollVal) <= 5) {
|
|
718
718
|
tScrollVal = trackGap;
|
|
@@ -723,8 +723,8 @@ Scrollbar.prototype._convertTrackToPane = function (tScrollVal) {
|
|
|
723
723
|
this._tPercentVal = trackGap ? tScrollVal / trackGap : 0;
|
|
724
724
|
|
|
725
725
|
// Convert track value to pane value
|
|
726
|
-
|
|
727
|
-
|
|
726
|
+
let paneGap = this.getScrollGap();
|
|
727
|
+
let pScrollVal = (trackGap === paneGap) ? tScrollVal : this._tPercentVal * paneGap;
|
|
728
728
|
return pScrollVal;
|
|
729
729
|
};
|
|
730
730
|
/** @private
|
|
@@ -732,11 +732,11 @@ Scrollbar.prototype._convertTrackToPane = function (tScrollVal) {
|
|
|
732
732
|
* @return {boolean} Return true, if there is any change to track value
|
|
733
733
|
*/
|
|
734
734
|
Scrollbar.prototype._setTrackScrollVal = function(pScrollVal) {
|
|
735
|
-
|
|
736
|
-
|
|
735
|
+
let trackGap = this._getTrackGap();
|
|
736
|
+
let tScrollVal = 0;
|
|
737
737
|
if(trackGap > 0) {
|
|
738
738
|
if(pScrollVal > 0) {
|
|
739
|
-
|
|
739
|
+
let paneGap = this.getScrollGap();
|
|
740
740
|
tScrollVal = (trackGap === paneGap) ? pScrollVal : pScrollVal / paneGap * trackGap;
|
|
741
741
|
tScrollVal = Math.round(tScrollVal); // Avoid calculation error due to fractions from conversion
|
|
742
742
|
}
|
|
@@ -750,7 +750,7 @@ Scrollbar.prototype._setTrackScrollVal = function(pScrollVal) {
|
|
|
750
750
|
this._tPercentVal = trackGap ? tScrollVal / trackGap : 0;
|
|
751
751
|
|
|
752
752
|
// Scroll event will be fired asynchronously, if there is any change
|
|
753
|
-
|
|
753
|
+
let track = this._element;
|
|
754
754
|
if(this._vertical) {
|
|
755
755
|
track.scrollTop = tScrollVal;
|
|
756
756
|
} else {
|
|
@@ -765,7 +765,7 @@ Scrollbar.prototype._setTrackScrollVal = function(pScrollVal) {
|
|
|
765
765
|
* @return {number}
|
|
766
766
|
*/
|
|
767
767
|
Scrollbar.prototype._getTrackGap = function () {
|
|
768
|
-
|
|
768
|
+
let trackGap = this._tContentSize - this.getTrackSize();
|
|
769
769
|
return trackGap > 0 ? trackGap : 0;
|
|
770
770
|
};
|
|
771
771
|
|
|
@@ -823,11 +823,11 @@ Scrollbar.prototype._flash = function () {
|
|
|
823
823
|
* @ignore
|
|
824
824
|
*/
|
|
825
825
|
Scrollbar.prototype._clearAllPanes = function() {
|
|
826
|
-
for (
|
|
826
|
+
for (let i = this._panes.length; --i >= 0; ) {
|
|
827
827
|
this._panes[i].setParent(null);
|
|
828
|
-
|
|
828
|
+
let paneSlider = this._paneSliders[i];
|
|
829
829
|
paneSlider._content = paneSlider._columns = null;
|
|
830
|
-
|
|
830
|
+
let elem = paneSlider.getElement();
|
|
831
831
|
while (elem.firstChild !== null) {
|
|
832
832
|
elem.removeChild(elem.firstChild);
|
|
833
833
|
}
|
|
@@ -903,7 +903,7 @@ Scrollbar.prototype.setFooterCount = function(num){
|
|
|
903
903
|
Scrollbar.prototype._calcActiveState = function () {
|
|
904
904
|
if(this._enabled) {
|
|
905
905
|
if(this.getTrackSize() > 20) {
|
|
906
|
-
|
|
906
|
+
let paneSize = this.getPaneSize();
|
|
907
907
|
if(paneSize > 0) {
|
|
908
908
|
return (this._pContentSize - paneSize > 0);
|
|
909
909
|
}
|
|
@@ -914,7 +914,7 @@ Scrollbar.prototype._calcActiveState = function () {
|
|
|
914
914
|
/** @private
|
|
915
915
|
*/
|
|
916
916
|
Scrollbar.prototype._updateLayout = function () {
|
|
917
|
-
|
|
917
|
+
let active = this._calcActiveState();
|
|
918
918
|
if(active !== this._active) {
|
|
919
919
|
this._active = active;
|
|
920
920
|
this._onActiveStateChange();
|
|
@@ -923,8 +923,8 @@ Scrollbar.prototype._updateLayout = function () {
|
|
|
923
923
|
return;
|
|
924
924
|
}
|
|
925
925
|
|
|
926
|
-
|
|
927
|
-
|
|
926
|
+
let trackSize = this.getTrackSize();
|
|
927
|
+
let paneSize = this.getPaneSize();
|
|
928
928
|
this._tContentSize = this._pContentSize / paneSize * trackSize;
|
|
929
929
|
if (this._vertical) {
|
|
930
930
|
this._trackContent.style.height = this._tContentSize + "px";
|
|
@@ -935,7 +935,7 @@ Scrollbar.prototype._updateLayout = function () {
|
|
|
935
935
|
this._trackContent.style.width = this._tContentSize + "px";
|
|
936
936
|
|
|
937
937
|
this._element.style.width = trackSize + "px";
|
|
938
|
-
for (
|
|
938
|
+
for (let i = this._panes.length; --i >= 0;) {
|
|
939
939
|
this._panes[i].setWidth(paneSize);
|
|
940
940
|
}
|
|
941
941
|
}
|
|
@@ -948,8 +948,8 @@ Scrollbar.prototype._updateLayout = function () {
|
|
|
948
948
|
* @ignore
|
|
949
949
|
*/
|
|
950
950
|
Scrollbar.prototype.resetPaneSize = function () {
|
|
951
|
-
|
|
952
|
-
for (
|
|
951
|
+
let prop = (this._vertical) ? "height" : "width";
|
|
952
|
+
for (let i = this._panes.length; --i >= 0;) {
|
|
953
953
|
this._panes[i].setStyle(prop, "");
|
|
954
954
|
}
|
|
955
955
|
};
|
|
@@ -977,7 +977,7 @@ Scrollbar.prototype._addPaneAt = function (opt_at) {
|
|
|
977
977
|
opt_at = this._panes.length;
|
|
978
978
|
}
|
|
979
979
|
|
|
980
|
-
|
|
980
|
+
let pane = this._panes[opt_at];
|
|
981
981
|
if(!pane) {
|
|
982
982
|
pane = new ElementWrapper(document.createElement("div"));
|
|
983
983
|
pane.setClass("grid-pane");
|
|
@@ -992,7 +992,7 @@ Scrollbar.prototype._addPaneAt = function (opt_at) {
|
|
|
992
992
|
pane.addClass("scroll-disabled");
|
|
993
993
|
}
|
|
994
994
|
if(this._paneSize && this._active) {
|
|
995
|
-
|
|
995
|
+
let paneSize = this.getPaneSize();
|
|
996
996
|
if(this._vertical) {
|
|
997
997
|
pane.setHeight(paneSize);
|
|
998
998
|
} else {
|
|
@@ -1004,7 +1004,7 @@ Scrollbar.prototype._addPaneAt = function (opt_at) {
|
|
|
1004
1004
|
pane.listen("touchend", this._onTouchEnd);
|
|
1005
1005
|
pane.listen("touchcancel", this._onTouchEnd);
|
|
1006
1006
|
|
|
1007
|
-
|
|
1007
|
+
let paneSlider = new ElementWrapper(document.createElement("div"));
|
|
1008
1008
|
paneSlider.setClass("grid-pane-slider");
|
|
1009
1009
|
paneSlider.setParent(pane);
|
|
1010
1010
|
|
|
@@ -1034,9 +1034,9 @@ Scrollbar.prototype._onStartFading = function (e) {
|
|
|
1034
1034
|
* @param {Object} e
|
|
1035
1035
|
*/
|
|
1036
1036
|
Scrollbar.prototype._onTrackScroll = function (e) {
|
|
1037
|
-
|
|
1037
|
+
let tScrollVal = (this._vertical) ? e.target["scrollTop"] : e.target["scrollLeft"];
|
|
1038
1038
|
|
|
1039
|
-
|
|
1039
|
+
let pScrollVal = this._convertTrackToPane(tScrollVal);
|
|
1040
1040
|
|
|
1041
1041
|
pScrollVal = this._calcProperScrollValue(pScrollVal);
|
|
1042
1042
|
|
|
@@ -1056,9 +1056,9 @@ Scrollbar.prototype._onRestingPosition = function () {
|
|
|
1056
1056
|
* @param {boolean=} resting
|
|
1057
1057
|
*/
|
|
1058
1058
|
Scrollbar.prototype._setSliderPosition = function (scrollVal, resting) {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1059
|
+
let translateStr = "";
|
|
1060
|
+
let relativeStr = "";
|
|
1061
|
+
let direction = this._vertical ? "top" : "left";
|
|
1062
1062
|
if(scrollVal) {
|
|
1063
1063
|
if(resting) {
|
|
1064
1064
|
relativeStr = scrollVal + "px";
|
|
@@ -1068,9 +1068,9 @@ Scrollbar.prototype._setSliderPosition = function (scrollVal, resting) {
|
|
|
1068
1068
|
this._reverter.start();
|
|
1069
1069
|
}
|
|
1070
1070
|
}
|
|
1071
|
-
for (
|
|
1072
|
-
|
|
1073
|
-
|
|
1071
|
+
for (let i = this._paneSliders.length; --i >= 0; ) {
|
|
1072
|
+
let paneSlider = this._paneSliders[i];
|
|
1073
|
+
let paneSliderStyle = paneSlider.getElement().style;
|
|
1074
1074
|
if(paneSlider._titleSection) {
|
|
1075
1075
|
paneSliderStyle[direction] = scrollVal + "px";
|
|
1076
1076
|
} else {
|
|
@@ -1095,7 +1095,7 @@ Scrollbar.prototype._dispatchScrollEvent = function (e) {
|
|
|
1095
1095
|
// Fire scroll event synchronously
|
|
1096
1096
|
if(!this._isEventDispatching("scroll")) { // VScrollbar may change scroll value
|
|
1097
1097
|
if(!e) {
|
|
1098
|
-
|
|
1098
|
+
let target = this._element;
|
|
1099
1099
|
e = {
|
|
1100
1100
|
"currentTarget": target,
|
|
1101
1101
|
"srcElement": target,
|
|
@@ -1122,7 +1122,7 @@ Scrollbar.prototype._onKeyDown = function (e) {
|
|
|
1122
1122
|
}
|
|
1123
1123
|
if (!this._active) { return; }
|
|
1124
1124
|
|
|
1125
|
-
|
|
1125
|
+
let isArrow = false;
|
|
1126
1126
|
if(this._vertical) {
|
|
1127
1127
|
isArrow = (e.keyCode === 38 || e.keyCode === 40);
|
|
1128
1128
|
} else {
|
|
@@ -1130,8 +1130,8 @@ Scrollbar.prototype._onKeyDown = function (e) {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
1132
|
if(isArrow) {
|
|
1133
|
-
|
|
1134
|
-
|
|
1133
|
+
let scrollGap = this.getScrollGap();
|
|
1134
|
+
let scrollVal = Math.round(scrollGap * 0.07);
|
|
1135
1135
|
if(scrollVal < 10) {
|
|
1136
1136
|
scrollVal = 10;
|
|
1137
1137
|
} else if(scrollVal > 100) {
|
|
@@ -1173,7 +1173,7 @@ Scrollbar.prototype._onTouchStart = function (e) {
|
|
|
1173
1173
|
* @param {Event} e
|
|
1174
1174
|
*/
|
|
1175
1175
|
Scrollbar.prototype._onTouchMove = function (e) {
|
|
1176
|
-
|
|
1176
|
+
let t = this;
|
|
1177
1177
|
|
|
1178
1178
|
if (t._isFrozen) {
|
|
1179
1179
|
Util._preventDefault(e);
|
|
@@ -1188,10 +1188,10 @@ Scrollbar.prototype._onTouchMove = function (e) {
|
|
|
1188
1188
|
return;
|
|
1189
1189
|
}
|
|
1190
1190
|
|
|
1191
|
-
|
|
1192
|
-
|
|
1191
|
+
let sp = t._startPos;
|
|
1192
|
+
let ep = t._endPos;
|
|
1193
1193
|
t._getTouchInfo(e, ep);
|
|
1194
|
-
|
|
1194
|
+
let diff = (this._vertical) ? sp["y"] - ep["y"] : sp["x"] - ep["x"];
|
|
1195
1195
|
|
|
1196
1196
|
if(diff > -5 && diff < 5) {
|
|
1197
1197
|
return;
|
|
@@ -1202,7 +1202,7 @@ Scrollbar.prototype._onTouchMove = function (e) {
|
|
|
1202
1202
|
if(t._touchDrag) {
|
|
1203
1203
|
t._scrollTo(sp["scrollValue"] + diff);
|
|
1204
1204
|
} else {
|
|
1205
|
-
|
|
1205
|
+
let duration = ep["timeStamp"] - sp["timeStamp"];
|
|
1206
1206
|
if(duration > 30) {
|
|
1207
1207
|
t._touchDrag = true;
|
|
1208
1208
|
}
|
|
@@ -1229,10 +1229,10 @@ Scrollbar.prototype._onTouchEnd = function (e) {
|
|
|
1229
1229
|
}
|
|
1230
1230
|
|
|
1231
1231
|
if(this._smoothing && !this._smoothingId) {
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1232
|
+
let sp = this._startPos;
|
|
1233
|
+
let ep = this._getTouchInfo(e, this._endPos);
|
|
1234
|
+
let duration = ep["timeStamp"] - sp["timeStamp"];
|
|
1235
|
+
let diff = (this._vertical) ? (sp["y"] - ep["y"]) : (sp["x"] - ep["x"]);
|
|
1236
1236
|
this._smoothingSpeed = diff * 30 / duration; // pixel per milliseconds
|
|
1237
1237
|
if(this._smoothingSpeed > 10 || this._smoothingSpeed < -10) {
|
|
1238
1238
|
this._smoothingId = setInterval(this._smoothScroll, 25);
|
|
@@ -1246,7 +1246,7 @@ Scrollbar.prototype._onTouchEnd = function (e) {
|
|
|
1246
1246
|
* @return {!Object}
|
|
1247
1247
|
*/
|
|
1248
1248
|
Scrollbar.prototype._getTouchInfo = function(e, obj) {
|
|
1249
|
-
|
|
1249
|
+
let touch = e.changedTouches[0];
|
|
1250
1250
|
if(!obj) {
|
|
1251
1251
|
obj = {};
|
|
1252
1252
|
}
|
|
@@ -1259,7 +1259,7 @@ Scrollbar.prototype._getTouchInfo = function(e, obj) {
|
|
|
1259
1259
|
/** @private
|
|
1260
1260
|
*/
|
|
1261
1261
|
Scrollbar.prototype._smoothScroll = function() {
|
|
1262
|
-
|
|
1262
|
+
let ss = this._smoothingSpeed;
|
|
1263
1263
|
ss = (ss * 0.9) | 0; // OR operator is not equivalent to Math.floor()
|
|
1264
1264
|
this._smoothingSpeed = ss;
|
|
1265
1265
|
if(ss > 1 || ss < -1) {
|
|
@@ -1348,7 +1348,7 @@ Scrollbar.prototype._onMouseWheel = function (e) {
|
|
|
1348
1348
|
if(e.ctrlKey || e.altKey ) { return; }
|
|
1349
1349
|
if (!this.isActive()) { return; }
|
|
1350
1350
|
|
|
1351
|
-
|
|
1351
|
+
let delta = (this._vertical) ? e["deltaY"] : e["deltaX"];
|
|
1352
1352
|
|
|
1353
1353
|
if(!delta) { return; }
|
|
1354
1354
|
|
|
@@ -1365,7 +1365,7 @@ Scrollbar.prototype._onMouseWheel = function (e) {
|
|
|
1365
1365
|
}
|
|
1366
1366
|
|
|
1367
1367
|
if(this._wheelScrolling != "linear") {
|
|
1368
|
-
|
|
1368
|
+
let scrollSize = this.getContentSize();
|
|
1369
1369
|
if(scrollSize >= 4000) { // Scaling for large content
|
|
1370
1370
|
delta *= 1 + scrollSize / 4000 | 0; // If scrollSize == 4000, delta *= 2. If scrollSize == 8000, delta *= 3
|
|
1371
1371
|
}
|
|
@@ -1387,7 +1387,7 @@ Scrollbar.prototype.setScrollingStep = function (px) {
|
|
|
1387
1387
|
* @return {boolean} return previous frozen status
|
|
1388
1388
|
*/
|
|
1389
1389
|
Scrollbar.prototype.freezeScrolling = function (frozen) {
|
|
1390
|
-
|
|
1390
|
+
let prev = this._isFrozen;
|
|
1391
1391
|
this._isFrozen = frozen !== false;
|
|
1392
1392
|
return prev;
|
|
1393
1393
|
};
|
|
@@ -1395,7 +1395,7 @@ Scrollbar.prototype.freezeScrolling = function (frozen) {
|
|
|
1395
1395
|
*/
|
|
1396
1396
|
Scrollbar.prototype.restoreTrackPosition = function () {
|
|
1397
1397
|
// Scroll event will be fired asynchronously, if there is any change
|
|
1398
|
-
|
|
1398
|
+
let track = this._element;
|
|
1399
1399
|
if(this._vertical) {
|
|
1400
1400
|
track.scrollTop = this._tScrollVal;
|
|
1401
1401
|
if(track.scrollTop){
|