@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
|
@@ -9,7 +9,7 @@ import { Dom } from "./Dom.js";
|
|
|
9
9
|
* @private
|
|
10
10
|
* @const
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
let GridElements = {
|
|
13
13
|
"EFX-GRID": 1,
|
|
14
14
|
"ATLAS-BLOTTER": 1,
|
|
15
15
|
"EF-GRID": 1
|
|
@@ -18,7 +18,7 @@ var GridElements = {
|
|
|
18
18
|
* @private
|
|
19
19
|
* @const
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
let InvalidHostElements = {
|
|
22
22
|
"BODY": 1,
|
|
23
23
|
"HTML": 1,
|
|
24
24
|
"EFX-GRID": 1,
|
|
@@ -30,16 +30,16 @@ var InvalidHostElements = {
|
|
|
30
30
|
* @param {Object} instance
|
|
31
31
|
* @return {Object}
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
let _cloneInstance = function (instance) {
|
|
34
34
|
return new instance.constructor();
|
|
35
35
|
};
|
|
36
36
|
/** @private
|
|
37
37
|
* @param {number} num
|
|
38
38
|
* @return {!Array.<Object>}
|
|
39
39
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
for(
|
|
40
|
+
let _newArrayOfObject = function (num) {
|
|
41
|
+
let ary = new Array(num);
|
|
42
|
+
for(let i = 0; i < num; ++i) {
|
|
43
43
|
ary[i] = {};
|
|
44
44
|
}
|
|
45
45
|
return ary;
|
|
@@ -48,12 +48,12 @@ var _newArrayOfObject = function (num) {
|
|
|
48
48
|
* @param {Element} elem
|
|
49
49
|
* @param {boolean=} bool
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
let _toggleInlineElement = function (elem, bool) {
|
|
52
52
|
if(!elem || elem.style.display === "none") {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
let s = elem.style;
|
|
57
57
|
if(bool == null) {
|
|
58
58
|
bool = s.display !== "inline-block";
|
|
59
59
|
}
|
|
@@ -69,7 +69,7 @@ var _toggleInlineElement = function (elem, bool) {
|
|
|
69
69
|
/** @constructor
|
|
70
70
|
* @param {Element} gridElem
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
let MultiTableManager = function (gridElem) {
|
|
73
73
|
this._onDelayedConfiguration = this._onDelayedConfiguration.bind(this);
|
|
74
74
|
this._onConfiguration = this._onConfiguration.bind(this);
|
|
75
75
|
this._onWrapCountChanged = this._onWrapCountChanged.bind(this);
|
|
@@ -130,7 +130,7 @@ MultiTableManager.synchronizeVScrollbar = function(vScrollbarHost, hScrollbarHos
|
|
|
130
130
|
return Promise.reject("Host element cannot be body element.");
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
let gridLen = 0;
|
|
134
134
|
if(gridElems) {
|
|
135
135
|
if(GridElements[gridElems.tagName]) { // Accept single grid element as a parameter
|
|
136
136
|
gridElems = [gridElems];
|
|
@@ -139,8 +139,8 @@ MultiTableManager.synchronizeVScrollbar = function(vScrollbarHost, hScrollbarHos
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
// Element validation
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
let i, gridElem;
|
|
143
|
+
let validatedElems = [];
|
|
144
144
|
for(i = 0; i < gridLen; ++i) {
|
|
145
145
|
gridElem = gridElems[i];
|
|
146
146
|
if(gridElem && GridElements[gridElem.tagName]) {
|
|
@@ -152,13 +152,13 @@ MultiTableManager.synchronizeVScrollbar = function(vScrollbarHost, hScrollbarHos
|
|
|
152
152
|
return Promise.reject("No grid element detected for scrollbar synchronization.");
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
let promises = [];
|
|
156
156
|
for(i = 0; i < gridLen; ++i) {
|
|
157
157
|
gridElem = validatedElems[i];
|
|
158
158
|
if(gridElem.api) {
|
|
159
159
|
promises.push(Promise.resolve(gridElem));
|
|
160
160
|
} else {
|
|
161
|
-
|
|
161
|
+
let deferredConfig = gridElem._deferredConfig;
|
|
162
162
|
if(!deferredConfig) {
|
|
163
163
|
deferredConfig = gridElem._deferredConfig = new Deferred();
|
|
164
164
|
gridElem.addEventListener("configured", MultiTableManager._onGridConfigured);
|
|
@@ -175,10 +175,10 @@ MultiTableManager.synchronizeVScrollbar = function(vScrollbarHost, hScrollbarHos
|
|
|
175
175
|
* @param {Object} e
|
|
176
176
|
*/
|
|
177
177
|
MultiTableManager._onGridConfigured = function(e) {
|
|
178
|
-
|
|
178
|
+
let gridElem = e.currentTarget;
|
|
179
179
|
gridElem.removeEventListener("configured", MultiTableManager._onGridConfigured);
|
|
180
180
|
if(gridElem._deferredConfig) {
|
|
181
|
-
|
|
181
|
+
let d = gridElem._deferredConfig;
|
|
182
182
|
gridElem._deferredConfig = null;
|
|
183
183
|
d.resolve(gridElem);
|
|
184
184
|
}
|
|
@@ -199,11 +199,11 @@ MultiTableManager._onVScrollbarSynchronization = function(vScrollbarHost, hScrol
|
|
|
199
199
|
hScrollbarHost.style.whiteSpace = "nowrap";
|
|
200
200
|
hScrollbarHost.style.overflow = "auto hidden";
|
|
201
201
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
for(
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
let gridLen = gridElems.length;
|
|
203
|
+
let mainCore = gridElems[0].api.getCoreGrid();
|
|
204
|
+
for(let i = 0; i < gridLen; ++i) {
|
|
205
|
+
let gridElem = gridElems[i];
|
|
206
|
+
let core = gridElem.api.getCoreGrid();
|
|
207
207
|
|
|
208
208
|
_toggleInlineElement(gridElem, true);
|
|
209
209
|
if(i > 0) {
|
|
@@ -231,7 +231,7 @@ MultiTableManager.prototype.setGridConfig = function (configObj) {
|
|
|
231
231
|
}
|
|
232
232
|
this._extensions = configObj.extensions ? configObj.extensions.slice() : [];
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
let main = this._tables[0];
|
|
235
235
|
if(main) {
|
|
236
236
|
configObj = this._cloneConfig();
|
|
237
237
|
main.addEventListener("configured", this._onDelayedConfiguration);
|
|
@@ -266,8 +266,8 @@ MultiTableManager.prototype._onConfiguration = function () {
|
|
|
266
266
|
/** @public
|
|
267
267
|
*/
|
|
268
268
|
MultiTableManager.prototype.dispose = function () {
|
|
269
|
-
|
|
270
|
-
for(
|
|
269
|
+
let len = this._tables.length;
|
|
270
|
+
for(let i = 0; i < len; ++i) {
|
|
271
271
|
this._tables[i].dispose();
|
|
272
272
|
}
|
|
273
273
|
this._tables = [];
|
|
@@ -280,11 +280,11 @@ MultiTableManager.prototype.dispose = function () {
|
|
|
280
280
|
* @return {!Object}
|
|
281
281
|
*/
|
|
282
282
|
MultiTableManager.prototype._cloneConfig = function () {
|
|
283
|
-
|
|
283
|
+
let obj = null;
|
|
284
284
|
if(this._configObj) {
|
|
285
285
|
obj = cloneObject(this._configObj);
|
|
286
286
|
if(Array.isArray(obj.columns)) {
|
|
287
|
-
|
|
287
|
+
let runtimeConfig = this._tables[0].api ? this._tables[0].api.getConfigObject() : this._configObj;
|
|
288
288
|
obj.columns = runtimeConfig.columns.slice();
|
|
289
289
|
}
|
|
290
290
|
}
|
|
@@ -304,7 +304,7 @@ MultiTableManager.prototype._setTableCount = function(num) {
|
|
|
304
304
|
this._tableCount = num > 0 ? num : 1;
|
|
305
305
|
|
|
306
306
|
if(this._ready) {
|
|
307
|
-
|
|
307
|
+
let tableCount = this._tables.length;
|
|
308
308
|
if(this._tableCount > tableCount) {
|
|
309
309
|
this._addTables(this._tableCount - tableCount);
|
|
310
310
|
} else if(this._tableCount < tableCount) {
|
|
@@ -328,15 +328,15 @@ MultiTableManager.prototype.setTableCount = function(num) {
|
|
|
328
328
|
* @return {Element}
|
|
329
329
|
*/
|
|
330
330
|
MultiTableManager.prototype._addTable = function(tableIndex) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
//
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
331
|
+
let main = this._tables[0];
|
|
332
|
+
let parentElem = main.parentNode;
|
|
333
|
+
let core = main.api.getCoreGrid();
|
|
334
|
+
let mainDataView = main.api.getDataView();
|
|
335
|
+
// let mainDataTable = main.api.getDataTable();
|
|
336
|
+
let stp = core.getPlugin("SortableTitlePlugin");
|
|
337
|
+
let dtp = core.getPlugin("DragAndDropTitlePlugin");
|
|
338
|
+
|
|
339
|
+
let configObj = this._cloneConfig();
|
|
340
340
|
configObj.extensions = this._generateExtensions();
|
|
341
341
|
|
|
342
342
|
delete configObj.staticDataRows;
|
|
@@ -344,15 +344,15 @@ MultiTableManager.prototype._addTable = function(tableIndex) {
|
|
|
344
344
|
delete configObj.dataModel;
|
|
345
345
|
|
|
346
346
|
if(this._wrapSize) {
|
|
347
|
-
|
|
347
|
+
let wrappedViews = mainDataView.getWrappedViews();
|
|
348
348
|
configObj.dataView = wrappedViews[tableIndex - 1];
|
|
349
349
|
configObj.grid = main.api;
|
|
350
350
|
} else {
|
|
351
351
|
configObj["SortableTitle"] = stp;
|
|
352
352
|
configObj["DragAndDropTitle"] = dtp;
|
|
353
|
-
|
|
353
|
+
let rowCount = mainDataView.getRowCount();
|
|
354
354
|
|
|
355
|
-
|
|
355
|
+
let ary = _newArrayOfObject(rowCount);
|
|
356
356
|
if(this._emeraldGrid) {
|
|
357
357
|
configObj.dataModel = {
|
|
358
358
|
data: ary
|
|
@@ -362,12 +362,12 @@ MultiTableManager.prototype._addTable = function(tableIndex) {
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
|
|
365
|
+
let sub = document.createElement(main.tagName);
|
|
366
366
|
_toggleInlineElement(sub, true);
|
|
367
367
|
|
|
368
368
|
sub.config = configObj;
|
|
369
369
|
|
|
370
|
-
|
|
370
|
+
let lastTable = this._tables[this._tables.length - 1];
|
|
371
371
|
parentElem.insertBefore(sub, lastTable.nextSibling);
|
|
372
372
|
return sub;
|
|
373
373
|
};
|
|
@@ -380,13 +380,13 @@ MultiTableManager.prototype._addTables = function(num) {
|
|
|
380
380
|
return;
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
|
|
383
|
+
let main = this._tables[0];
|
|
384
384
|
_toggleInlineElement(main, true); // TODO: Check if we need to do this every time
|
|
385
385
|
|
|
386
386
|
// main.api.setFitContentWidth(true);
|
|
387
387
|
|
|
388
|
-
for(
|
|
389
|
-
|
|
388
|
+
for(let i = 0; i < num; ++i) {
|
|
389
|
+
let grid = this._addTable(this._tables.length);
|
|
390
390
|
this._tables.push(grid);
|
|
391
391
|
}
|
|
392
392
|
|
|
@@ -405,15 +405,15 @@ MultiTableManager.prototype._addTables = function(num) {
|
|
|
405
405
|
* @param {number} num
|
|
406
406
|
*/
|
|
407
407
|
MultiTableManager.prototype._removeTables = function(num) {
|
|
408
|
-
|
|
408
|
+
let tableCount = this._tables.length;
|
|
409
409
|
if (tableCount - num < 1) {
|
|
410
410
|
num = tableCount - 1;
|
|
411
411
|
}
|
|
412
412
|
if(!num) {
|
|
413
413
|
return;
|
|
414
414
|
}
|
|
415
|
-
for(
|
|
416
|
-
|
|
415
|
+
for(let i = 0; i < num; ++i) {
|
|
416
|
+
let sub = this._tables.pop();
|
|
417
417
|
sub.config = null;
|
|
418
418
|
if(sub.parentNode) {
|
|
419
419
|
sub.parentNode.removeChild(sub);
|
|
@@ -433,7 +433,7 @@ MultiTableManager.prototype._wrapTable = function(rowCount) {
|
|
|
433
433
|
this._wrapSize = rowCount > 0 ? rowCount : 0;
|
|
434
434
|
|
|
435
435
|
if(this._ready) {
|
|
436
|
-
|
|
436
|
+
let main = this._tables[0];
|
|
437
437
|
if(this._wrapSize) {
|
|
438
438
|
main.style.display = "none";
|
|
439
439
|
main.api.getCoreGrid().getVScrollbar().disable();
|
|
@@ -443,7 +443,7 @@ MultiTableManager.prototype._wrapTable = function(rowCount) {
|
|
|
443
443
|
main.api.getCoreGrid().getVScrollbar().disable(false);
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
|
|
446
|
+
let dv = main.api.getDataView();
|
|
447
447
|
dv.listen("wrapCountChanged", this._onWrapCountChanged);
|
|
448
448
|
dv.wrapView(this._wrapSize);
|
|
449
449
|
}
|
|
@@ -490,10 +490,10 @@ MultiTableManager.prototype.getTable = function(at) {
|
|
|
490
490
|
* @return {!Array}
|
|
491
491
|
*/
|
|
492
492
|
MultiTableManager.prototype._generateExtensions = function() {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
for(
|
|
496
|
-
|
|
493
|
+
let extCount = this._extensions ? this._extensions.length : 0;
|
|
494
|
+
let ary = new Array(extCount);
|
|
495
|
+
for(let i = 0; i < extCount; ++i) {
|
|
496
|
+
let ext = this._extensions[i];
|
|
497
497
|
if(ext.hasMultiTableSupport && ext.hasMultiTableSupport()) {
|
|
498
498
|
ary[i] = ext;
|
|
499
499
|
} else {
|
|
@@ -507,9 +507,9 @@ MultiTableManager.prototype._generateExtensions = function() {
|
|
|
507
507
|
* @param {...*} args
|
|
508
508
|
*/
|
|
509
509
|
MultiTableManager.prototype._execAll = function(methodName, args) {
|
|
510
|
-
|
|
511
|
-
for(
|
|
512
|
-
|
|
510
|
+
let tableCount = this._tables.length;
|
|
511
|
+
for(let i = 0; i < tableCount; ++i) {
|
|
512
|
+
let tbl = this._tables[i];
|
|
513
513
|
if(args !== undefined) { // eslint-disable-line
|
|
514
514
|
if(arguments.length > 2) {
|
|
515
515
|
tbl.api[methodName].apply(
|
|
@@ -537,9 +537,9 @@ MultiTableManager.prototype.insertRow = function(rowOption, at) {
|
|
|
537
537
|
if(this._wrapSize) {
|
|
538
538
|
this.getTable().api.insertRow(rowOption, at);
|
|
539
539
|
} else {
|
|
540
|
-
|
|
541
|
-
for(
|
|
542
|
-
|
|
540
|
+
let tableCount = this._tables.length;
|
|
541
|
+
for(let i = 0; i < tableCount; ++i) {
|
|
542
|
+
let tbl = this._tables[i];
|
|
543
543
|
tbl.api.insertRow(rowOption, at);
|
|
544
544
|
}
|
|
545
545
|
}
|
|
@@ -558,9 +558,9 @@ MultiTableManager.prototype.removeRow = function(at) {
|
|
|
558
558
|
if(this._wrapSize) {
|
|
559
559
|
this.getTable().api.removeRow(at);
|
|
560
560
|
} else {
|
|
561
|
-
|
|
562
|
-
for(
|
|
563
|
-
|
|
561
|
+
let tableCount = this._tables.length;
|
|
562
|
+
for(let i = 0; i < tableCount; ++i) {
|
|
563
|
+
let tbl = this._tables[i];
|
|
564
564
|
tbl.api.removeRow(at);
|
|
565
565
|
}
|
|
566
566
|
}
|
|
@@ -582,9 +582,9 @@ MultiTableManager.prototype.insertColumn = function(columnOption, idx) {
|
|
|
582
582
|
return; // TODO
|
|
583
583
|
}
|
|
584
584
|
|
|
585
|
-
|
|
586
|
-
for(
|
|
587
|
-
|
|
585
|
+
let tableCount = this._tables.length;
|
|
586
|
+
for(let i = 0; i < tableCount; ++i) {
|
|
587
|
+
let tbl = this._tables[i];
|
|
588
588
|
tbl.api.insertColumn(columnOption, idx);
|
|
589
589
|
}
|
|
590
590
|
};
|
|
@@ -595,9 +595,9 @@ MultiTableManager.prototype.removeColumn = function(colRef) {
|
|
|
595
595
|
if(this._emeraldGrid) {
|
|
596
596
|
return; // TODO
|
|
597
597
|
}
|
|
598
|
-
|
|
599
|
-
for(
|
|
600
|
-
|
|
598
|
+
let tableCount = this._tables.length;
|
|
599
|
+
for(let i = 0; i < tableCount; ++i) {
|
|
600
|
+
let tbl = this._tables[i];
|
|
601
601
|
tbl.api.removeColumn(colRef);
|
|
602
602
|
}
|
|
603
603
|
};
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
* @param {number} num Absolute number
|
|
19
19
|
* @return {number}
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
let _multiplyByHundred = function(num) {
|
|
22
|
+
let intPart = num | 0;
|
|
23
23
|
if(num > intPart) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
let str = num + "";
|
|
25
|
+
let at = str.indexOf(".");
|
|
26
|
+
let fracStr = str.slice(at + 1) + "00";
|
|
27
27
|
return +(str.slice(0, at) + fracStr.slice(0, 2) + "." + fracStr.slice(2));
|
|
28
28
|
}
|
|
29
29
|
return num * 100;
|
|
@@ -33,7 +33,7 @@ var _multiplyByHundred = function(num) {
|
|
|
33
33
|
* @constructor
|
|
34
34
|
* @param {NumberFormatter~Options=} options
|
|
35
35
|
* @example
|
|
36
|
-
*
|
|
36
|
+
* let options = {
|
|
37
37
|
* "precisionEnabled": false, // Default is leaving precision as is
|
|
38
38
|
* "decimalPlaces": 2, // Take effect only precisionEnabled === true
|
|
39
39
|
* "plusSign": false, // Plus sign prefixing
|
|
@@ -42,12 +42,12 @@ var _multiplyByHundred = function(num) {
|
|
|
42
42
|
* "scalingUnit": "", // "b"|"m"
|
|
43
43
|
* "multiplyBy100": false
|
|
44
44
|
*};
|
|
45
|
-
*
|
|
45
|
+
* let nf = new NumberFormatter(options);
|
|
46
46
|
* nf.format(123); // "123"
|
|
47
47
|
* nf.format(-456.789); // "-456.789"
|
|
48
48
|
* nf.getOptions(); // For serialization
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
let NumberFormatter = function (options) {
|
|
51
51
|
this["format"] = this.format = this.format.bind(this);
|
|
52
52
|
|
|
53
53
|
this.init(options);
|
|
@@ -113,10 +113,10 @@ NumberFormatter.prototype.init = function(options) { // deserialize
|
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
let formatType = /** @type{string} */(options["formatType"] || options["type"]);
|
|
117
117
|
|
|
118
118
|
// Note that precision will not be used in scaledValue mode
|
|
119
|
-
|
|
119
|
+
let val = options["precisionEnabled"];
|
|
120
120
|
if(val != null && val !== "") {
|
|
121
121
|
this._precisionEnabled = val ? true : false;
|
|
122
122
|
} else {
|
|
@@ -203,9 +203,9 @@ NumberFormatter.prototype.resetToDefaults = function () {
|
|
|
203
203
|
* NumberFormatter.padDecimalPartWithZeroes("1.000", 2); // "1.000"
|
|
204
204
|
*/
|
|
205
205
|
NumberFormatter.padDecimalPartWithZeroes = function (str, precision) {
|
|
206
|
-
|
|
206
|
+
let dp = str.lastIndexOf(".");
|
|
207
207
|
if (dp >= 0) {
|
|
208
|
-
|
|
208
|
+
let decimalPlace = str.length - dp - 1;
|
|
209
209
|
if (decimalPlace < precision) {
|
|
210
210
|
str += NumberFormatter._zeroes[precision - decimalPlace];
|
|
211
211
|
}
|
|
@@ -240,7 +240,7 @@ NumberFormatter.multiplyByHundred = function (num) {
|
|
|
240
240
|
NumberFormatter.prototype.getOptions = function(options) { // serialize
|
|
241
241
|
if(!options) { options = {}; }
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
let formatType = options["formatType"];
|
|
244
244
|
|
|
245
245
|
if(this._precisionEnabled !== true) {
|
|
246
246
|
options["precisionEnabled"] = this._precisionEnabled; // Default in init
|
|
@@ -259,7 +259,7 @@ NumberFormatter.prototype.getOptions = function(options) { // serialize
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
if(formatType === "scaled" || formatType === "scaledvalue") {
|
|
262
|
-
|
|
262
|
+
let su = "";
|
|
263
263
|
if(this._scaler == "b") {
|
|
264
264
|
su = "billion";
|
|
265
265
|
options["scalingUnit"] = su;
|
|
@@ -295,7 +295,7 @@ NumberFormatter.prototype.format = function(origVal) {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
// Simplify logic by making positive value
|
|
298
|
-
|
|
298
|
+
let val, sign;
|
|
299
299
|
if(origVal >= 0) {
|
|
300
300
|
val = origVal;
|
|
301
301
|
sign = this._plusSignEnabled ? "+" : "";
|
|
@@ -303,7 +303,7 @@ NumberFormatter.prototype.format = function(origVal) {
|
|
|
303
303
|
val = -origVal;
|
|
304
304
|
sign = "-";
|
|
305
305
|
}
|
|
306
|
-
|
|
306
|
+
let scalingMode = this._percentFormatEnabled ? "" : this._scaler; // Percent formatting overwrite scaling mode
|
|
307
307
|
|
|
308
308
|
if(this._multiplyBy100Enabled) {
|
|
309
309
|
if(this._precisionEnabled || scalingMode) {
|
|
@@ -313,7 +313,7 @@ NumberFormatter.prototype.format = function(origVal) {
|
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
let absVal = val;
|
|
317
317
|
// Perform scaling
|
|
318
318
|
if (scalingMode) {
|
|
319
319
|
if (scalingMode === "b" && val < 1e9) {
|
|
@@ -332,7 +332,7 @@ NumberFormatter.prototype.format = function(origVal) {
|
|
|
332
332
|
// Perform rounding
|
|
333
333
|
if (this._precisionEnabled) {
|
|
334
334
|
if (this._precision > 0) {
|
|
335
|
-
|
|
335
|
+
let deno = NumberFormatter._denominator[this._precision];
|
|
336
336
|
val = Math.round(val * deno) / deno;
|
|
337
337
|
} else {
|
|
338
338
|
val = Math.round(val);
|
|
@@ -342,12 +342,12 @@ NumberFormatter.prototype.format = function(origVal) {
|
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
// Convert value to string
|
|
345
|
-
|
|
345
|
+
let str;
|
|
346
346
|
if(val > 0) {
|
|
347
347
|
if(val >= 1e-6) { // Handle high (7 or more digits) precision value
|
|
348
348
|
str = sign + val;
|
|
349
349
|
} else {
|
|
350
|
-
|
|
350
|
+
let fraction = val * 1e7; // Be careful that there are some cases like 1e-7 * 1e6 === 0.099
|
|
351
351
|
str = (fraction / 10) + "";
|
|
352
352
|
str = sign + "0.000000" + str.substr(2);
|
|
353
353
|
}
|
|
@@ -357,7 +357,7 @@ NumberFormatter.prototype.format = function(origVal) {
|
|
|
357
357
|
|
|
358
358
|
// Add separators
|
|
359
359
|
if(this._separatorEnabled && val >= 1e3) {
|
|
360
|
-
|
|
360
|
+
let strs = str.split(".");
|
|
361
361
|
str = strs[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
362
362
|
if(strs.length > 1) {
|
|
363
363
|
str += "." + strs[1];
|
|
@@ -389,7 +389,7 @@ NumberFormatter.prototype.format = function(origVal) {
|
|
|
389
389
|
|
|
390
390
|
/** @public */
|
|
391
391
|
NumberFormatter.prototype.enableDefaultFormat = function() {
|
|
392
|
-
|
|
392
|
+
let t = this;
|
|
393
393
|
t._precisionEnabled = t._separatorEnabled = t._percentSignEnabled = false;
|
|
394
394
|
t._percentFormatEnabled = t._plusSignEnabled = t._multiplyBy100Enabled = false;
|
|
395
395
|
t._scaler = "";
|
|
@@ -17,7 +17,7 @@ import { injectCss, prettifyCss } from "./Util.js";
|
|
|
17
17
|
* @private
|
|
18
18
|
* @const
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
let _alignments = {
|
|
21
21
|
"l": "l",
|
|
22
22
|
"c": "c",
|
|
23
23
|
"r": "r",
|
|
@@ -31,7 +31,7 @@ var _alignments = {
|
|
|
31
31
|
* @param {string|null} str Any string such as l, c, r, L, C, R, left, right, center
|
|
32
32
|
* @return {string} Possible values are l, c, r or empty string
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
let toAlignment = function(str) {
|
|
35
35
|
if(str) {
|
|
36
36
|
return _alignments[str.charAt(0)] || "";
|
|
37
37
|
}
|
|
@@ -43,7 +43,7 @@ var toAlignment = function(str) {
|
|
|
43
43
|
* @param {(Element|null)=} elem Element to be rendered as PercentBar
|
|
44
44
|
* @param {PercentBar~Options=} options
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
let PercentBar = function (elem, options) {
|
|
47
47
|
this._topNode = elem || Dom.div();
|
|
48
48
|
this._topNode._percentBar = this; // HACK: For internal reference by PercentBarRenderer
|
|
49
49
|
this._topNode.classList.add("tr-percent-bar");
|
|
@@ -54,7 +54,7 @@ var PercentBar = function (elem, options) {
|
|
|
54
54
|
|
|
55
55
|
this._txt = Dom.create("span");
|
|
56
56
|
// this._txt.style.textOverflow = "ellipsis";
|
|
57
|
-
|
|
57
|
+
let alignment = "l";
|
|
58
58
|
if(options) {
|
|
59
59
|
if(options.alignment) {
|
|
60
60
|
alignment = options.alignment;
|
|
@@ -67,7 +67,7 @@ var PercentBar = function (elem, options) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// Manage text visibility state
|
|
70
|
-
|
|
70
|
+
let visibilityDirty = 0;
|
|
71
71
|
if(options.textWidth != null) {
|
|
72
72
|
visibilityDirty = 1;
|
|
73
73
|
this.setTextWidth(options.textWidth);
|
|
@@ -240,7 +240,7 @@ PercentBar.prototype.isInvalid = function () {
|
|
|
240
240
|
* @return {boolean} Returns invalidity
|
|
241
241
|
*/
|
|
242
242
|
PercentBar.prototype._checkInvalidity = function () {
|
|
243
|
-
|
|
243
|
+
let invalid = (this._absValue !== this._absValue) || !this._maxValue;
|
|
244
244
|
if(invalid !== this._invalid) {
|
|
245
245
|
this._invalid = invalid;
|
|
246
246
|
this._topNode.style.display = invalid ? "none" : "";
|
|
@@ -253,7 +253,7 @@ PercentBar.prototype._checkInvalidity = function () {
|
|
|
253
253
|
* @param {(string|boolean)=} displayText If a string is specified, it will be shown instead of the default one. If false value is specified, the existing text is left untouched.
|
|
254
254
|
*/
|
|
255
255
|
PercentBar.prototype.setValue = function (value, opt_max, displayText) {
|
|
256
|
-
|
|
256
|
+
let t = this;
|
|
257
257
|
if(value && typeof value !== "number") { // Perform automatic data conversion if value is not a number
|
|
258
258
|
value = +value;
|
|
259
259
|
}
|
|
@@ -304,7 +304,7 @@ PercentBar.prototype.setMax = function (absVal) {
|
|
|
304
304
|
* @return {boolean} Returns true if there is any change.
|
|
305
305
|
*/
|
|
306
306
|
PercentBar.prototype.hideZeroValue = function (hidden) {
|
|
307
|
-
|
|
307
|
+
let bool = hidden !== false;
|
|
308
308
|
if(this._zeroValueHidden !== bool) {
|
|
309
309
|
this._zeroValueHidden = bool;
|
|
310
310
|
if(this._alignment) { // Execute only after the initialization
|
|
@@ -345,7 +345,7 @@ PercentBar.prototype.setText = function (txt) {
|
|
|
345
345
|
* @return {boolean} Returns true if there is any change.
|
|
346
346
|
*/
|
|
347
347
|
PercentBar.prototype.hideText = function (hidden) {
|
|
348
|
-
|
|
348
|
+
let bool = hidden !== false;
|
|
349
349
|
if(this._textHidden !== bool) {
|
|
350
350
|
this._textHidden = bool;
|
|
351
351
|
if(this._alignment) { // Execute only after the initialization
|
|
@@ -377,7 +377,7 @@ PercentBar.prototype.isTextHidden = function () {
|
|
|
377
377
|
* @return {boolean} Return true if there is any change
|
|
378
378
|
*/
|
|
379
379
|
PercentBar.prototype._updateTextVisibility = function () {
|
|
380
|
-
|
|
380
|
+
let textVisibility = !this.isTextHidden();
|
|
381
381
|
if (this._textInDoc !== textVisibility) {
|
|
382
382
|
this._textInDoc = textVisibility;
|
|
383
383
|
if(textVisibility) {
|
|
@@ -410,7 +410,7 @@ PercentBar.prototype._updateTextWidth = function () {
|
|
|
410
410
|
* @param {number|string} width
|
|
411
411
|
*/
|
|
412
412
|
PercentBar.prototype.setTextWidth = function (width) {
|
|
413
|
-
|
|
413
|
+
let txtWidth = "56px"; // Default width
|
|
414
414
|
if(typeof width === "number") {
|
|
415
415
|
txtWidth = (width > 8) ? width + "px" : "0px"; // Default padding is 4 on both sides, so minimum is 8
|
|
416
416
|
} else if(typeof width === "string" && width) {
|
|
@@ -498,7 +498,7 @@ PercentBar.prototype._reorderElements = function () {
|
|
|
498
498
|
* @param {boolean=} opt_enabled
|
|
499
499
|
*/
|
|
500
500
|
PercentBar.prototype.useMovementColor = function (opt_enabled) {
|
|
501
|
-
|
|
501
|
+
let newMovementColor = opt_enabled !== false;
|
|
502
502
|
if(this._movementColor !== newMovementColor) {
|
|
503
503
|
this._movementColor = newMovementColor;
|
|
504
504
|
this.updateBarColor();
|
|
@@ -515,7 +515,7 @@ PercentBar.prototype.setTrackColor = function (color) {
|
|
|
515
515
|
* @param {string=} color
|
|
516
516
|
*/
|
|
517
517
|
PercentBar.prototype.setBarColor = function (color) {
|
|
518
|
-
|
|
518
|
+
let newColor = color || "";
|
|
519
519
|
if(this._barColor !== newColor) {
|
|
520
520
|
this._barColor = newColor;
|
|
521
521
|
this.updateBarColor();
|
|
@@ -537,7 +537,7 @@ PercentBar.prototype.enableTooltip = function (enabled) {
|
|
|
537
537
|
* @param {(string|boolean)=} displayText If a string is specified, it will be shown instead of the default one. If false value is specified, the existing text is left untouched.
|
|
538
538
|
*/
|
|
539
539
|
PercentBar.prototype._updateValue = function (opt_updateVal, displayText) {
|
|
540
|
-
|
|
540
|
+
let t = this;
|
|
541
541
|
if(t._dirtySign) {
|
|
542
542
|
t._dirtySign = false;
|
|
543
543
|
if(t._alignment === "c") {
|
|
@@ -565,7 +565,7 @@ PercentBar.prototype._updateValue = function (opt_updateVal, displayText) {
|
|
|
565
565
|
this._updateTextWidth();
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
|
|
568
|
+
let percent = t._maxValue !== 100 ? t._absValue / t._maxValue * 100 : t._absValue;
|
|
569
569
|
t._bar.style.width = percent + "%";
|
|
570
570
|
if(displayText != null) {
|
|
571
571
|
if(displayText !== false) { // Allow keeping previous text
|
|
@@ -580,7 +580,7 @@ PercentBar.prototype._updateValue = function (opt_updateVal, displayText) {
|
|
|
580
580
|
* @public
|
|
581
581
|
*/
|
|
582
582
|
PercentBar.prototype.updateBarColor = function () {
|
|
583
|
-
|
|
583
|
+
let barColor;
|
|
584
584
|
if(this._barColor) {
|
|
585
585
|
barColor = this._barColor;
|
|
586
586
|
} else if(this._movementColor) {
|
|
@@ -589,7 +589,7 @@ PercentBar.prototype.updateBarColor = function () {
|
|
|
589
589
|
barColor = ElfUtil.themeColors["trackColor"];
|
|
590
590
|
}
|
|
591
591
|
if(barColor) {
|
|
592
|
-
|
|
592
|
+
let barStyle = this._bar.style;
|
|
593
593
|
if(barStyle.backgroundColor !== barColor) {
|
|
594
594
|
barStyle.backgroundColor = barColor;
|
|
595
595
|
}
|