@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
|
@@ -21,15 +21,15 @@ import { SubTable } from "./SubTable.js";
|
|
|
21
21
|
* @param {Element=} elem Element is a place holder element (e.g., div). This should not be a table (tag) element.
|
|
22
22
|
* @param {Table~Options=} options
|
|
23
23
|
* @example
|
|
24
|
-
*
|
|
24
|
+
* let elem = document.getElementById("table_div");
|
|
25
25
|
* // Create a table element with 2 columns and 3 rows inside the given element
|
|
26
|
-
*
|
|
26
|
+
* let tbl = new Table(elem, {colCount: 2, rowCount: 3});
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
let Table = function(elem, options) {
|
|
29
|
+
let t = this;
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
let colCount = 0;
|
|
32
|
+
let rowCount = 0;
|
|
33
33
|
if(elem && elem.nodeType === 1) {
|
|
34
34
|
t._elem = /** @type{Element} */(elem);
|
|
35
35
|
} else {
|
|
@@ -52,7 +52,7 @@ var Table = function(elem, options) {
|
|
|
52
52
|
t._tbody = new SubTable("tbody");
|
|
53
53
|
t._subs = [t._tbody]; // tbody will always be the first item
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
let configObj = null;
|
|
56
56
|
if(options) {
|
|
57
57
|
if(typeof options == "number") {
|
|
58
58
|
colCount = options;
|
|
@@ -146,30 +146,30 @@ Table.prototype.init = function(options) {
|
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
let colWidth = options["colWidth"] || options["cellWidth"];
|
|
150
150
|
if(colWidth) {
|
|
151
151
|
this.setDefaultColumnWidth(colWidth);
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
let rowHeight = options["rowHeight"] || options["cellHeight"];
|
|
154
154
|
if(rowHeight) {
|
|
155
155
|
this.setDefaultRowHeight(rowHeight);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
let colCount = options["colCount"];
|
|
159
159
|
if(colCount) {
|
|
160
160
|
this.setColumnCount(colCount);
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
let rowCount = options["rowCount"];
|
|
163
163
|
if(rowCount) {
|
|
164
164
|
this.setRowCount(rowCount);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
let tableWidth = options["width"] || options["tableWidth"];
|
|
168
168
|
if(tableWidth && this._colCount) { // TODO: Move this to setWidth() method
|
|
169
169
|
this.setDefaultColumnWidth((tableWidth / this._colCount) | 0);
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
let tableHeight = options["height"] || options["tableHeight"];
|
|
173
173
|
if(tableHeight) { // TODO: Move this to setHeight() method
|
|
174
174
|
rowCount = this.getRowCount();
|
|
175
175
|
if(rowCount) {
|
|
@@ -177,7 +177,7 @@ Table.prototype.init = function(options) {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
let header = options["header"];
|
|
181
181
|
if(header != null) {
|
|
182
182
|
if(header) {
|
|
183
183
|
rowCount = (typeof header === "number") ? header : 1;
|
|
@@ -190,7 +190,7 @@ Table.prototype.init = function(options) {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
let footer = options["footer"];
|
|
194
194
|
if(footer != null) {
|
|
195
195
|
if(footer) {
|
|
196
196
|
rowCount = (typeof footer === "number") ? footer : 1;
|
|
@@ -212,23 +212,23 @@ Table.prototype.addColumns = function(count) {
|
|
|
212
212
|
if(count == null) { count = 1; }
|
|
213
213
|
else if(count <= 0) { return null; }
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
let cols = [];
|
|
216
|
+
let c;
|
|
217
217
|
for(c = count; --c >= 0;) {
|
|
218
|
-
|
|
218
|
+
let col = document.createElement("col");
|
|
219
219
|
this._colgroup.appendChild(col);
|
|
220
220
|
cols[c] = col;
|
|
221
221
|
}
|
|
222
222
|
this._colCount += count;
|
|
223
223
|
|
|
224
224
|
if(this._defaultColumnWidth != null) {
|
|
225
|
-
|
|
225
|
+
let minWidth = this._defaultColumnWidth + "px";
|
|
226
226
|
for(c = count; --c >= 0;) {
|
|
227
227
|
cols[c].style.width = minWidth;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
for(
|
|
231
|
+
for(let i = this._subs.length; --i >= 0;) {
|
|
232
232
|
this._subs[i].addColumns(count);
|
|
233
233
|
}
|
|
234
234
|
this._updateTableWidth();
|
|
@@ -247,7 +247,7 @@ Table.prototype.removeColumns = function(opt_count) {
|
|
|
247
247
|
this._colCount -= opt_count;
|
|
248
248
|
Dom.removeChildren(this._colgroup, opt_count);
|
|
249
249
|
|
|
250
|
-
for(
|
|
250
|
+
for(let i = this._subs.length; --i >= 0;) {
|
|
251
251
|
this._subs[i].removeColumns(opt_count);
|
|
252
252
|
}
|
|
253
253
|
this._updateTableWidth();
|
|
@@ -258,7 +258,7 @@ Table.prototype.removeAllColumns = function() {
|
|
|
258
258
|
this._colCount = 0;
|
|
259
259
|
Dom.removeChildren(this._colgroup);
|
|
260
260
|
|
|
261
|
-
for(
|
|
261
|
+
for(let i = this._subs.length; --i >= 0;) {
|
|
262
262
|
this._subs[i].removeAllColumns(); // Removing all column will also remove all rows
|
|
263
263
|
}
|
|
264
264
|
this._updateTableWidth();
|
|
@@ -434,7 +434,7 @@ Table.prototype.setDefaultRowHeight = function(val) {
|
|
|
434
434
|
|
|
435
435
|
this._defaultRowHeight = val;
|
|
436
436
|
|
|
437
|
-
for(
|
|
437
|
+
for(let i = this._subs.length; --i >= 0;) {
|
|
438
438
|
this._subs[i].setDefaultRowHeight(val);
|
|
439
439
|
}
|
|
440
440
|
};
|
|
@@ -445,17 +445,17 @@ Table.prototype.distributeColumnWidth = function() {
|
|
|
445
445
|
if(this._colCount <= 1) {
|
|
446
446
|
return;
|
|
447
447
|
}
|
|
448
|
-
|
|
449
|
-
|
|
448
|
+
let txtRows = this._tbody.getTextContents();
|
|
449
|
+
let rowCount = txtRows.length;
|
|
450
450
|
if(!rowCount) {
|
|
451
451
|
return;
|
|
452
452
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
for(
|
|
453
|
+
let maxWidths = new Array(this._colCount);
|
|
454
|
+
let txtRow = txtRows[0];
|
|
455
|
+
for(let c = 0; c < this._colCount; ++c) {
|
|
456
456
|
maxWidths[c] = txtRow[c].length;
|
|
457
457
|
}
|
|
458
|
-
for(
|
|
458
|
+
for(let r = 1; r < rowCount; ++r) {
|
|
459
459
|
txtRow = txtRows[r];
|
|
460
460
|
for(c = 0; c < this._colCount; ++c) {
|
|
461
461
|
if(maxWidths[c] < txtRow[c].length) {
|
|
@@ -463,8 +463,8 @@ Table.prototype.distributeColumnWidth = function() {
|
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
|
|
467
|
-
|
|
466
|
+
let longestColumn = 0;
|
|
467
|
+
let maxWidth = maxWidths[0];
|
|
468
468
|
for(c = this._colCount; --c >= 1;) {
|
|
469
469
|
if(maxWidth < maxWidths[c]) {
|
|
470
470
|
maxWidth = maxWidths[c];
|
|
@@ -482,21 +482,21 @@ Table.prototype.distributeColumnWidth = function() {
|
|
|
482
482
|
* @param {number=} opt_rowLimit
|
|
483
483
|
*/
|
|
484
484
|
Table.prototype.log = function(opt_rowLimit) {
|
|
485
|
-
|
|
486
|
-
|
|
485
|
+
let trs = this.getRows();
|
|
486
|
+
let rowCount = trs.length;
|
|
487
487
|
if(!opt_rowLimit || opt_rowLimit <= 0) { opt_rowLimit = rowCount; }
|
|
488
488
|
|
|
489
|
-
|
|
490
|
-
|
|
489
|
+
let c;
|
|
490
|
+
let colNames = new Array(this._colCount);
|
|
491
491
|
for(c = 0; c < this._colCount; ++c) {
|
|
492
|
-
|
|
493
|
-
|
|
492
|
+
let hCell = this.getHeaderCell(c, 0);
|
|
493
|
+
let hStr = hCell ? hCell.textContent : "";
|
|
494
494
|
colNames[c] = hStr || ("" + c);
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
|
|
498
|
-
for(
|
|
499
|
-
|
|
497
|
+
let rows = [];
|
|
498
|
+
for(let r = 0; r < rowCount; ++r) {
|
|
499
|
+
let cols = {};
|
|
500
500
|
for(c = 0; c < this._colCount; ++c) {
|
|
501
501
|
cols[colNames[c]] = trs[r].cells[c].textContent;
|
|
502
502
|
}
|
|
@@ -680,7 +680,7 @@ Table.prototype.cloak = function(tblElem) {
|
|
|
680
680
|
this._elem.classList.add("js-table");
|
|
681
681
|
|
|
682
682
|
this._table = tblElem;
|
|
683
|
-
|
|
683
|
+
let elems = tblElem.getElementsByTagName("COLGROUP");
|
|
684
684
|
this._colgroup = (elems[0]) ? elems[0] : document.createElement("colgroup");
|
|
685
685
|
|
|
686
686
|
elems = tblElem.getElementsByTagName("TR");
|
|
@@ -725,7 +725,7 @@ Table.prototype.getFooter = function() {
|
|
|
725
725
|
* @param {Element=} elem
|
|
726
726
|
*/
|
|
727
727
|
Table.prototype._addHeader = function(elem) {
|
|
728
|
-
|
|
728
|
+
let t = this;
|
|
729
729
|
if(!t._thead) {
|
|
730
730
|
t._thead = new SubTable(elem ? elem : "thead");
|
|
731
731
|
t._subs.push(t._thead);
|
|
@@ -741,7 +741,7 @@ Table.prototype._addHeader = function(elem) {
|
|
|
741
741
|
* @param {Element=} elem
|
|
742
742
|
*/
|
|
743
743
|
Table.prototype._addFooter = function(elem) {
|
|
744
|
-
|
|
744
|
+
let t = this;
|
|
745
745
|
if(!t._tfoot) {
|
|
746
746
|
t._tfoot = new SubTable(elem ? elem : "tfoot");
|
|
747
747
|
t._subs.push(t._tfoot);
|
|
@@ -762,11 +762,11 @@ Table.prototype._addFooter = function(elem) {
|
|
|
762
762
|
*/
|
|
763
763
|
Table.prototype._setColStyle = function(prop, val, opt_at) {
|
|
764
764
|
if(val == null) { val = ""; }
|
|
765
|
-
|
|
765
|
+
let c, col;
|
|
766
766
|
if(val instanceof Array) {
|
|
767
|
-
|
|
767
|
+
let count = (val.length < this._colCount) ? val.length : this._colCount;
|
|
768
768
|
for(c = count; --c >= 0;) {
|
|
769
|
-
|
|
769
|
+
let str = val[c];
|
|
770
770
|
if(typeof str === "number") { str = str + "px"; }
|
|
771
771
|
if(str) {
|
|
772
772
|
col = this._colgroup.children[c];
|
|
@@ -792,11 +792,11 @@ Table.prototype._setColStyle = function(prop, val, opt_at) {
|
|
|
792
792
|
Table.prototype._updateTableWidth = function() {
|
|
793
793
|
if(!this._autoWidthUpdate) { return; }
|
|
794
794
|
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
for(
|
|
798
|
-
|
|
799
|
-
|
|
795
|
+
let fixedWidth = true;
|
|
796
|
+
let totalWidth = 0;
|
|
797
|
+
for(let c = this._colCount; --c >= 0;) {
|
|
798
|
+
let col = this._colgroup.children[c];
|
|
799
|
+
let str = col.style.width;
|
|
800
800
|
if(!str) {
|
|
801
801
|
fixedWidth = false;
|
|
802
802
|
break;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Dom} from './Dom.js';
|
|
2
2
|
|
|
3
3
|
/** @namespace */
|
|
4
|
-
|
|
4
|
+
let TextHighlighter = {};
|
|
5
5
|
/** /[^\w-_ .]+/g
|
|
6
6
|
* @type {RegExp}
|
|
7
7
|
* @public
|
|
@@ -25,26 +25,26 @@ TextHighlighter.defaultTag = "mark";
|
|
|
25
25
|
* @param {string=} tagName Default is <mark> tag
|
|
26
26
|
* @return {Element} the same given elem
|
|
27
27
|
* @example
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* let parent = Dom.div();
|
|
29
|
+
* let child1 = Dom.text("Lorem ipsum dolor sit amet");
|
|
30
|
+
* let child2 = Dom.text("Quisque volutpat, neque et pretium accumsan");
|
|
31
31
|
* Dom.appendChild(parent, child1, child2);
|
|
32
32
|
* TextHighlighter.highlightAll(parent, "e", "mark"); // only child1 and child2 are modified
|
|
33
33
|
*/
|
|
34
34
|
TextHighlighter.highlightAll = function(elem, keyword, tagName) {
|
|
35
|
-
|
|
35
|
+
let rule = TextHighlighter.buildRule(keyword);
|
|
36
36
|
if(!tagName) {
|
|
37
37
|
tagName = TextHighlighter.defaultTag;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
for(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
let nodes = [elem];
|
|
41
|
+
for(let i = 0; i < nodes.length; ++i) {
|
|
42
|
+
let curNode = nodes[i];
|
|
43
|
+
let chdr = curNode.children;
|
|
44
|
+
let nonLeafNode = !curNode._highlightData && chdr && chdr.length;
|
|
45
45
|
if(nonLeafNode) {
|
|
46
|
-
|
|
47
|
-
for(
|
|
46
|
+
let len = chdr.length;
|
|
47
|
+
for(let j = 0; j < len; ++j) {
|
|
48
48
|
nodes.push(chdr[j]);
|
|
49
49
|
}
|
|
50
50
|
} else { // leaf node
|
|
@@ -61,26 +61,26 @@ TextHighlighter.highlightAll = function(elem, keyword, tagName) {
|
|
|
61
61
|
* @param {string=} tagName Default is <mark> tag
|
|
62
62
|
* @return {Element} Element with children of <span></span> and <mark></mark> tags
|
|
63
63
|
* @example
|
|
64
|
-
*
|
|
65
|
-
*
|
|
64
|
+
* let el = Dom.text("Lorem ipsum dolor sit amet");
|
|
65
|
+
* let highlightedEl = TextHighlighter.highlightContent(el, "e", "mark");
|
|
66
66
|
* highlightedEl === el; // true
|
|
67
67
|
*/
|
|
68
68
|
TextHighlighter.highlightContent = function(elem, keyword, tagName) {
|
|
69
|
-
|
|
69
|
+
let reset = true;
|
|
70
70
|
if(keyword) {
|
|
71
|
-
|
|
71
|
+
let text = elem.textContent;
|
|
72
72
|
if(text) {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
let highlightData = elem._highlightData;
|
|
74
|
+
let splitInfo = TextHighlighter._split(text, keyword, null, highlightData);
|
|
75
75
|
if(splitInfo) {
|
|
76
|
-
|
|
76
|
+
let i, len;
|
|
77
77
|
if(!highlightData) {
|
|
78
78
|
elem._highlightData = splitInfo;
|
|
79
79
|
|
|
80
80
|
// Save original child nodes
|
|
81
|
-
|
|
81
|
+
let cns = elem.childNodes;
|
|
82
82
|
len = cns.length;
|
|
83
|
-
|
|
83
|
+
let originalNodes = new Array(len);
|
|
84
84
|
for(i = 0; i < len; ++i) {
|
|
85
85
|
originalNodes[i] = cns[i];
|
|
86
86
|
}
|
|
@@ -92,12 +92,12 @@ TextHighlighter.highlightContent = function(elem, keyword, tagName) {
|
|
|
92
92
|
tagName = TextHighlighter.defaultTag;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
let chunks = splitInfo["chunks"];
|
|
96
96
|
len = chunks.length;
|
|
97
97
|
for(i = 0; i < len; ++i) {
|
|
98
|
-
|
|
98
|
+
let chunk = chunks[i];
|
|
99
99
|
if(chunk) {
|
|
100
|
-
|
|
100
|
+
let tag = Dom.create((i & 1) ? tagName : "span");
|
|
101
101
|
tag.textContent = chunk;
|
|
102
102
|
elem.appendChild(tag);
|
|
103
103
|
}
|
|
@@ -139,23 +139,23 @@ TextHighlighter.restore = function(elem) {
|
|
|
139
139
|
*/
|
|
140
140
|
TextHighlighter.getScore = function(elem) {
|
|
141
141
|
if(elem) {
|
|
142
|
-
|
|
142
|
+
let obj = /** @type{Object} */(elem._highlightData);
|
|
143
143
|
if(obj) {
|
|
144
|
-
|
|
144
|
+
let score = obj["score"];
|
|
145
145
|
if(score == null) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
let positions = /** @type{Array.<number>} */(obj["positions"]);
|
|
147
|
+
let matches = /** @type{Array.<string>} */(obj["matches"]);
|
|
148
|
+
let matchCount = matches.length;
|
|
149
149
|
|
|
150
150
|
score = matchCount * 1000; // Number of the matched keywords
|
|
151
|
-
for(
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
for(let i = 0; i < matchCount; ++i) {
|
|
152
|
+
let curTxt = matches[i];
|
|
153
|
+
let pos = positions[i];
|
|
154
154
|
score += curTxt.length * 100; // Length of the matched keywords
|
|
155
155
|
score += pos ? (400 / pos) | 0 : 500;
|
|
156
156
|
}
|
|
157
157
|
if(matchCount) {
|
|
158
|
-
|
|
158
|
+
let origLen = obj["original"] ? obj["original"].length : 0;
|
|
159
159
|
score += origLen ? (1000 / origLen) | 0 : 0;
|
|
160
160
|
}
|
|
161
161
|
obj["score"] = score; // Cache for later usage
|
|
@@ -178,7 +178,7 @@ TextHighlighter.getScore = function(elem) {
|
|
|
178
178
|
* TextHighlighter.split("not_found", "aaa"); // ["not_found"]
|
|
179
179
|
*/
|
|
180
180
|
TextHighlighter.split = function (haystack, needle, caseSensitive) {
|
|
181
|
-
|
|
181
|
+
let obj = TextHighlighter._split(haystack, needle, caseSensitive);
|
|
182
182
|
if(obj) {
|
|
183
183
|
return /** @type{!Array.<string>} */(obj["chunks"]);
|
|
184
184
|
}
|
|
@@ -196,9 +196,9 @@ TextHighlighter._split = function (haystack, needle, caseSensitive, out_obj) {
|
|
|
196
196
|
if(!haystack || !needle) {
|
|
197
197
|
return null;
|
|
198
198
|
}
|
|
199
|
-
|
|
199
|
+
let regExp = TextHighlighter.buildRule(needle, caseSensitive);
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
let matches = haystack.match(regExp);
|
|
202
202
|
if(!matches) {
|
|
203
203
|
return null;
|
|
204
204
|
}
|
|
@@ -207,25 +207,25 @@ TextHighlighter._split = function (haystack, needle, caseSensitive, out_obj) {
|
|
|
207
207
|
out_obj = {};
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
210
|
+
let matchCount = matches.length;
|
|
211
|
+
let positions = new Array(matchCount);
|
|
212
|
+
let start = 0;
|
|
213
|
+
let curIdx = 0;
|
|
214
|
+
let chunks = [];
|
|
215
215
|
do {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
let curMatch = matches[curIdx];
|
|
217
|
+
let matchLen = curMatch.length;
|
|
218
|
+
let at = positions[curIdx] = haystack.indexOf(curMatch, start);
|
|
219
219
|
chunks.push(
|
|
220
|
-
haystack.
|
|
221
|
-
haystack.
|
|
220
|
+
haystack.slice(start, at),
|
|
221
|
+
haystack.slice(at, at + matchLen)
|
|
222
222
|
);
|
|
223
223
|
start = at + matchLen;
|
|
224
224
|
} while(++curIdx < matchCount);
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
let end = haystack.length;
|
|
227
227
|
if(start < end) {
|
|
228
|
-
chunks.push(haystack.
|
|
228
|
+
chunks.push(haystack.slice(start, end));
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
out_obj["chunks"] = chunks;
|
|
@@ -242,7 +242,7 @@ TextHighlighter._split = function (haystack, needle, caseSensitive, out_obj) {
|
|
|
242
242
|
* @param {(boolean|number)=} caseSensitive If true, the rule is produced with case sensitive characters
|
|
243
243
|
* @return {RegExp}
|
|
244
244
|
* @example
|
|
245
|
-
*
|
|
245
|
+
* let regExp = TextHighlighter.buildRule("A + B"); // Equivalent to new RegExp(/A|B/g);
|
|
246
246
|
*/
|
|
247
247
|
TextHighlighter.buildRule = function(txt, caseSensitive) {
|
|
248
248
|
if(typeof txt != "string") {
|
|
@@ -257,9 +257,9 @@ TextHighlighter.buildRule = function(txt, caseSensitive) {
|
|
|
257
257
|
return null;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
let option = caseSensitive ? "g" : "gi";
|
|
261
|
+
let keywords = txt.split(TextHighlighter.spaces);
|
|
262
|
+
let rule = (keywords.length > 1) ? keywords.join("|") : txt;
|
|
263
263
|
|
|
264
264
|
return new RegExp(rule, option);
|
|
265
265
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @type {Object.<string, number>}
|
|
2
2
|
* @public
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
let TickCodes = {
|
|
5
5
|
"\u21e7": 1,
|
|
6
6
|
"B\u21e7": 1,
|
|
7
7
|
"\u2191": 1,
|
|
@@ -22,7 +22,7 @@ var TickCodes = {
|
|
|
22
22
|
/** @type {Object.<string, number>}
|
|
23
23
|
* @public
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
let TickFields = {
|
|
26
26
|
"CF_TICK": 1,
|
|
27
27
|
"PRCTCK_1": 1,
|
|
28
28
|
"BID_TICK": 1,
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @param {Function=} func Function to be executed
|
|
5
5
|
* @param {*=} ctx Context object that will be supplied to the function as the first parameter
|
|
6
6
|
* @example
|
|
7
|
-
*
|
|
7
|
+
* let timer = new Timer(2000, (ctx)=>{ console.log(ctx)}, "AAA");
|
|
8
8
|
* timer.start(); // AAA will be logged after 2 seconds
|
|
9
9
|
* timer.start(); // Timer is reset. AAA will be logged only once
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
let Timer = function(duration, func, ctx) {
|
|
12
12
|
this._duration = (typeof duration == "number") ? duration : 0;
|
|
13
13
|
this._onTimeout = this._onTimeout.bind(this);
|
|
14
14
|
this._method = func || null;
|
|
@@ -25,7 +25,7 @@ import {EventDispatcher} from "./EventDispatcher.js";
|
|
|
25
25
|
* @param {Element=} elem
|
|
26
26
|
* @param {(boolean|Object)=} options Boolean is treated as useTouchMove
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
let TouchProxy = function (elem, options) {
|
|
29
29
|
this._onTouchStart = this._dispatch.bind(this, "touchStart");
|
|
30
30
|
this._onTouchEnd = this._dispatch.bind(this, "touchEnd");
|
|
31
31
|
this._onTouchMove = this._dispatch.bind(this, "touchMove");
|
|
@@ -129,7 +129,7 @@ TouchProxy.prototype.removeTouchListeners = TouchProxy.prototype.unlistenAll;
|
|
|
129
129
|
|
|
130
130
|
/** @public */
|
|
131
131
|
TouchProxy.prototype.attachTouchMoveEvent = function() {
|
|
132
|
-
|
|
132
|
+
let elem = this._elem;
|
|
133
133
|
if(elem) {
|
|
134
134
|
if(this._defaultPrevented) {
|
|
135
135
|
elem.addEventListener("touchmove", EventDispatcher.preventDefault);
|
|
@@ -139,7 +139,7 @@ TouchProxy.prototype.attachTouchMoveEvent = function() {
|
|
|
139
139
|
};
|
|
140
140
|
/** @public */
|
|
141
141
|
TouchProxy.prototype.detachTouchMoveEvent = function() {
|
|
142
|
-
|
|
142
|
+
let elem = this._elem;
|
|
143
143
|
if(elem) {
|
|
144
144
|
if(this._defaultPrevented) {
|
|
145
145
|
elem.removeEventListener("touchmove", EventDispatcher.preventDefault);
|
|
@@ -151,7 +151,7 @@ TouchProxy.prototype.detachTouchMoveEvent = function() {
|
|
|
151
151
|
* @param {boolean=} touchMove
|
|
152
152
|
*/
|
|
153
153
|
TouchProxy.prototype.attachTouchEvents = function(touchMove) {
|
|
154
|
-
|
|
154
|
+
let elem = this._elem;
|
|
155
155
|
if(elem) {
|
|
156
156
|
elem.addEventListener("touchstart", this._onTouchStart, this._evtOptions);
|
|
157
157
|
elem.addEventListener("touchend", this._onTouchEnd, this._evtOptions);
|
|
@@ -163,7 +163,7 @@ TouchProxy.prototype.attachTouchEvents = function(touchMove) {
|
|
|
163
163
|
};
|
|
164
164
|
/** @public */
|
|
165
165
|
TouchProxy.prototype.detachTouchEvents = function() {
|
|
166
|
-
|
|
166
|
+
let elem = this._elem;
|
|
167
167
|
if(elem) {
|
|
168
168
|
elem.removeEventListener("touchstart", this._onTouchStart, this._evtOptions);
|
|
169
169
|
elem.removeEventListener("touchend", this._onTouchEnd, this._evtOptions);
|
|
@@ -193,8 +193,8 @@ TouchProxy.getButtonType = function(e) {
|
|
|
193
193
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent}
|
|
194
194
|
*/
|
|
195
195
|
TouchProxy.getPosition = function(e, obj) {
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
let touches = e.changedTouches;
|
|
197
|
+
let mPos = (touches) ? touches[touches.length - 1] : e;
|
|
198
198
|
|
|
199
199
|
if(!obj) {
|
|
200
200
|
obj = {};
|