@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
|
@@ -5,7 +5,7 @@ import Segment from "./Segment.js";
|
|
|
5
5
|
/** @constructor
|
|
6
6
|
* @extends {EventDispatcher}
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
let SegmentCollection = function() {
|
|
9
9
|
this._onSubSegmentAdded = this._onSubSegmentAdded.bind(this);
|
|
10
10
|
this._onSubSegmentRemoved = this._onSubSegmentRemoved.bind(this);
|
|
11
11
|
|
|
@@ -77,7 +77,7 @@ SegmentCollection.prototype.addSegment = function(rid, childRids) {
|
|
|
77
77
|
console.log("child of a segment cannot be set as a segment separator");
|
|
78
78
|
return false;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
let segment = this._segments[rid] = new Segment(rid, this._shared);
|
|
81
81
|
segment.addEventListener("subSegmentAdded", this._onSubSegmentAdded);
|
|
82
82
|
segment.addEventListener("subSegmentRemoved", this._onSubSegmentRemoved);
|
|
83
83
|
++this._segmentCount;
|
|
@@ -95,10 +95,10 @@ SegmentCollection.prototype.addSegment = function(rid, childRids) {
|
|
|
95
95
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
|
96
96
|
*/
|
|
97
97
|
SegmentCollection.prototype.addSegments = function(rids) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
for(
|
|
98
|
+
let rowIds = Array.isArray(rids) ? rids : [rids];
|
|
99
|
+
let rowCount = rowIds.length;
|
|
100
|
+
let dirty = 0;
|
|
101
|
+
for(let i = 0; i < rowCount; ++i) {
|
|
102
102
|
dirty |= this.addSegment(rowIds[i]);
|
|
103
103
|
}
|
|
104
104
|
return dirty ? true : false;
|
|
@@ -122,7 +122,7 @@ SegmentCollection.prototype.getParentRowId = function(rid) {
|
|
|
122
122
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
|
123
123
|
*/
|
|
124
124
|
SegmentCollection.prototype.removeSegment = function(rid) {
|
|
125
|
-
|
|
125
|
+
let segment = this._segments[rid];
|
|
126
126
|
if(segment) {
|
|
127
127
|
if(this._segmentCount <= 1) {
|
|
128
128
|
return this.removeAllSegments();
|
|
@@ -130,11 +130,11 @@ SegmentCollection.prototype.removeSegment = function(rid) {
|
|
|
130
130
|
if(segment.isSubSegment()) {
|
|
131
131
|
this._removalList.push(segment.getId());
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
let subSegIds = segment.getSubSegmentIds();
|
|
134
134
|
if(subSegIds) {
|
|
135
|
-
|
|
136
|
-
for(
|
|
137
|
-
|
|
135
|
+
let len = subSegIds.length;
|
|
136
|
+
for(let i = 0; i < len; ++i) {
|
|
137
|
+
let subSegId = subSegIds[i];
|
|
138
138
|
if(this._segments[subSegId]) {
|
|
139
139
|
this._removalList.push(subSegId);
|
|
140
140
|
delete this._segments[subSegId]; // Slow
|
|
@@ -156,7 +156,7 @@ SegmentCollection.prototype.removeSegment = function(rid) {
|
|
|
156
156
|
*/
|
|
157
157
|
SegmentCollection.prototype.removeAllSegments = function() {
|
|
158
158
|
if(this._segmentCount) {
|
|
159
|
-
for(
|
|
159
|
+
for(let key in this._segments) {
|
|
160
160
|
this._segments[key].dispose();
|
|
161
161
|
}
|
|
162
162
|
this._segments = {};
|
|
@@ -188,7 +188,7 @@ SegmentCollection.prototype.getSegment = function(rid) {
|
|
|
188
188
|
* @return {Segment}
|
|
189
189
|
*/
|
|
190
190
|
SegmentCollection.prototype.getSegmentParent = function(rid) {
|
|
191
|
-
|
|
191
|
+
let parentRowId = this.getParentRowId(rid);
|
|
192
192
|
if(parentRowId) {
|
|
193
193
|
return this.getSegment(parentRowId);
|
|
194
194
|
}
|
|
@@ -214,7 +214,7 @@ SegmentCollection.prototype.getSegmentIds = function() {
|
|
|
214
214
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
|
215
215
|
*/
|
|
216
216
|
SegmentCollection.prototype.collapseSegment = function(segmentId, bool) {
|
|
217
|
-
|
|
217
|
+
let segment = this._segments[segmentId];
|
|
218
218
|
if(segment) {
|
|
219
219
|
return segment.collapse(bool);
|
|
220
220
|
}
|
|
@@ -233,9 +233,9 @@ SegmentCollection.prototype.expandSegment = function(segmentId, bool) {
|
|
|
233
233
|
*/
|
|
234
234
|
SegmentCollection.prototype.expandAllSegments = function() {
|
|
235
235
|
if(this._segmentCount) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
for(
|
|
236
|
+
let segmentSeparators = this._segments;
|
|
237
|
+
let dirty = 0;
|
|
238
|
+
for(let rid in segmentSeparators) {
|
|
239
239
|
dirty |= segmentSeparators[rid].expand();
|
|
240
240
|
}
|
|
241
241
|
if(dirty) {
|
|
@@ -249,7 +249,7 @@ SegmentCollection.prototype.expandAllSegments = function() {
|
|
|
249
249
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
|
250
250
|
*/
|
|
251
251
|
SegmentCollection.prototype.isCollapsedSegment = function(segmentId) {
|
|
252
|
-
|
|
252
|
+
let segment = this._segments[segmentId];
|
|
253
253
|
if(segment) {
|
|
254
254
|
return segment.isCollapsed();
|
|
255
255
|
}
|
|
@@ -261,13 +261,13 @@ SegmentCollection.prototype.isCollapsedSegment = function(segmentId) {
|
|
|
261
261
|
SegmentCollection.prototype.getCollapsedRows = function() {
|
|
262
262
|
if(this._shared.dirtyCollapsingState) {
|
|
263
263
|
this._shared.dirtyCollapsingState = false;
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
let collapsedRids = null;
|
|
265
|
+
let count = 0;
|
|
266
266
|
if(this._segmentCount) {
|
|
267
|
-
|
|
267
|
+
let segmentSeparators = this._segments;
|
|
268
268
|
collapsedRids = {};
|
|
269
|
-
for(
|
|
270
|
-
|
|
269
|
+
for(let rid in segmentSeparators) {
|
|
270
|
+
let segment = segmentSeparators[rid];
|
|
271
271
|
if(!segment.isSubSegment()) {
|
|
272
272
|
if(segment.getCollapsingStates(collapsedRids)) {
|
|
273
273
|
++count;
|
|
@@ -287,7 +287,7 @@ SegmentCollection.prototype.getCollapsedRows = function() {
|
|
|
287
287
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
|
288
288
|
*/
|
|
289
289
|
SegmentCollection.prototype.addSegmentChild = function(segmentId, rid, dataId) {
|
|
290
|
-
|
|
290
|
+
let segment = this._segments[segmentId];
|
|
291
291
|
if(segment && !segment.isSubSegment()) {
|
|
292
292
|
return segment.addChild(rid, dataId);
|
|
293
293
|
}
|
|
@@ -300,7 +300,7 @@ SegmentCollection.prototype.addSegmentChild = function(segmentId, rid, dataId) {
|
|
|
300
300
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
|
301
301
|
*/
|
|
302
302
|
SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
|
|
303
|
-
|
|
303
|
+
let segment = this._segments[segmentId];
|
|
304
304
|
if(segment && !segment.isSubSegment()) {
|
|
305
305
|
return segment.addChildren(rids, dataIds);
|
|
306
306
|
}
|
|
@@ -312,7 +312,7 @@ SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids, dataI
|
|
|
312
312
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
|
313
313
|
*/
|
|
314
314
|
SegmentCollection.prototype.containsSegmentChild = function(segmentId, rid) {
|
|
315
|
-
|
|
315
|
+
let segment = this._segments[segmentId];
|
|
316
316
|
if(segment) {
|
|
317
317
|
return segment.containsChild(rid);
|
|
318
318
|
}
|
|
@@ -324,7 +324,7 @@ SegmentCollection.prototype.containsSegmentChild = function(segmentId, rid) {
|
|
|
324
324
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
|
325
325
|
*/
|
|
326
326
|
SegmentCollection.prototype.removeSegmentChild = function(segmentId, rid) {
|
|
327
|
-
|
|
327
|
+
let segment = this._segments[segmentId];
|
|
328
328
|
if(segment) {
|
|
329
329
|
return segment.removeChild(rid);
|
|
330
330
|
}
|
|
@@ -336,7 +336,7 @@ SegmentCollection.prototype.removeSegmentChild = function(segmentId, rid) {
|
|
|
336
336
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
|
337
337
|
*/
|
|
338
338
|
SegmentCollection.prototype.removeSegmentChildren = function(segmentId, rids) {
|
|
339
|
-
|
|
339
|
+
let segment = this._segments[segmentId];
|
|
340
340
|
if(segment) {
|
|
341
341
|
return segment.removeChildren(rids);
|
|
342
342
|
}
|
|
@@ -347,10 +347,10 @@ SegmentCollection.prototype.removeSegmentChildren = function(segmentId, rids) {
|
|
|
347
347
|
*/
|
|
348
348
|
SegmentCollection.prototype.removeAllSegmentChildren = function() {
|
|
349
349
|
this._shared.childToSegment = {};
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
for(
|
|
353
|
-
|
|
350
|
+
let segmentSeparators = this._segments;
|
|
351
|
+
let dirty = false;
|
|
352
|
+
for(let rid in segmentSeparators) {
|
|
353
|
+
let segment = segmentSeparators[rid];
|
|
354
354
|
if(segment.removeAllChildren()) {
|
|
355
355
|
dirty = true;
|
|
356
356
|
}
|
|
@@ -368,19 +368,19 @@ SegmentCollection.prototype.removeAllSegmentChildren = function() {
|
|
|
368
368
|
* @param {Array.<string>} rids
|
|
369
369
|
*/
|
|
370
370
|
SegmentCollection.prototype.fillSegment = function(segmentId, rids) {
|
|
371
|
-
|
|
371
|
+
let rowCount = Array.isArray(rids) ? rids.length : 0;
|
|
372
372
|
if(!rowCount) {
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
375
|
-
|
|
376
|
-
|
|
375
|
+
let segmentSeparators = this._segments;
|
|
376
|
+
let curSegment = segmentSeparators[segmentId];
|
|
377
377
|
if(curSegment && !curSegment.isSubSegment()) {
|
|
378
|
-
|
|
378
|
+
let segmentAt = rids.indexOf(segmentId);
|
|
379
379
|
if(segmentAt >= 0) {
|
|
380
380
|
curSegment.removeAllChildren();
|
|
381
|
-
for(
|
|
382
|
-
|
|
383
|
-
|
|
381
|
+
for(let r = segmentAt + 1; r < rowCount; ++r) {
|
|
382
|
+
let rid = rids[r];
|
|
383
|
+
let segmentSeparator = segmentSeparators[rid];
|
|
384
384
|
if(segmentSeparator) {
|
|
385
385
|
break;
|
|
386
386
|
}
|
|
@@ -396,13 +396,13 @@ SegmentCollection.prototype.fillSegment = function(segmentId, rids) {
|
|
|
396
396
|
SegmentCollection.prototype.fillSegments = function(rids) {
|
|
397
397
|
this._shared.childToSegment = {};
|
|
398
398
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
for(
|
|
404
|
-
|
|
405
|
-
|
|
399
|
+
let rowCount = Array.isArray(rids) ? rids.length : 0;
|
|
400
|
+
let segmentSeparators = this._segments;
|
|
401
|
+
let curSegment = null;
|
|
402
|
+
let change = false;
|
|
403
|
+
for(let r = 0; r < rowCount; ++r) {
|
|
404
|
+
let rid = rids[r];
|
|
405
|
+
let segmentSeparator = segmentSeparators[rid];
|
|
406
406
|
if(segmentSeparator && !segmentSeparator.isSubSegment()) {
|
|
407
407
|
curSegment = segmentSeparator;
|
|
408
408
|
curSegment.removeAllChildren();
|
|
@@ -417,20 +417,20 @@ SegmentCollection.prototype.fillSegments = function(rids) {
|
|
|
417
417
|
* @param {Array.<string>} rids
|
|
418
418
|
*/
|
|
419
419
|
SegmentCollection.prototype.calcSegmentOrder = function(rids) {
|
|
420
|
-
|
|
420
|
+
let segmentList = this._segmentList;
|
|
421
421
|
if(segmentList) {
|
|
422
422
|
segmentList.length = 0;
|
|
423
423
|
} else {
|
|
424
424
|
segmentList = this._segmentList = [];
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
for(
|
|
432
|
-
|
|
433
|
-
|
|
427
|
+
let ridCount = rids ? rids.length : 0;
|
|
428
|
+
let segmentSeparators = this._segments;
|
|
429
|
+
let segmentCount = this._segmentCount;
|
|
430
|
+
let order = 0;
|
|
431
|
+
for(let i = 0; i < ridCount; ++i) {
|
|
432
|
+
let rid = rids[i];
|
|
433
|
+
let segment = segmentSeparators[rid];
|
|
434
434
|
if(segment) {
|
|
435
435
|
if(!segment.isSubSegment()) {
|
|
436
436
|
this._segmentList.push(segment);
|
|
@@ -448,20 +448,20 @@ SegmentCollection.prototype.calcSegmentOrder = function(rids) {
|
|
|
448
448
|
* @return {Array.<number>} Returns Array of segment values, if there are at least one segment, otherwise returns null
|
|
449
449
|
*/ //
|
|
450
450
|
SegmentCollection.prototype.getSegmentValues = function(rids, partial) {
|
|
451
|
-
|
|
451
|
+
let rowCount = rids ? rids.length : 0;
|
|
452
452
|
if(!rowCount) {
|
|
453
453
|
return null;
|
|
454
454
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
for(
|
|
464
|
-
|
|
455
|
+
let segmentSeparators = this._segments;
|
|
456
|
+
let childToSegmentId = this._shared.childToSegment;
|
|
457
|
+
let curSegment = null;
|
|
458
|
+
let prevSegment = null;
|
|
459
|
+
let segmentValues = new Array(rowCount);
|
|
460
|
+
let segmentVal = 0;
|
|
461
|
+
let highestVal = -10;
|
|
462
|
+
let offset = 0;
|
|
463
|
+
for(let r = 0; r < rowCount; ++r) {
|
|
464
|
+
let rid = rids[r];
|
|
465
465
|
curSegment = segmentSeparators[rid];
|
|
466
466
|
if(curSegment) { // segment separator
|
|
467
467
|
segmentVal = curSegment.getOrder() * 100;
|
|
@@ -473,7 +473,7 @@ SegmentCollection.prototype.getSegmentValues = function(rids, partial) {
|
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
475
|
} else {
|
|
476
|
-
|
|
476
|
+
let parentId = childToSegmentId[rid];
|
|
477
477
|
if(parentId) { // segment member
|
|
478
478
|
curSegment = segmentSeparators[parentId];
|
|
479
479
|
segmentVal = curSegment.getOrder() * 100;
|
|
@@ -500,13 +500,13 @@ SegmentCollection.prototype.getSegmentValues = function(rids, partial) {
|
|
|
500
500
|
* @return {string}
|
|
501
501
|
*/
|
|
502
502
|
SegmentCollection.prototype.logStructure = function() {
|
|
503
|
-
|
|
503
|
+
let segmentList = this._segmentList;
|
|
504
504
|
if(!segmentList) {
|
|
505
505
|
return "";
|
|
506
506
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
for(
|
|
507
|
+
let segmentCount = segmentList.length;
|
|
508
|
+
let lines = [];
|
|
509
|
+
for(let i = 0; i < segmentCount; ++i) {
|
|
510
510
|
segmentList[i].log(lines);
|
|
511
511
|
}
|
|
512
512
|
|
|
@@ -516,10 +516,10 @@ SegmentCollection.prototype.logStructure = function() {
|
|
|
516
516
|
* @return {string}
|
|
517
517
|
*/
|
|
518
518
|
SegmentCollection.prototype.logRowIdMap = function() {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
for(
|
|
522
|
-
|
|
519
|
+
let lines = [];
|
|
520
|
+
let childToSegmentId = this._shared.childToSegment;
|
|
521
|
+
for(let rid in childToSegmentId) {
|
|
522
|
+
let segmentId = childToSegmentId[rid];
|
|
523
523
|
lines.push(rid + " > " + segmentId);
|
|
524
524
|
}
|
|
525
525
|
|
|
@@ -533,7 +533,7 @@ SegmentCollection.prototype.logRowIdMap = function() {
|
|
|
533
533
|
* @return {boolean}
|
|
534
534
|
*/
|
|
535
535
|
SegmentCollection.prototype.setSegmentClassification = function(segmentId, fields) {
|
|
536
|
-
|
|
536
|
+
let segment = this._segments[segmentId];
|
|
537
537
|
if(segment) {
|
|
538
538
|
if(segment.setClassification(fields)) {
|
|
539
539
|
if(segment.getClassification()) {
|
|
@@ -566,9 +566,9 @@ SegmentCollection.prototype.classify = function(rows) {
|
|
|
566
566
|
}
|
|
567
567
|
this._classification = this._classifierChanged = false;
|
|
568
568
|
|
|
569
|
-
|
|
570
|
-
for(
|
|
571
|
-
|
|
569
|
+
let segmentSeparators = this._segments;
|
|
570
|
+
for(let rid in segmentSeparators) {
|
|
571
|
+
let segment = this._segments[rid];
|
|
572
572
|
if(!segment.isSubSegment()) {
|
|
573
573
|
if(segment.getClassification()) {
|
|
574
574
|
this._classification = true;
|
|
@@ -596,9 +596,9 @@ SegmentCollection.prototype.classify = function(rows) {
|
|
|
596
596
|
* @param {!Object} e
|
|
597
597
|
*/
|
|
598
598
|
SegmentCollection.prototype._onSubSegmentAdded = function(e) {
|
|
599
|
-
|
|
599
|
+
let rid = e["rid"];
|
|
600
600
|
if(!this._segments[rid]) {
|
|
601
|
-
|
|
601
|
+
let segment = /** @type{Segment} */(e["segment"]);
|
|
602
602
|
this._insertionList.push(segment);
|
|
603
603
|
this._segments[rid] = segment;
|
|
604
604
|
this._segmentCount++;
|
|
@@ -613,7 +613,7 @@ SegmentCollection.prototype._onSubSegmentAdded = function(e) {
|
|
|
613
613
|
* @param {!Object} e
|
|
614
614
|
*/
|
|
615
615
|
SegmentCollection.prototype._onSubSegmentRemoved = function(e) {
|
|
616
|
-
|
|
616
|
+
let rid = e["rid"];
|
|
617
617
|
this.removeSegment(rid);
|
|
618
618
|
};
|
|
619
619
|
|
|
@@ -17,7 +17,7 @@ import ColumnStats from "./ColumnStats.js"; // eslint-disable-line
|
|
|
17
17
|
* @extends {EventDispatcher}
|
|
18
18
|
* @param {WrappedView~Options} options
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
let WrappedView = function(options) {
|
|
21
21
|
this._onDataChanged = this._onDataChanged.bind(this);
|
|
22
22
|
this._onWrapSizeChanged = this._onWrapSizeChanged.bind(this);
|
|
23
23
|
|
|
@@ -71,7 +71,7 @@ WrappedView.prototype._dataConflator = null;
|
|
|
71
71
|
*/
|
|
72
72
|
WrappedView.prototype._onDataChanged = function(e) {
|
|
73
73
|
if(this._dv) {
|
|
74
|
-
|
|
74
|
+
let rids = this._dv.getVisibleRowIds(true);
|
|
75
75
|
if(this._refreshRids(rids)) {
|
|
76
76
|
if(!e["globalChange"]) {
|
|
77
77
|
e["globalChange"] = true; // TODO: Optimize how we to dispatch globalChange
|
|
@@ -94,11 +94,11 @@ WrappedView.prototype._onWrapSizeChanged = function(e) {
|
|
|
94
94
|
* @return {boolean} Returns true if there is any change
|
|
95
95
|
*/
|
|
96
96
|
WrappedView.prototype._refreshRids = function(rids) {
|
|
97
|
-
|
|
97
|
+
let dirty = false;
|
|
98
98
|
if(this._dv && Array.isArray(rids)) {
|
|
99
|
-
|
|
99
|
+
let wrapSize = this.getWrapSize();
|
|
100
100
|
if(wrapSize > 0) {
|
|
101
|
-
|
|
101
|
+
let startIndex = wrapSize * this._wrapIndex;
|
|
102
102
|
|
|
103
103
|
if(startIndex < rids.length) {
|
|
104
104
|
dirty = true;
|
|
@@ -145,12 +145,12 @@ WrappedView.prototype.getRowData = function(rid) {
|
|
|
145
145
|
* @return {!Array}
|
|
146
146
|
*/
|
|
147
147
|
WrappedView.prototype.getColumnData = function(cid, inclNonDataRow) {
|
|
148
|
-
|
|
148
|
+
let rids = this.getAllRowIds(true, inclNonDataRow);
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
for(
|
|
153
|
-
|
|
150
|
+
let rows = [];
|
|
151
|
+
let len = rids.length;
|
|
152
|
+
for(let r = 0; r < len; ++r) {
|
|
153
|
+
let rowData = this._dt.getRowData(rids[r]);
|
|
154
154
|
if(rowData) {
|
|
155
155
|
rows.push(rowData[cid]);
|
|
156
156
|
} else if(inclNonDataRow) {
|
|
@@ -182,11 +182,11 @@ WrappedView.prototype._toRowId = function(rowRef) {
|
|
|
182
182
|
* @return {!Array.<string>}
|
|
183
183
|
*/
|
|
184
184
|
WrappedView.prototype._toRowIds = function(rowRefs) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
for(
|
|
189
|
-
|
|
185
|
+
let rowCount = Array.isArray(rowRefs) ? rowRefs.length : 0;
|
|
186
|
+
let ary = new Array(rowCount);
|
|
187
|
+
let rids = this._rids;
|
|
188
|
+
for(let r = 0; r < rowCount; ++r) {
|
|
189
|
+
let rowRef = rowRefs[r];
|
|
190
190
|
if(typeof rowRef === "number") {
|
|
191
191
|
ary[r] = rids[rowRef] || "";
|
|
192
192
|
} else {
|
|
@@ -323,7 +323,7 @@ WrappedView.prototype.setColumnData = function(cid, valueList, opt_ridList) {
|
|
|
323
323
|
* @return {boolean} Return true if there is any change, and false otherwise
|
|
324
324
|
*/
|
|
325
325
|
WrappedView.prototype.setDataAt = function(rowIndex, cid, value) {
|
|
326
|
-
|
|
326
|
+
let rid = this.getRowId(rowIndex);
|
|
327
327
|
if(rid && this._dt) {
|
|
328
328
|
return this._dt.setData(rid, cid, value);
|
|
329
329
|
}
|
|
@@ -337,7 +337,7 @@ WrappedView.prototype.setDataAt = function(rowIndex, cid, value) {
|
|
|
337
337
|
* @return {boolean} Return true if there is any change, and false otherwise
|
|
338
338
|
*/
|
|
339
339
|
WrappedView.prototype.setRowDataAt = function(rowIndex, values, opt_eventArg) {
|
|
340
|
-
|
|
340
|
+
let rid = this.getRowId(rowIndex);
|
|
341
341
|
return this.setRowData(rid, values, opt_eventArg);
|
|
342
342
|
};
|
|
343
343
|
|
|
@@ -348,7 +348,7 @@ WrappedView.prototype.setRowDataAt = function(rowIndex, values, opt_eventArg) {
|
|
|
348
348
|
* @return {string} Return Row id that has been inserted or changed
|
|
349
349
|
*/
|
|
350
350
|
WrappedView.prototype.insertRow = function(rowRef, opt_values, opt_rid) { // Data changed event may be dispatched
|
|
351
|
-
|
|
351
|
+
let rowId = this._toRowId(rowRef);
|
|
352
352
|
return this._dv.insertRow(rowId, opt_values, opt_rid);
|
|
353
353
|
};
|
|
354
354
|
|
|
@@ -381,9 +381,9 @@ WrappedView.prototype.removeRows = function(rowRefs) {
|
|
|
381
381
|
* move(ary, 1, 0); // [1, 0, 2] Move index 1 to the position before index 0
|
|
382
382
|
*/
|
|
383
383
|
WrappedView.prototype.moveRow = function(fromRef, toRef) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
384
|
+
let toRid = this._toRowId(toRef);
|
|
385
|
+
let fromIndices = /** @type{!Array.<number>} */(Array.isArray(fromRef) ? fromRef : [fromRef]);
|
|
386
|
+
let fromRids = this._toRowIds(fromIndices);
|
|
387
387
|
|
|
388
388
|
// if(this._dt.hasSegmentation()) {
|
|
389
389
|
// this.synchronizeRowOrder();
|
|
@@ -459,8 +459,8 @@ WrappedView.prototype.sortOnce = function(cid, opt_sortOrder) {
|
|
|
459
459
|
* customLogic = function(a, b, sortOrder) {
|
|
460
460
|
* return (a - b) * sortOrder; // for numeric comparison
|
|
461
461
|
* };
|
|
462
|
-
*
|
|
463
|
-
*
|
|
462
|
+
* let dt = new DataTable();
|
|
463
|
+
* let dv = new DataView(dt);
|
|
464
464
|
* dv.setSortingLogic(customLogic);
|
|
465
465
|
* dv.sort("Column id", "ascending");
|
|
466
466
|
*/
|
|
@@ -510,7 +510,7 @@ WrappedView.prototype.hideRows = function(rowRefs, opt_show) {
|
|
|
510
510
|
* @public
|
|
511
511
|
*/
|
|
512
512
|
WrappedView.prototype.showRows = function(rowRefs, opt_show) {
|
|
513
|
-
|
|
513
|
+
let rids = this._toRowIds(rowRefs);
|
|
514
514
|
this._dv.showRows(rids, opt_show);
|
|
515
515
|
};
|
|
516
516
|
/** Unhide all rows
|
|
@@ -840,7 +840,7 @@ WrappedView.prototype.getGroupRows = function () {
|
|
|
840
840
|
* @return {number}
|
|
841
841
|
*/
|
|
842
842
|
WrappedView.prototype.getGroupLevel = function (rowRef) {
|
|
843
|
-
|
|
843
|
+
let rowId = this._toRowId(rowRef);
|
|
844
844
|
return this._dv.getGroupLevel(rowId);
|
|
845
845
|
};
|
|
846
846
|
|
|
@@ -967,7 +967,7 @@ WrappedView.prototype.removeRowExpansion = function(rid) {
|
|
|
967
967
|
* @param {number=} count=1
|
|
968
968
|
*/
|
|
969
969
|
WrappedView.prototype.toggleRowExpansion = function(rowRef, force, count) {
|
|
970
|
-
|
|
970
|
+
let rid = this._toRowId(rowRef);
|
|
971
971
|
this._dv.toggleRowExpansion(rid, force, count);
|
|
972
972
|
};
|
|
973
973
|
/** @public
|
|
@@ -1045,7 +1045,7 @@ WrappedView.prototype.searchAll = function(searchLogic, opt_out) {
|
|
|
1045
1045
|
* @return {number} Row index
|
|
1046
1046
|
*/
|
|
1047
1047
|
WrappedView.prototype.searchPrev = function(rowRef, searchLogic) {
|
|
1048
|
-
|
|
1048
|
+
let rid = this._toRowId(rowRef);
|
|
1049
1049
|
return this._dv.searchPrev(rid, searchLogic);
|
|
1050
1050
|
};
|
|
1051
1051
|
/**
|
|
@@ -1055,7 +1055,7 @@ WrappedView.prototype.searchPrev = function(rowRef, searchLogic) {
|
|
|
1055
1055
|
* @return {number} Row index
|
|
1056
1056
|
*/
|
|
1057
1057
|
WrappedView.prototype.searchNext = function(rowRef, searchLogic) {
|
|
1058
|
-
|
|
1058
|
+
let rid = this._toRowId(rowRef);
|
|
1059
1059
|
return this._dv.searchNext(rid, searchLogic);
|
|
1060
1060
|
};
|
|
1061
1061
|
|
|
@@ -1097,7 +1097,7 @@ WrappedView.prototype.synchronizeRowOrder = function() {
|
|
|
1097
1097
|
* @return {boolean} Return true if there is any change
|
|
1098
1098
|
*/
|
|
1099
1099
|
WrappedView.prototype.setSegmentSeparator = function(rowRef, enabled) {
|
|
1100
|
-
|
|
1100
|
+
let rowId = this._toRowId(rowRef);
|
|
1101
1101
|
return this._dv.setSegmentSeparator(rowId, enabled);
|
|
1102
1102
|
};
|
|
1103
1103
|
/**
|
|
@@ -1137,7 +1137,7 @@ WrappedView.prototype.getSegmentParentRowId = function(rid) {
|
|
|
1137
1137
|
* @return {boolean} Return true if there is any change
|
|
1138
1138
|
*/
|
|
1139
1139
|
WrappedView.prototype.collapseSegment = function(rowRef, collapsed) {
|
|
1140
|
-
|
|
1140
|
+
let rid = this._toRowId(rowRef);
|
|
1141
1141
|
return this._dv.collapseSegment(rid, collapsed);
|
|
1142
1142
|
};
|
|
1143
1143
|
/** @public
|
|
@@ -1164,7 +1164,7 @@ WrappedView.prototype.setSegmentCollapsingLogic = function() {};
|
|
|
1164
1164
|
* @return {boolean} Return true if only the given row is a collapsed segment separator
|
|
1165
1165
|
*/
|
|
1166
1166
|
WrappedView.prototype.isSegmentCollapsed = function(rowRef) {
|
|
1167
|
-
|
|
1167
|
+
let rid = this._toRowId(rowRef);
|
|
1168
1168
|
return this._dv.isSegmentCollapsed(rid);
|
|
1169
1169
|
};
|
|
1170
1170
|
/** Remove existing segment children and fill the segments with all contnet rows before the next segment separator
|
|
@@ -1172,7 +1172,7 @@ WrappedView.prototype.isSegmentCollapsed = function(rowRef) {
|
|
|
1172
1172
|
* @param {string|number} segmentRef Row id or row index
|
|
1173
1173
|
*/
|
|
1174
1174
|
WrappedView.prototype.fillSegment = function(segmentRef) {
|
|
1175
|
-
|
|
1175
|
+
let rid = this._toRowId(segmentRef);
|
|
1176
1176
|
this._dv.fillSegment(rid);
|
|
1177
1177
|
};
|
|
1178
1178
|
/** Remove all existing segment children in each segment and fill the segments with all contnet rows before the next segment separator
|
|
@@ -1187,8 +1187,8 @@ WrappedView.prototype.fillSegments = function() {
|
|
|
1187
1187
|
* @return {boolean} Return true if there is any change
|
|
1188
1188
|
*/
|
|
1189
1189
|
WrappedView.prototype.addSegmentChild = function(segmentRef, rowRef) {
|
|
1190
|
-
|
|
1191
|
-
|
|
1190
|
+
let segmentId = this._toRowId(segmentRef);
|
|
1191
|
+
let rowId = this._toRowId(rowRef);
|
|
1192
1192
|
return this._dv.addSegmentChild(segmentId, rowId);
|
|
1193
1193
|
};
|
|
1194
1194
|
/** @public
|
|
@@ -1197,8 +1197,8 @@ WrappedView.prototype.addSegmentChild = function(segmentRef, rowRef) {
|
|
|
1197
1197
|
* @return {boolean} Return true if there is any change
|
|
1198
1198
|
*/
|
|
1199
1199
|
WrappedView.prototype.addSegmentChildren = function(segmentRef, rowRefs) {
|
|
1200
|
-
|
|
1201
|
-
|
|
1200
|
+
let segmentId = this._toRowId(segmentRef);
|
|
1201
|
+
let rowIds = this._toRowIds(rowRefs);
|
|
1202
1202
|
return this._dv.addSegmentChildren(segmentId, rowIds);
|
|
1203
1203
|
};
|
|
1204
1204
|
/** @public
|
|
@@ -1207,8 +1207,8 @@ WrappedView.prototype.addSegmentChildren = function(segmentRef, rowRefs) {
|
|
|
1207
1207
|
* @return {boolean} Return true if there is any change
|
|
1208
1208
|
*/
|
|
1209
1209
|
WrappedView.prototype.removeSegmentChild = function(segmentRef, rowRef) {
|
|
1210
|
-
|
|
1211
|
-
|
|
1210
|
+
let segmentId = this._toRowId(segmentRef);
|
|
1211
|
+
let rowId = this._toRowId(rowRef);
|
|
1212
1212
|
return this._dv.removeSegmentChild(segmentId, rowId);
|
|
1213
1213
|
};
|
|
1214
1214
|
/** @public
|
|
@@ -1217,8 +1217,8 @@ WrappedView.prototype.removeSegmentChild = function(segmentRef, rowRef) {
|
|
|
1217
1217
|
* @return {boolean} Return true if there is any change
|
|
1218
1218
|
*/
|
|
1219
1219
|
WrappedView.prototype.removeSegmentChildren = function(segmentRef, rowRefs) {
|
|
1220
|
-
|
|
1221
|
-
|
|
1220
|
+
let segmentId = this._toRowId(segmentRef);
|
|
1221
|
+
let rowIds = this._toRowIds(rowRefs);
|
|
1222
1222
|
return this._dv.removeSegmentChildren(segmentId, rowIds);
|
|
1223
1223
|
};
|
|
1224
1224
|
/** @public
|
|
@@ -1296,7 +1296,7 @@ WrappedView.prototype.dump = function(opt_options) {
|
|
|
1296
1296
|
//}
|
|
1297
1297
|
dv.log({"rowCount": 10}); // Showing 10 records
|
|
1298
1298
|
dv.log({"getter": function(rowData, colName){
|
|
1299
|
-
|
|
1299
|
+
let complexData = rowData[colName];
|
|
1300
1300
|
return complextData.someProperty;
|
|
1301
1301
|
}});
|
|
1302
1302
|
*/
|