@refinitiv-ui/efx-grid 6.0.91 → 6.0.93

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.d.ts +1 -1
  2. package/lib/column-dragging/es6/ColumnDragging.js +144 -34
  3. package/lib/core/dist/core.js +2410 -2621
  4. package/lib/core/dist/core.min.js +1 -1
  5. package/lib/core/es6/data/ColumnStats.js +14 -14
  6. package/lib/core/es6/data/DataCache.js +118 -118
  7. package/lib/core/es6/data/DataTable.d.ts +3 -1
  8. package/lib/core/es6/data/DataTable.js +208 -190
  9. package/lib/core/es6/data/DataView.d.ts +1 -1
  10. package/lib/core/es6/data/DataView.js +291 -291
  11. package/lib/core/es6/data/Segment.js +79 -79
  12. package/lib/core/es6/data/SegmentCollection.js +81 -81
  13. package/lib/core/es6/data/WrappedView.js +41 -41
  14. package/lib/core/es6/grid/Core.js +635 -635
  15. package/lib/core/es6/grid/ILayoutGrid.js +1 -1
  16. package/lib/core/es6/grid/LayoutGrid.js +183 -183
  17. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +91 -91
  18. package/lib/core/es6/grid/components/Cell.js +29 -29
  19. package/lib/core/es6/grid/components/CellFloatingPanel.js +11 -11
  20. package/lib/core/es6/grid/components/CellSpan.js +7 -7
  21. package/lib/core/es6/grid/components/CellSpans.js +36 -34
  22. package/lib/core/es6/grid/components/Column.js +40 -40
  23. package/lib/core/es6/grid/components/ElementWrapper.js +17 -17
  24. package/lib/core/es6/grid/components/HScrollbar.js +31 -31
  25. package/lib/core/es6/grid/components/Scrollbar.js +77 -77
  26. package/lib/core/es6/grid/components/StretchedCells.js +49 -49
  27. package/lib/core/es6/grid/components/VScrollbar.js +11 -11
  28. package/lib/core/es6/grid/components/VirtualItems.js +3 -3
  29. package/lib/core/es6/grid/event/EventDispatcher.js +9 -9
  30. package/lib/core/es6/grid/event/EventListeners.js +4 -4
  31. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +186 -186
  32. package/lib/core/es6/grid/util/Conflator.js +4 -4
  33. package/lib/core/es6/grid/util/Reverter.js +1 -1
  34. package/lib/core/es6/grid/util/SectionSettings.js +20 -20
  35. package/lib/core/es6/grid/util/SelectionList.js +23 -23
  36. package/lib/core/es6/grid/util/TrackLayout.js +74 -74
  37. package/lib/core/es6/grid/util/Virtualizer.js +15 -15
  38. package/lib/core/es6/grid/util/util.js +20 -20
  39. package/lib/core/es6/index.d.ts +0 -2
  40. package/lib/core/es6/index.js +0 -3
  41. package/lib/filter-dialog/lib/filter-dialog.js +1 -0
  42. package/lib/grid/index.js +1 -1
  43. package/lib/rt-grid/dist/rt-grid.js +193 -70
  44. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  45. package/lib/rt-grid/es6/Grid.js +46 -30
  46. package/lib/rt-grid/es6/RowDefinition.d.ts +2 -1
  47. package/lib/rt-grid/es6/RowDefinition.js +74 -16
  48. package/lib/tr-grid-cell-selection/es6/CellSelection.js +56 -1
  49. package/lib/tr-grid-checkbox/es6/Checkbox.js +268 -268
  50. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
  51. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +60 -32
  52. package/lib/tr-grid-column-stack/es6/ColumnStack.js +279 -279
  53. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +227 -207
  54. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +11 -11
  55. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +1 -2
  56. package/lib/tr-grid-row-dragging/es6/RowDragging.js +120 -121
  57. package/lib/tr-grid-util/es6/CellPainter.js +94 -104
  58. package/lib/tr-grid-util/es6/Conflator.js +4 -4
  59. package/lib/tr-grid-util/es6/CoralItems.js +6 -6
  60. package/lib/tr-grid-util/es6/DateTime.js +41 -41
  61. package/lib/tr-grid-util/es6/Deferred.js +5 -5
  62. package/lib/tr-grid-util/es6/Delay.d.ts +3 -3
  63. package/lib/tr-grid-util/es6/Delay.js +14 -3
  64. package/lib/tr-grid-util/es6/Dom.js +26 -26
  65. package/lib/tr-grid-util/es6/DragUI.js +17 -17
  66. package/lib/tr-grid-util/es6/ElementObserver.js +12 -12
  67. package/lib/tr-grid-util/es6/ElementWrapper.js +2 -2
  68. package/lib/tr-grid-util/es6/ElfDate.js +4 -4
  69. package/lib/tr-grid-util/es6/ElfUtil.js +37 -37
  70. package/lib/tr-grid-util/es6/EventDispatcher.js +12 -12
  71. package/lib/tr-grid-util/es6/ExpanderIcon.js +6 -6
  72. package/lib/tr-grid-util/es6/ExpressionParser.js +43 -43
  73. package/lib/tr-grid-util/es6/Ext.js +6 -6
  74. package/lib/tr-grid-util/es6/FieldFormatter.js +17 -17
  75. package/lib/tr-grid-util/es6/FilterBuilder.js +57 -58
  76. package/lib/tr-grid-util/es6/FilterOperators.d.ts +12 -1
  77. package/lib/tr-grid-util/es6/FilterOperators.js +13 -2
  78. package/lib/tr-grid-util/es6/GridPlugin.js +86 -87
  79. package/lib/tr-grid-util/es6/GroupDefinitions.js +90 -90
  80. package/lib/tr-grid-util/es6/Icon.js +4 -4
  81. package/lib/tr-grid-util/es6/MouseDownTrait.js +6 -6
  82. package/lib/tr-grid-util/es6/MultiTableManager.js +71 -80
  83. package/lib/tr-grid-util/es6/NumberFormatter.js +23 -23
  84. package/lib/tr-grid-util/es6/PercentBar.js +17 -17
  85. package/lib/tr-grid-util/es6/Perf.js +5 -5
  86. package/lib/tr-grid-util/es6/Popup.js +42 -42
  87. package/lib/tr-grid-util/es6/RangeBar.js +5 -5
  88. package/lib/tr-grid-util/es6/RequestQueue.js +5 -5
  89. package/lib/tr-grid-util/es6/RowPainter.js +23 -23
  90. package/lib/tr-grid-util/es6/SubTable.js +94 -94
  91. package/lib/tr-grid-util/es6/Table.js +51 -51
  92. package/lib/tr-grid-util/es6/TextHighlighter.js +52 -52
  93. package/lib/tr-grid-util/es6/TickCodes.js +2 -2
  94. package/lib/tr-grid-util/es6/Timer.js +2 -2
  95. package/lib/tr-grid-util/es6/TouchProxy.js +7 -7
  96. package/lib/tr-grid-util/es6/Util.js +50 -50
  97. package/lib/tr-grid-util/es6/formula/ADCService.js +2 -2
  98. package/lib/tr-grid-util/es6/formula/ADCSubscription.js +19 -19
  99. package/lib/tr-grid-util/es6/formula/AdFinService.js +2 -2
  100. package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +19 -19
  101. package/lib/tr-grid-util/es6/formula/Engine.js +56 -56
  102. package/lib/tr-grid-util/es6/formula/Formula.js +62 -62
  103. package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +3 -3
  104. package/lib/tr-grid-util/es6/formula/Realtime.js +15 -15
  105. package/lib/tr-grid-util/es6/formula/RealtimeService.js +15 -15
  106. package/lib/tr-grid-util/es6/formula/TSIService.js +2 -2
  107. package/lib/tr-grid-util/es6/formula/TSISubscription.js +104 -104
  108. package/lib/tr-grid-util/es6/formula/VariableToken.js +20 -20
  109. package/lib/tr-grid-util/es6/formula/functions/AdFin.js +10 -10
  110. package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
  111. package/lib/tr-grid-util/es6/formula/functions/Info.js +2 -2
  112. package/lib/tr-grid-util/es6/formula/functions/Internal.js +5 -5
  113. package/lib/tr-grid-util/es6/formula/functions/Logic.js +5 -5
  114. package/lib/tr-grid-util/es6/formula/functions/Math.js +46 -46
  115. package/lib/tr-grid-util/es6/formula/functions/Statistics.js +27 -27
  116. package/lib/tr-grid-util/es6/formula/functions/Text.js +19 -19
  117. package/lib/tr-grid-util/es6/index.js +1 -1
  118. package/lib/tr-grid-util/es6/jet/Adc.js +36 -36
  119. package/lib/tr-grid-util/es6/jet/CollectionDict.js +11 -11
  120. package/lib/tr-grid-util/es6/jet/DataGenerator.js +95 -95
  121. package/lib/tr-grid-util/es6/jet/DataSet.js +1 -1
  122. package/lib/tr-grid-util/es6/jet/MockArchive.js +5 -5
  123. package/lib/tr-grid-util/es6/jet/MockJET.js +1 -1
  124. package/lib/tr-grid-util/es6/jet/MockQuotes.js +13 -13
  125. package/lib/tr-grid-util/es6/jet/MockQuotes2.js +100 -100
  126. package/lib/tr-grid-util/es6/jet/MockRTK.js +4 -4
  127. package/lib/tr-grid-util/es6/jet/MockUtil.js +2 -2
  128. package/lib/tr-grid-util/es6/jet/index.js +1 -1
  129. package/lib/tr-grid-util/es6/jet/mockDataAPI.js +15 -15
  130. package/lib/tr-grid-util/es6/locale/translation-de.js +1 -1
  131. package/lib/tr-grid-util/es6/locale/translation-en.js +1 -1
  132. package/lib/tr-grid-util/es6/locale/translation-ja.js +1 -1
  133. package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +1 -1
  134. package/lib/tr-grid-util/es6/locale/translation-zh.js +1 -1
  135. package/lib/tr-grid-util/es6/locale/translation.js +1 -1
  136. package/lib/types/es6/ColumnDragging.d.ts +1 -1
  137. package/lib/types/es6/ColumnGrouping.d.ts +3 -1
  138. package/lib/types/es6/Core/data/DataTable.d.ts +4 -0
  139. package/lib/types/es6/Core/data/DataView.d.ts +2 -0
  140. package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
  141. package/lib/types/es6/Core/index.d.ts +0 -2
  142. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -1
  143. package/lib/types/es6/RowDragging.d.ts +1 -2
  144. package/lib/versions.json +12 -12
  145. package/package.json +1 -1
  146. package/lib/core/es6/grid/util/ElementFrameWork.d.ts +0 -18
  147. package/lib/core/es6/grid/util/ElementFrameWork.js +0 -227
  148. package/lib/core/es6/grid/util/HttpRequest.d.ts +0 -53
  149. package/lib/core/es6/grid/util/HttpRequest.js +0 -371
  150. package/lib/core/es6/grid/util/PercentBar.d.ts +0 -43
  151. package/lib/core/es6/grid/util/PercentBar.js +0 -390
  152. package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +0 -41
  153. package/lib/core/es6/grid/util/PercentBarRenderer.js +0 -316
  154. package/lib/core/es6/grid/util/RangeBar.d.ts +0 -25
  155. package/lib/core/es6/grid/util/RangeBar.js +0 -255
  156. package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +0 -18
  157. package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +0 -53
  158. package/lib/types/es6/Core/grid/util/PercentBar.d.ts +0 -43
  159. package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +0 -41
  160. 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
- * var elem = document.getElementById("table_div");
24
+ * let elem = document.getElementById("table_div");
25
25
  * // Create a table element with 2 columns and 3 rows inside the given element
26
- * var tbl = new Table(elem, {colCount: 2, rowCount: 3});
26
+ * let tbl = new Table(elem, {colCount: 2, rowCount: 3});
27
27
  */
28
- var Table = function(elem, options) {
29
- var t = this;
28
+ let Table = function(elem, options) {
29
+ let t = this;
30
30
 
31
- var colCount = 0;
32
- var rowCount = 0;
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
- var configObj = null;
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
- var colWidth = options["colWidth"] || options["cellWidth"];
149
+ let colWidth = options["colWidth"] || options["cellWidth"];
150
150
  if(colWidth) {
151
151
  this.setDefaultColumnWidth(colWidth);
152
152
  }
153
- var rowHeight = options["rowHeight"] || options["cellHeight"];
153
+ let rowHeight = options["rowHeight"] || options["cellHeight"];
154
154
  if(rowHeight) {
155
155
  this.setDefaultRowHeight(rowHeight);
156
156
  }
157
157
 
158
- var colCount = options["colCount"];
158
+ let colCount = options["colCount"];
159
159
  if(colCount) {
160
160
  this.setColumnCount(colCount);
161
161
  }
162
- var rowCount = options["rowCount"];
162
+ let rowCount = options["rowCount"];
163
163
  if(rowCount) {
164
164
  this.setRowCount(rowCount);
165
165
  }
166
166
 
167
- var tableWidth = options["width"] || options["tableWidth"];
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
- var tableHeight = options["height"] || options["tableHeight"];
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
- var header = options["header"];
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
- var footer = options["footer"];
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
- var cols = [];
216
- var c;
215
+ let cols = [];
216
+ let c;
217
217
  for(c = count; --c >= 0;) {
218
- var col = document.createElement("col");
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
- var minWidth = this._defaultColumnWidth + "px";
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(var i = this._subs.length; --i >= 0;) {
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(var i = this._subs.length; --i >= 0;) {
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(var i = this._subs.length; --i >= 0;) {
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(var i = this._subs.length; --i >= 0;) {
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
- var txtRows = this._tbody.getTextContents();
449
- var rowCount = txtRows.length;
448
+ let txtRows = this._tbody.getTextContents();
449
+ let rowCount = txtRows.length;
450
450
  if(!rowCount) {
451
451
  return;
452
452
  }
453
- var maxWidths = new Array(this._colCount);
454
- var txtRow = txtRows[0];
455
- for(var c = 0; c < this._colCount; ++c) {
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(var r = 1; r < rowCount; ++r) {
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
- var longestColumn = 0;
467
- var maxWidth = maxWidths[0];
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
- var trs = this.getRows();
486
- var rowCount = trs.length;
485
+ let trs = this.getRows();
486
+ let rowCount = trs.length;
487
487
  if(!opt_rowLimit || opt_rowLimit <= 0) { opt_rowLimit = rowCount; }
488
488
 
489
- var c;
490
- var colNames = new Array(this._colCount);
489
+ let c;
490
+ let colNames = new Array(this._colCount);
491
491
  for(c = 0; c < this._colCount; ++c) {
492
- var hCell = this.getHeaderCell(c, 0);
493
- var hStr = hCell ? hCell.textContent : "";
492
+ let hCell = this.getHeaderCell(c, 0);
493
+ let hStr = hCell ? hCell.textContent : "";
494
494
  colNames[c] = hStr || ("" + c);
495
495
  }
496
496
 
497
- var rows = [];
498
- for(var r = 0; r < rowCount; ++r) {
499
- var cols = {};
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
- var elems = tblElem.getElementsByTagName("COLGROUP");
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
- var t = this;
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
- var t = this;
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
- var c, col;
765
+ let c, col;
766
766
  if(val instanceof Array) {
767
- var count = (val.length < this._colCount) ? val.length : this._colCount;
767
+ let count = (val.length < this._colCount) ? val.length : this._colCount;
768
768
  for(c = count; --c >= 0;) {
769
- var str = val[c];
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
- var fixedWidth = true;
796
- var totalWidth = 0;
797
- for(var c = this._colCount; --c >= 0;) {
798
- var col = this._colgroup.children[c];
799
- var str = col.style.width;
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
- var TextHighlighter = {};
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 &lt;mark> tag
26
26
  * @return {Element} the same given elem
27
27
  * @example
28
- * var parent = Dom.div();
29
- * var child1 = Dom.text("Lorem ipsum dolor sit amet");
30
- * var child2 = Dom.text("Quisque volutpat, neque et pretium accumsan");
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
- var rule = TextHighlighter.buildRule(keyword);
35
+ let rule = TextHighlighter.buildRule(keyword);
36
36
  if(!tagName) {
37
37
  tagName = TextHighlighter.defaultTag;
38
38
  }
39
39
 
40
- var nodes = [elem];
41
- for(var i = 0; i < nodes.length; ++i) {
42
- var curNode = nodes[i];
43
- var chdr = curNode.children;
44
- var nonLeafNode = !curNode._highlightData && chdr && chdr.length;
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
- var len = chdr.length;
47
- for(var j = 0; j < len; ++j) {
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 &lt;mark> tag
62
62
  * @return {Element} Element with children of &lt;span>&lt;/span> and &lt;mark>&lt;/mark> tags
63
63
  * @example
64
- * var el = Dom.text("Lorem ipsum dolor sit amet");
65
- * var highlightedEl = TextHighlighter.highlightContent(el, "e", "mark");
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
- var reset = true;
69
+ let reset = true;
70
70
  if(keyword) {
71
- var text = elem.textContent;
71
+ let text = elem.textContent;
72
72
  if(text) {
73
- var highlightData = elem._highlightData;
74
- var splitInfo = TextHighlighter._split(text, keyword, null, highlightData);
73
+ let highlightData = elem._highlightData;
74
+ let splitInfo = TextHighlighter._split(text, keyword, null, highlightData);
75
75
  if(splitInfo) {
76
- var i, len;
76
+ let i, len;
77
77
  if(!highlightData) {
78
78
  elem._highlightData = splitInfo;
79
79
 
80
80
  // Save original child nodes
81
- var cns = elem.childNodes;
81
+ let cns = elem.childNodes;
82
82
  len = cns.length;
83
- var originalNodes = new Array(len);
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
- var chunks = splitInfo["chunks"];
95
+ let chunks = splitInfo["chunks"];
96
96
  len = chunks.length;
97
97
  for(i = 0; i < len; ++i) {
98
- var chunk = chunks[i];
98
+ let chunk = chunks[i];
99
99
  if(chunk) {
100
- var tag = Dom.create((i & 1) ? tagName : "span");
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
- var obj = /** @type{Object} */(elem._highlightData);
142
+ let obj = /** @type{Object} */(elem._highlightData);
143
143
  if(obj) {
144
- var score = obj["score"];
144
+ let score = obj["score"];
145
145
  if(score == null) {
146
- var positions = /** @type{Array.<number>} */(obj["positions"]);
147
- var matches = /** @type{Array.<string>} */(obj["matches"]);
148
- var matchCount = matches.length;
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(var i = 0; i < matchCount; ++i) {
152
- var curTxt = matches[i];
153
- var pos = positions[i];
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
- var origLen = obj["original"] ? obj["original"].length : 0;
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
- var obj = TextHighlighter._split(haystack, needle, caseSensitive);
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
- var regExp = TextHighlighter.buildRule(needle, caseSensitive);
199
+ let regExp = TextHighlighter.buildRule(needle, caseSensitive);
200
200
 
201
- var matches = haystack.match(regExp);
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
- var matchCount = matches.length;
211
- var positions = new Array(matchCount);
212
- var start = 0;
213
- var curIdx = 0;
214
- var chunks = [];
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
- var curMatch = matches[curIdx];
217
- var matchLen = curMatch.length;
218
- var at = positions[curIdx] = haystack.indexOf(curMatch, start);
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.substring(start, at),
221
- haystack.substr(at, matchLen)
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
- var end = haystack.length;
226
+ let end = haystack.length;
227
227
  if(start < end) {
228
- chunks.push(haystack.substring(start, end));
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
- * var regExp = TextHighlighter.buildRule("A + B"); // Equivalent to new RegExp(/A|B/g);
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
- var option = caseSensitive ? "g" : "gi";
261
- var keywords = txt.split(TextHighlighter.spaces);
262
- var rule = (keywords.length > 1) ? keywords.join("|") : txt;
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
- var TickCodes = {
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
- var TickFields = {
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
- * var timer = new Timer(2000, (ctx)=>{ console.log(ctx)}, "AAA");
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
- var Timer = function(duration, func, ctx) {
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
- var TouchProxy = function (elem, options) {
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
- var elem = this._elem;
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
- var elem = this._elem;
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
- var elem = this._elem;
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
- var elem = this._elem;
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
- var touches = e.changedTouches;
197
- var mPos = (touches) ? touches[touches.length - 1] : e;
196
+ let touches = e.changedTouches;
197
+ let mPos = (touches) ? touches[touches.length - 1] : e;
198
198
 
199
199
  if(!obj) {
200
200
  obj = {};