@refinitiv-ui/efx-grid 6.0.90 → 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 +2446 -2625
- 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 +4 -0
- package/lib/core/es6/data/DataTable.js +219 -190
- package/lib/core/es6/data/DataView.d.ts +2 -0
- package/lib/core/es6/data/DataView.js +300 -292
- package/lib/core/es6/data/Segment.js +85 -83
- package/lib/core/es6/data/SegmentCollection.d.ts +2 -0
- package/lib/core/es6/data/SegmentCollection.js +91 -80
- 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 = {};
|
@@ -184,6 +184,17 @@ SegmentCollection.prototype.getSegment = function(rid) {
|
|
184
184
|
return this._segments[rid] || null;
|
185
185
|
};
|
186
186
|
/** @public
|
187
|
+
* @param {string} rid
|
188
|
+
* @return {Segment}
|
189
|
+
*/
|
190
|
+
SegmentCollection.prototype.getSegmentParent = function(rid) {
|
191
|
+
let parentRowId = this.getParentRowId(rid);
|
192
|
+
if(parentRowId) {
|
193
|
+
return this.getSegment(parentRowId);
|
194
|
+
}
|
195
|
+
return null;
|
196
|
+
};
|
197
|
+
/** @public
|
187
198
|
* @return {Object.<string, Segment>}
|
188
199
|
*/
|
189
200
|
SegmentCollection.prototype.getSegments = function() {
|
@@ -203,7 +214,7 @@ SegmentCollection.prototype.getSegmentIds = function() {
|
|
203
214
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
204
215
|
*/
|
205
216
|
SegmentCollection.prototype.collapseSegment = function(segmentId, bool) {
|
206
|
-
|
217
|
+
let segment = this._segments[segmentId];
|
207
218
|
if(segment) {
|
208
219
|
return segment.collapse(bool);
|
209
220
|
}
|
@@ -222,9 +233,9 @@ SegmentCollection.prototype.expandSegment = function(segmentId, bool) {
|
|
222
233
|
*/
|
223
234
|
SegmentCollection.prototype.expandAllSegments = function() {
|
224
235
|
if(this._segmentCount) {
|
225
|
-
|
226
|
-
|
227
|
-
for(
|
236
|
+
let segmentSeparators = this._segments;
|
237
|
+
let dirty = 0;
|
238
|
+
for(let rid in segmentSeparators) {
|
228
239
|
dirty |= segmentSeparators[rid].expand();
|
229
240
|
}
|
230
241
|
if(dirty) {
|
@@ -238,7 +249,7 @@ SegmentCollection.prototype.expandAllSegments = function() {
|
|
238
249
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
239
250
|
*/
|
240
251
|
SegmentCollection.prototype.isCollapsedSegment = function(segmentId) {
|
241
|
-
|
252
|
+
let segment = this._segments[segmentId];
|
242
253
|
if(segment) {
|
243
254
|
return segment.isCollapsed();
|
244
255
|
}
|
@@ -250,13 +261,13 @@ SegmentCollection.prototype.isCollapsedSegment = function(segmentId) {
|
|
250
261
|
SegmentCollection.prototype.getCollapsedRows = function() {
|
251
262
|
if(this._shared.dirtyCollapsingState) {
|
252
263
|
this._shared.dirtyCollapsingState = false;
|
253
|
-
|
254
|
-
|
264
|
+
let collapsedRids = null;
|
265
|
+
let count = 0;
|
255
266
|
if(this._segmentCount) {
|
256
|
-
|
267
|
+
let segmentSeparators = this._segments;
|
257
268
|
collapsedRids = {};
|
258
|
-
for(
|
259
|
-
|
269
|
+
for(let rid in segmentSeparators) {
|
270
|
+
let segment = segmentSeparators[rid];
|
260
271
|
if(!segment.isSubSegment()) {
|
261
272
|
if(segment.getCollapsingStates(collapsedRids)) {
|
262
273
|
++count;
|
@@ -276,7 +287,7 @@ SegmentCollection.prototype.getCollapsedRows = function() {
|
|
276
287
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
277
288
|
*/
|
278
289
|
SegmentCollection.prototype.addSegmentChild = function(segmentId, rid, dataId) {
|
279
|
-
|
290
|
+
let segment = this._segments[segmentId];
|
280
291
|
if(segment && !segment.isSubSegment()) {
|
281
292
|
return segment.addChild(rid, dataId);
|
282
293
|
}
|
@@ -289,7 +300,7 @@ SegmentCollection.prototype.addSegmentChild = function(segmentId, rid, dataId) {
|
|
289
300
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
290
301
|
*/
|
291
302
|
SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
|
292
|
-
|
303
|
+
let segment = this._segments[segmentId];
|
293
304
|
if(segment && !segment.isSubSegment()) {
|
294
305
|
return segment.addChildren(rids, dataIds);
|
295
306
|
}
|
@@ -301,7 +312,7 @@ SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids, dataI
|
|
301
312
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
302
313
|
*/
|
303
314
|
SegmentCollection.prototype.containsSegmentChild = function(segmentId, rid) {
|
304
|
-
|
315
|
+
let segment = this._segments[segmentId];
|
305
316
|
if(segment) {
|
306
317
|
return segment.containsChild(rid);
|
307
318
|
}
|
@@ -313,7 +324,7 @@ SegmentCollection.prototype.containsSegmentChild = function(segmentId, rid) {
|
|
313
324
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
314
325
|
*/
|
315
326
|
SegmentCollection.prototype.removeSegmentChild = function(segmentId, rid) {
|
316
|
-
|
327
|
+
let segment = this._segments[segmentId];
|
317
328
|
if(segment) {
|
318
329
|
return segment.removeChild(rid);
|
319
330
|
}
|
@@ -325,7 +336,7 @@ SegmentCollection.prototype.removeSegmentChild = function(segmentId, rid) {
|
|
325
336
|
* @return {boolean} Returns true if there is any change. Otherwise, returns false
|
326
337
|
*/
|
327
338
|
SegmentCollection.prototype.removeSegmentChildren = function(segmentId, rids) {
|
328
|
-
|
339
|
+
let segment = this._segments[segmentId];
|
329
340
|
if(segment) {
|
330
341
|
return segment.removeChildren(rids);
|
331
342
|
}
|
@@ -336,10 +347,10 @@ SegmentCollection.prototype.removeSegmentChildren = function(segmentId, rids) {
|
|
336
347
|
*/
|
337
348
|
SegmentCollection.prototype.removeAllSegmentChildren = function() {
|
338
349
|
this._shared.childToSegment = {};
|
339
|
-
|
340
|
-
|
341
|
-
for(
|
342
|
-
|
350
|
+
let segmentSeparators = this._segments;
|
351
|
+
let dirty = false;
|
352
|
+
for(let rid in segmentSeparators) {
|
353
|
+
let segment = segmentSeparators[rid];
|
343
354
|
if(segment.removeAllChildren()) {
|
344
355
|
dirty = true;
|
345
356
|
}
|
@@ -357,19 +368,19 @@ SegmentCollection.prototype.removeAllSegmentChildren = function() {
|
|
357
368
|
* @param {Array.<string>} rids
|
358
369
|
*/
|
359
370
|
SegmentCollection.prototype.fillSegment = function(segmentId, rids) {
|
360
|
-
|
371
|
+
let rowCount = Array.isArray(rids) ? rids.length : 0;
|
361
372
|
if(!rowCount) {
|
362
373
|
return;
|
363
374
|
}
|
364
|
-
|
365
|
-
|
375
|
+
let segmentSeparators = this._segments;
|
376
|
+
let curSegment = segmentSeparators[segmentId];
|
366
377
|
if(curSegment && !curSegment.isSubSegment()) {
|
367
|
-
|
378
|
+
let segmentAt = rids.indexOf(segmentId);
|
368
379
|
if(segmentAt >= 0) {
|
369
380
|
curSegment.removeAllChildren();
|
370
|
-
for(
|
371
|
-
|
372
|
-
|
381
|
+
for(let r = segmentAt + 1; r < rowCount; ++r) {
|
382
|
+
let rid = rids[r];
|
383
|
+
let segmentSeparator = segmentSeparators[rid];
|
373
384
|
if(segmentSeparator) {
|
374
385
|
break;
|
375
386
|
}
|
@@ -385,13 +396,13 @@ SegmentCollection.prototype.fillSegment = function(segmentId, rids) {
|
|
385
396
|
SegmentCollection.prototype.fillSegments = function(rids) {
|
386
397
|
this._shared.childToSegment = {};
|
387
398
|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
for(
|
393
|
-
|
394
|
-
|
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];
|
395
406
|
if(segmentSeparator && !segmentSeparator.isSubSegment()) {
|
396
407
|
curSegment = segmentSeparator;
|
397
408
|
curSegment.removeAllChildren();
|
@@ -406,20 +417,20 @@ SegmentCollection.prototype.fillSegments = function(rids) {
|
|
406
417
|
* @param {Array.<string>} rids
|
407
418
|
*/
|
408
419
|
SegmentCollection.prototype.calcSegmentOrder = function(rids) {
|
409
|
-
|
420
|
+
let segmentList = this._segmentList;
|
410
421
|
if(segmentList) {
|
411
422
|
segmentList.length = 0;
|
412
423
|
} else {
|
413
424
|
segmentList = this._segmentList = [];
|
414
425
|
}
|
415
426
|
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
for(
|
421
|
-
|
422
|
-
|
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];
|
423
434
|
if(segment) {
|
424
435
|
if(!segment.isSubSegment()) {
|
425
436
|
this._segmentList.push(segment);
|
@@ -437,20 +448,20 @@ SegmentCollection.prototype.calcSegmentOrder = function(rids) {
|
|
437
448
|
* @return {Array.<number>} Returns Array of segment values, if there are at least one segment, otherwise returns null
|
438
449
|
*/ //
|
439
450
|
SegmentCollection.prototype.getSegmentValues = function(rids, partial) {
|
440
|
-
|
451
|
+
let rowCount = rids ? rids.length : 0;
|
441
452
|
if(!rowCount) {
|
442
453
|
return null;
|
443
454
|
}
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
for(
|
453
|
-
|
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];
|
454
465
|
curSegment = segmentSeparators[rid];
|
455
466
|
if(curSegment) { // segment separator
|
456
467
|
segmentVal = curSegment.getOrder() * 100;
|
@@ -462,7 +473,7 @@ SegmentCollection.prototype.getSegmentValues = function(rids, partial) {
|
|
462
473
|
}
|
463
474
|
}
|
464
475
|
} else {
|
465
|
-
|
476
|
+
let parentId = childToSegmentId[rid];
|
466
477
|
if(parentId) { // segment member
|
467
478
|
curSegment = segmentSeparators[parentId];
|
468
479
|
segmentVal = curSegment.getOrder() * 100;
|
@@ -489,13 +500,13 @@ SegmentCollection.prototype.getSegmentValues = function(rids, partial) {
|
|
489
500
|
* @return {string}
|
490
501
|
*/
|
491
502
|
SegmentCollection.prototype.logStructure = function() {
|
492
|
-
|
503
|
+
let segmentList = this._segmentList;
|
493
504
|
if(!segmentList) {
|
494
505
|
return "";
|
495
506
|
}
|
496
|
-
|
497
|
-
|
498
|
-
for(
|
507
|
+
let segmentCount = segmentList.length;
|
508
|
+
let lines = [];
|
509
|
+
for(let i = 0; i < segmentCount; ++i) {
|
499
510
|
segmentList[i].log(lines);
|
500
511
|
}
|
501
512
|
|
@@ -505,10 +516,10 @@ SegmentCollection.prototype.logStructure = function() {
|
|
505
516
|
* @return {string}
|
506
517
|
*/
|
507
518
|
SegmentCollection.prototype.logRowIdMap = function() {
|
508
|
-
|
509
|
-
|
510
|
-
for(
|
511
|
-
|
519
|
+
let lines = [];
|
520
|
+
let childToSegmentId = this._shared.childToSegment;
|
521
|
+
for(let rid in childToSegmentId) {
|
522
|
+
let segmentId = childToSegmentId[rid];
|
512
523
|
lines.push(rid + " > " + segmentId);
|
513
524
|
}
|
514
525
|
|
@@ -522,7 +533,7 @@ SegmentCollection.prototype.logRowIdMap = function() {
|
|
522
533
|
* @return {boolean}
|
523
534
|
*/
|
524
535
|
SegmentCollection.prototype.setSegmentClassification = function(segmentId, fields) {
|
525
|
-
|
536
|
+
let segment = this._segments[segmentId];
|
526
537
|
if(segment) {
|
527
538
|
if(segment.setClassification(fields)) {
|
528
539
|
if(segment.getClassification()) {
|
@@ -555,9 +566,9 @@ SegmentCollection.prototype.classify = function(rows) {
|
|
555
566
|
}
|
556
567
|
this._classification = this._classifierChanged = false;
|
557
568
|
|
558
|
-
|
559
|
-
for(
|
560
|
-
|
569
|
+
let segmentSeparators = this._segments;
|
570
|
+
for(let rid in segmentSeparators) {
|
571
|
+
let segment = this._segments[rid];
|
561
572
|
if(!segment.isSubSegment()) {
|
562
573
|
if(segment.getClassification()) {
|
563
574
|
this._classification = true;
|
@@ -585,9 +596,9 @@ SegmentCollection.prototype.classify = function(rows) {
|
|
585
596
|
* @param {!Object} e
|
586
597
|
*/
|
587
598
|
SegmentCollection.prototype._onSubSegmentAdded = function(e) {
|
588
|
-
|
599
|
+
let rid = e["rid"];
|
589
600
|
if(!this._segments[rid]) {
|
590
|
-
|
601
|
+
let segment = /** @type{Segment} */(e["segment"]);
|
591
602
|
this._insertionList.push(segment);
|
592
603
|
this._segments[rid] = segment;
|
593
604
|
this._segmentCount++;
|
@@ -602,7 +613,7 @@ SegmentCollection.prototype._onSubSegmentAdded = function(e) {
|
|
602
613
|
* @param {!Object} e
|
603
614
|
*/
|
604
615
|
SegmentCollection.prototype._onSubSegmentRemoved = function(e) {
|
605
|
-
|
616
|
+
let rid = e["rid"];
|
606
617
|
this.removeSegment(rid);
|
607
618
|
};
|
608
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
|
*/
|