@refinitiv-ui/efx-grid 6.0.91 → 6.0.92
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -8,8 +8,8 @@ import { ElementWrapper } from "./ElementWrapper.js";
|
|
8
8
|
* @param {number} count Number of elements to be added
|
9
9
|
* @param {string} childTag Tag name of the cells
|
10
10
|
*/
|
11
|
-
|
12
|
-
for(
|
11
|
+
let _addElements = function(parentElem, count, childTag) {
|
12
|
+
for(let i = count; --i >= 0;) {
|
13
13
|
parentElem.appendChild(document.createElement(childTag));
|
14
14
|
}
|
15
15
|
};
|
@@ -19,8 +19,8 @@ var _addElements = function(parentElem, count, childTag) {
|
|
19
19
|
* @extends {ElementWrapper}
|
20
20
|
* @param {(Element|string)=} opt_elem
|
21
21
|
*/
|
22
|
-
|
23
|
-
|
22
|
+
let SubTable = function(opt_elem) {
|
23
|
+
let elem;
|
24
24
|
if(opt_elem) {
|
25
25
|
if(typeof opt_elem == "string") { // tbody, thead, tfoot
|
26
26
|
elem = document.createElement(opt_elem);
|
@@ -67,9 +67,9 @@ SubTable.prototype.addColumns = function(opt_count) {
|
|
67
67
|
|
68
68
|
this._colCount += opt_count;
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
for(
|
70
|
+
let cellTag = this._getCellTagName();
|
71
|
+
let rows = this._elem.children; // TODO: Must include all suspended rows
|
72
|
+
for(let r = rows.length; --r >= 0;) {
|
73
73
|
_addElements(rows[r], opt_count, cellTag);
|
74
74
|
}
|
75
75
|
};
|
@@ -84,8 +84,8 @@ SubTable.prototype.removeColumns = function(opt_count) {
|
|
84
84
|
if(opt_count <= 0) { return; }
|
85
85
|
|
86
86
|
this._colCount -= opt_count;
|
87
|
-
|
88
|
-
for(
|
87
|
+
let rows = this._elem.children; // TODO: Must include all suspended rows
|
88
|
+
for(let r = rows.length; --r >= 0;) {
|
89
89
|
Dom.removeChildren(rows[r], opt_count);
|
90
90
|
}
|
91
91
|
};
|
@@ -115,7 +115,7 @@ SubTable.prototype.setColumnCount = function(val) {
|
|
115
115
|
* @return {Element} tr (HTMLTableRowElement) element
|
116
116
|
*/
|
117
117
|
SubTable.prototype.insertRow = function(at) {
|
118
|
-
|
118
|
+
let row = this._elem.insertRow(at);
|
119
119
|
_addElements(row, this._colCount, this._getCellTagName());
|
120
120
|
return row;
|
121
121
|
};
|
@@ -125,13 +125,13 @@ SubTable.prototype.insertRow = function(at) {
|
|
125
125
|
* @return {!Array.<Element>} Array of tr (HTMLTableRowElement) elements
|
126
126
|
*/
|
127
127
|
SubTable.prototype.addRows = function(count) {
|
128
|
-
|
128
|
+
let rows = null;
|
129
129
|
if(count == null) {
|
130
130
|
count = 1;
|
131
131
|
}
|
132
132
|
if(count > 0) {
|
133
133
|
rows = new Array(count);
|
134
|
-
for(
|
134
|
+
for(let r = 0; r < count; ++r) {
|
135
135
|
rows[r] = this.insertRow();
|
136
136
|
}
|
137
137
|
|
@@ -155,7 +155,7 @@ SubTable.prototype.removeAllRows = function() {
|
|
155
155
|
* @param {number} val
|
156
156
|
*/
|
157
157
|
SubTable.prototype.setRowCount = function(val) {
|
158
|
-
|
158
|
+
let rowCount = this.getRowCount();
|
159
159
|
if(val >= rowCount) {
|
160
160
|
this.addRows(val - rowCount);
|
161
161
|
} else {
|
@@ -170,7 +170,7 @@ SubTable.prototype.setDefaultRowHeight = function(val) {
|
|
170
170
|
if(val === this._defaultRowHeight) { return; }
|
171
171
|
|
172
172
|
this._defaultRowHeight = val;
|
173
|
-
|
173
|
+
let minHeight = (this._defaultRowHeight != null) ? this._defaultRowHeight + "px" : "";
|
174
174
|
|
175
175
|
this._applyDefaultRowHeight(this._elem.children, minHeight);
|
176
176
|
};
|
@@ -194,7 +194,7 @@ SubTable.prototype.getRowCount = function() {
|
|
194
194
|
* @return {Element}
|
195
195
|
*/
|
196
196
|
SubTable.prototype.getCell = function(c, r) {
|
197
|
-
|
197
|
+
let tr = this.getRow(r);
|
198
198
|
if(tr) {
|
199
199
|
return tr.cells[c] || null;
|
200
200
|
}
|
@@ -208,10 +208,10 @@ SubTable.prototype.getCellsInColumn = function(c) {
|
|
208
208
|
if(c < 0 || c >= this._colCount) {
|
209
209
|
return null;
|
210
210
|
}
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
for(
|
211
|
+
let rows = this._elem.children;
|
212
|
+
let rowCount = rows.length;
|
213
|
+
let ary = new Array(rowCount);
|
214
|
+
for(let r = 0; r < rowCount; ++r) {
|
215
215
|
ary[r] = rows[r].cells[c];
|
216
216
|
}
|
217
217
|
|
@@ -222,12 +222,12 @@ SubTable.prototype.getCellsInColumn = function(c) {
|
|
222
222
|
* @return {Array.<Element>} Array of td (HTMLTableCellElement) elements
|
223
223
|
*/
|
224
224
|
SubTable.prototype.getCellsInRow = function(r) {
|
225
|
-
|
225
|
+
let tr = this.getRow(r);
|
226
226
|
if(tr) {
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
for(
|
227
|
+
let cells = tr.cells;
|
228
|
+
let len = cells.length;
|
229
|
+
let ary = new Array(len);
|
230
|
+
for(let i = 0; i < len; ++i) {
|
231
231
|
ary[i] = cells[i];
|
232
232
|
}
|
233
233
|
return ary;
|
@@ -238,14 +238,14 @@ SubTable.prototype.getCellsInRow = function(r) {
|
|
238
238
|
* @return {!Array.<Element>} Array of td (HTMLTableCellElement) elements
|
239
239
|
*/
|
240
240
|
SubTable.prototype.getAllCells = function() {
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
for(
|
247
|
-
|
248
|
-
for(
|
241
|
+
let rows = this._elem.children;
|
242
|
+
let rowCount = rows.length;
|
243
|
+
let colCount = this._colCount;
|
244
|
+
let cellCount = 0;
|
245
|
+
let ary = new Array(rowCount * colCount);
|
246
|
+
for(let r = 0; r < rowCount; ++r) {
|
247
|
+
let tr = rows[r];
|
248
|
+
for(let c = 0; c < colCount; ++c) {
|
249
249
|
ary[cellCount++] = tr.cells[c];
|
250
250
|
}
|
251
251
|
}
|
@@ -255,10 +255,10 @@ SubTable.prototype.getAllCells = function() {
|
|
255
255
|
* @return {!Array.<Element>} Array of tr (HTMLTableRowElement) elements
|
256
256
|
*/
|
257
257
|
SubTable.prototype.getAllRows = function() {
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
for(
|
258
|
+
let chdr = this._elem.children;
|
259
|
+
let len = chdr ? chdr.length : 0;
|
260
|
+
let ary = new Array(len);
|
261
|
+
for(let i = 0; i < len; ++i) {
|
262
262
|
ary[i] = chdr[i];
|
263
263
|
}
|
264
264
|
return ary;
|
@@ -280,14 +280,14 @@ SubTable.prototype.getRow = function(r) {
|
|
280
280
|
* @return {!Array.<Array.<string>>}
|
281
281
|
*/
|
282
282
|
SubTable.prototype.getTextContents = function() {
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
for(
|
287
|
-
|
288
|
-
|
283
|
+
let rows = this._elem.children;
|
284
|
+
let rowCount = rows.length;
|
285
|
+
let rowContents = new Array(rowCount);
|
286
|
+
for(let r = 0; r < rowCount; ++r) {
|
287
|
+
let row = rows[r];
|
288
|
+
let colContents = new Array(this._colCount);
|
289
289
|
rowContents[r] = colContents;
|
290
|
-
for(
|
290
|
+
for(let c = 0; c < this._colCount; ++c) {
|
291
291
|
colContents[c] = row.cells[c].textContent;
|
292
292
|
}
|
293
293
|
}
|
@@ -299,7 +299,7 @@ SubTable.prototype.getTextContents = function() {
|
|
299
299
|
* @return {string}
|
300
300
|
*/
|
301
301
|
SubTable.prototype.getCellTextContent = function(c, r) {
|
302
|
-
|
302
|
+
let cell = this.getCell(c, r);
|
303
303
|
if(cell) {
|
304
304
|
return cell.textContent;
|
305
305
|
}
|
@@ -310,11 +310,11 @@ SubTable.prototype.getCellTextContent = function(c, r) {
|
|
310
310
|
* @return {string}
|
311
311
|
*/
|
312
312
|
SubTable.prototype.getColumnTextContent = function(c) { // New-line delimited
|
313
|
-
|
314
|
-
|
313
|
+
let rows = this._elem.children;
|
314
|
+
let rowCount = rows.length;
|
315
315
|
if(c >= 0 && c < this._colCount && rowCount > 0) {
|
316
|
-
|
317
|
-
for(
|
316
|
+
let str = rows[0].cells[c].textContent;
|
317
|
+
for(let r = 1; r < rowCount; ++r) {
|
318
318
|
str += "\n" + rows[r].cells[c].textContent;
|
319
319
|
}
|
320
320
|
return str;
|
@@ -326,10 +326,10 @@ SubTable.prototype.getColumnTextContent = function(c) { // New-line delimited
|
|
326
326
|
* @return {string}
|
327
327
|
*/
|
328
328
|
SubTable.prototype.getRowTextContent = function(r) { // Tab delimited
|
329
|
-
|
329
|
+
let tr = this.getRow(r);
|
330
330
|
if(tr && this._colCount > 0) {
|
331
|
-
|
332
|
-
for(
|
331
|
+
let str = tr.cells[0].textContent;
|
332
|
+
for(let c = 1; c < this._colCount; ++c) {
|
333
333
|
str += "\t" + tr.cells[c].textContent;
|
334
334
|
}
|
335
335
|
return str;
|
@@ -340,10 +340,10 @@ SubTable.prototype.getRowTextContent = function(r) { // Tab delimited
|
|
340
340
|
* @return {string}
|
341
341
|
*/
|
342
342
|
SubTable.prototype.getTableTextContent = function() { // Tab delimited
|
343
|
-
|
343
|
+
let rowCount = this._elem.children.length;
|
344
344
|
if(rowCount > 0) {
|
345
|
-
|
346
|
-
for(
|
345
|
+
let str = this.getRowTextContent(0);
|
346
|
+
for(let r = 1; r < rowCount; ++r) {
|
347
347
|
str += "\n" + this.getRowTextContent(r);
|
348
348
|
}
|
349
349
|
return str;
|
@@ -354,13 +354,13 @@ SubTable.prototype.getTableTextContent = function() { // Tab delimited
|
|
354
354
|
* @return {string}
|
355
355
|
*/
|
356
356
|
SubTable.prototype.toString = function() {
|
357
|
-
|
357
|
+
let str = this.getElement().outerHTML;
|
358
358
|
str = str.replace(/>\s+</g, "><");
|
359
359
|
str = str.replace(/><tr/g, ">\n\t<tr");
|
360
360
|
str = str.replace(/><td/g, ">\n\t\t<td");
|
361
361
|
str = str.replace(/><th/g, ">\n\t\t<th"); // TH can occur in thead
|
362
362
|
str = str.replace(/><\/tr/g, ">\n\t</tr");
|
363
|
-
|
363
|
+
let tagName = this.getElement().tagName.toLowerCase();
|
364
364
|
str = str.replace("</" + tagName, "\n</" + tagName);
|
365
365
|
return str;
|
366
366
|
};
|
@@ -373,15 +373,15 @@ SubTable.prototype.getColumnIndex = function(e) {
|
|
373
373
|
if(!e) {
|
374
374
|
return -1;
|
375
375
|
}
|
376
|
-
|
377
|
-
|
376
|
+
let len, i;
|
377
|
+
let tgt = /** @type{Node} */(e.target); // TODO: Support Shadow Root
|
378
378
|
if(this._elem.contains(tgt)) {
|
379
|
-
|
379
|
+
let tdElem = Dom.closestTagName(tgt, "TD");
|
380
380
|
if(!tdElem) {
|
381
381
|
tdElem = Dom.closestTagName(tgt, "TH");
|
382
382
|
}
|
383
383
|
if(tdElem) {
|
384
|
-
|
384
|
+
let chdr = tdElem.parentElement.children;
|
385
385
|
len = chdr.length;
|
386
386
|
for(i = 0; i < len; ++i) {
|
387
387
|
if(tdElem === chdr[i]) {
|
@@ -390,11 +390,11 @@ SubTable.prototype.getColumnIndex = function(e) {
|
|
390
390
|
}
|
391
391
|
}
|
392
392
|
} else { // In case of the target is not a child of this element
|
393
|
-
|
394
|
-
|
393
|
+
let rows = this._elem.children;
|
394
|
+
let cells = (rows[0]) ? rows[0].cells : null;
|
395
395
|
if(cells) {
|
396
|
-
|
397
|
-
|
396
|
+
let pos = Dom.getRelativePosition(e, this._elem);
|
397
|
+
let x = pos["x"];
|
398
398
|
if(x >= 0) {
|
399
399
|
len = cells.length;
|
400
400
|
for(i = 0; i < len; ++i) {
|
@@ -416,18 +416,18 @@ SubTable.prototype.getRowIndex = function(e) {
|
|
416
416
|
if(!e) {
|
417
417
|
return -1;
|
418
418
|
}
|
419
|
-
|
420
|
-
|
419
|
+
let rows = this._elem.children; // This return HTML collection
|
420
|
+
let rowCount = rows ? rows.length : 0;
|
421
421
|
if(!rowCount) {
|
422
422
|
return -1;
|
423
423
|
}
|
424
|
-
|
425
|
-
|
424
|
+
let i;
|
425
|
+
let tgt = /** @type{Node} */(e.target); // TODO: Support Shadow Root
|
426
426
|
if(this._elem.contains(tgt)) {
|
427
|
-
|
427
|
+
let trElem = Dom.closestTagName(tgt, "TR");
|
428
428
|
if(trElem) {
|
429
429
|
for(i = 0; i < rowCount; ++i) {
|
430
|
-
|
430
|
+
let row = rows[i];
|
431
431
|
if(row === trElem) {
|
432
432
|
return i;
|
433
433
|
}
|
@@ -436,8 +436,8 @@ SubTable.prototype.getRowIndex = function(e) {
|
|
436
436
|
}
|
437
437
|
|
438
438
|
// In case of the target is not a child of this element
|
439
|
-
|
440
|
-
|
439
|
+
let pos = Dom.getRelativePosition(e, this._elem);
|
440
|
+
let y = pos["y"];
|
441
441
|
if(y >= 0) {
|
442
442
|
for(i = 0; i < rowCount; ++i) {
|
443
443
|
y -= rows[i].offsetHeight;
|
@@ -454,7 +454,7 @@ SubTable.prototype.getRowIndex = function(e) {
|
|
454
454
|
* @return {number}
|
455
455
|
*/
|
456
456
|
SubTable.prototype.getColumnLeft = function(colIndex, rowIndex) {
|
457
|
-
|
457
|
+
let cell = this.getCell(colIndex, rowIndex ? rowIndex : 0);
|
458
458
|
if(cell) {
|
459
459
|
return cell.offsetLeft; // WARNING: Hidden cells or cell spanning can cause unexpected results
|
460
460
|
}
|
@@ -465,7 +465,7 @@ SubTable.prototype.getColumnLeft = function(colIndex, rowIndex) {
|
|
465
465
|
* @return {number}
|
466
466
|
*/
|
467
467
|
SubTable.prototype.getRowTop = function(rowRef) {
|
468
|
-
|
468
|
+
let row = null;
|
469
469
|
if(typeof rowRef === "number") {
|
470
470
|
row = this.getRow(rowRef);
|
471
471
|
} else {
|
@@ -481,7 +481,7 @@ SubTable.prototype.getRowTop = function(rowRef) {
|
|
481
481
|
SubTable.prototype.getCellPosition = function(cell, ret_obj) {
|
482
482
|
if(!ret_obj) { ret_obj = {}; }
|
483
483
|
ret_obj["x"] = cell.offsetLeft;
|
484
|
-
|
484
|
+
let pn = cell.parentNode; // Expecting tr element
|
485
485
|
ret_obj["y"] = (pn) ? pn.offsetTop : NaN;
|
486
486
|
return ret_obj;
|
487
487
|
};
|
@@ -500,7 +500,7 @@ SubTable.prototype.setCellRenderer = function(func) {
|
|
500
500
|
SubTable.prototype.cloak = function(elem, opt_elementType) {
|
501
501
|
if(elem) {
|
502
502
|
this._elem = elem;
|
503
|
-
|
503
|
+
let rows = elem.getElementsByTagName("TR");
|
504
504
|
this._colCount = rows[0] ? rows[0].children.length : 0;
|
505
505
|
}
|
506
506
|
};
|
@@ -513,7 +513,7 @@ SubTable.prototype.cloak = function(elem, opt_elementType) {
|
|
513
513
|
* @return {Element} Top left cell element
|
514
514
|
*/
|
515
515
|
SubTable.prototype.spanBlock = function (c1, c2, r1, r2) { // WARNING: It's c c r r
|
516
|
-
|
516
|
+
let cell = this.getCell(c1, r1);
|
517
517
|
if(!cell) {
|
518
518
|
return null;
|
519
519
|
}
|
@@ -523,13 +523,13 @@ SubTable.prototype.spanBlock = function (c1, c2, r1, r2) { // WARNING: It's c c
|
|
523
523
|
if(r2 < r1) {
|
524
524
|
r2 = r1;
|
525
525
|
}
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
526
|
+
let curColSpan = +cell.getAttribute("colspan");
|
527
|
+
let curRowSpan = +cell.getAttribute("rowspan");
|
528
|
+
let c3 = (curColSpan) ? c1 + curColSpan - 1 : c1;
|
529
|
+
let r3 = (curRowSpan) ? r1 + curRowSpan - 1 : r1;
|
530
530
|
|
531
531
|
// TODO: Optimize below logics
|
532
|
-
|
532
|
+
let c, r;
|
533
533
|
for(c = c3; c >= c1; --c) {
|
534
534
|
for(r = r3; r >= r1; --r) {
|
535
535
|
cell = this.getCell(c, r);
|
@@ -549,8 +549,8 @@ SubTable.prototype.spanBlock = function (c1, c2, r1, r2) { // WARNING: It's c c
|
|
549
549
|
}
|
550
550
|
|
551
551
|
if(cell) { // The last cell from the loop is the top left cell
|
552
|
-
|
553
|
-
|
552
|
+
let colSpan = (c2 - c1 + 1);
|
553
|
+
let rowSpan = (r2 - r1 + 1);
|
554
554
|
if(colSpan > 1) {
|
555
555
|
cell.setAttribute("colspan", colSpan);
|
556
556
|
} else {
|
@@ -577,7 +577,7 @@ SubTable.parseTableContent = function(tbl) {
|
|
577
577
|
return null;
|
578
578
|
}
|
579
579
|
|
580
|
-
|
580
|
+
let tbody = (tbl.tagName == "TBODY") ? tbl : tbl.getElementsByTagName("TBODY")[0];
|
581
581
|
if(!tbody) {
|
582
582
|
if(tbl.tagName == "TABLE") { // Table element can directly host tr element without tbody element
|
583
583
|
tbody = tbl;
|
@@ -587,16 +587,16 @@ SubTable.parseTableContent = function(tbl) {
|
|
587
587
|
return null;
|
588
588
|
}
|
589
589
|
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
for(
|
594
|
-
|
595
|
-
|
596
|
-
|
590
|
+
let trs = tbody.getElementsByTagName("TR");
|
591
|
+
let rowCount = trs.length;
|
592
|
+
let rows = new Array(rowCount);
|
593
|
+
for(let i = 0; i < rowCount; ++i) {
|
594
|
+
let tds = trs[i].getElementsByTagName("TD"); // TODO: Handle TH cell
|
595
|
+
let colCount = tds.length;
|
596
|
+
let columns = new Array(colCount);
|
597
597
|
|
598
598
|
rows[i] = columns;
|
599
|
-
for(
|
599
|
+
for(let j = 0; j < colCount; ++j) {
|
600
600
|
columns[j] = tds[j].textContent;
|
601
601
|
}
|
602
602
|
}
|
@@ -608,7 +608,7 @@ SubTable.parseTableContent = function(tbl) {
|
|
608
608
|
* @param {string} minHeight
|
609
609
|
*/
|
610
610
|
SubTable.prototype._applyDefaultRowHeight = function(rows, minHeight) {
|
611
|
-
for(
|
611
|
+
for(let r = rows.length; --r >= 0;) {
|
612
612
|
rows[r].style.height = minHeight;
|
613
613
|
}
|
614
614
|
};
|