@refinitiv-ui/efx-grid 6.0.90 → 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 +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
|
@@ -6,7 +6,7 @@ import EventDispatcher from "../../../tr-grid-util/es6/EventDispatcher.js";
|
|
|
6
6
|
* @param {string} rid
|
|
7
7
|
* @param {!Object} sharedObj
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
let Segment = function(rid, sharedObj) {
|
|
10
10
|
this._rid = rid;
|
|
11
11
|
this._children = {};
|
|
12
12
|
this._shared = sharedObj;
|
|
@@ -114,11 +114,11 @@ Segment.prototype.dispose = function() {
|
|
|
114
114
|
this._disposed = true;
|
|
115
115
|
|
|
116
116
|
this.removeAllEventListeners();
|
|
117
|
-
|
|
117
|
+
let segmentNames = this._subSegNames;
|
|
118
118
|
if(segmentNames) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
for(
|
|
119
|
+
let segmentCount = segmentNames.length;
|
|
120
|
+
let segmentMap = this._subSegMap;
|
|
121
|
+
for(let i = 0; i < segmentCount; ++i) {
|
|
122
122
|
segmentMap[segmentNames[i]].dispose();
|
|
123
123
|
}
|
|
124
124
|
this._subSegMap = this._subSegNames = null;
|
|
@@ -150,16 +150,16 @@ Segment.prototype.getParentId = function() {
|
|
|
150
150
|
* @return {Array.<string>}
|
|
151
151
|
*/
|
|
152
152
|
Segment.prototype.getSubSegmentIds = function(out_ary) {
|
|
153
|
-
|
|
153
|
+
let segmentNames = this._subSegNames;
|
|
154
154
|
if(segmentNames) {
|
|
155
155
|
if(!out_ary) {
|
|
156
156
|
out_ary = [];
|
|
157
157
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
for(
|
|
161
|
-
|
|
162
|
-
|
|
158
|
+
let segmentCount = segmentNames.length;
|
|
159
|
+
let segmentMap = this._subSegMap;
|
|
160
|
+
for(let i = 0; i < segmentCount; ++i) {
|
|
161
|
+
let segmentName = segmentNames[i];
|
|
162
|
+
let segment = segmentMap[segmentName];
|
|
163
163
|
out_ary.push(segment.getId());
|
|
164
164
|
segment.getSubSegmentIds(out_ary);
|
|
165
165
|
}
|
|
@@ -176,10 +176,12 @@ Segment.prototype.getSubSegmentIds = function(out_ary) {
|
|
|
176
176
|
Segment.prototype.addChild = function(rid, dataId) {
|
|
177
177
|
if(rid) {
|
|
178
178
|
this._shared.childToSegment[rid] = this._rid;
|
|
179
|
-
if(this.
|
|
180
|
-
this.
|
|
181
|
-
}
|
|
182
|
-
|
|
179
|
+
if(this._children[rid]) {
|
|
180
|
+
this._children[rid] = dataId || rid; // Update data id
|
|
181
|
+
} else {
|
|
182
|
+
if(this._collapsed) {
|
|
183
|
+
this._shared.dirtyCollapsingState = true; // TODO: Check if we need to update this only when new child is added
|
|
184
|
+
}
|
|
183
185
|
this._children[rid] = dataId || rid;
|
|
184
186
|
++this._childCount;
|
|
185
187
|
return true;
|
|
@@ -193,10 +195,10 @@ Segment.prototype.addChild = function(rid, dataId) {
|
|
|
193
195
|
* @return {boolean}
|
|
194
196
|
*/
|
|
195
197
|
Segment.prototype.addChildren = function(rids, dataIds) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
let rowIds = Array.isArray(rids) ? rids : [rids];
|
|
199
|
+
let rowCount = rowIds.length;
|
|
200
|
+
let dirty = 0;
|
|
201
|
+
let i;
|
|
200
202
|
if(dataIds != null) {
|
|
201
203
|
dataIds = Array.isArray(dataIds) ? dataIds : [dataIds];
|
|
202
204
|
for(i = 0; i < rowCount; ++i) {
|
|
@@ -231,7 +233,7 @@ Segment.prototype.removeChild = function(rid) {
|
|
|
231
233
|
return false; // The specified rid is not a child of this segment
|
|
232
234
|
}
|
|
233
235
|
|
|
234
|
-
|
|
236
|
+
let objMap = this._shared.childToSegment;
|
|
235
237
|
delete objMap[rid];
|
|
236
238
|
delete this._children[rid]; // Slow
|
|
237
239
|
--this._childCount;
|
|
@@ -252,10 +254,10 @@ Segment.prototype.removeChildren = function(rids) {
|
|
|
252
254
|
if(!this._childCount) {
|
|
253
255
|
return false;
|
|
254
256
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
for(
|
|
257
|
+
let rowIds = Array.isArray(rids) ? rids : [rids];
|
|
258
|
+
let rowCount = rowIds.length;
|
|
259
|
+
let dirty = 0;
|
|
260
|
+
for(let i = 0; i < rowCount; ++i) {
|
|
259
261
|
dirty |= this.removeChild(rowIds[i]);
|
|
260
262
|
}
|
|
261
263
|
return dirty ? true : false;
|
|
@@ -270,9 +272,9 @@ Segment.prototype.removeAllChildren = function() {
|
|
|
270
272
|
if(!this._childCount) {
|
|
271
273
|
return false;
|
|
272
274
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
for(
|
|
275
|
+
let objMap = this._shared.childToSegment;
|
|
276
|
+
let chdr = this._children;
|
|
277
|
+
for(let rid in chdr) {
|
|
276
278
|
if(objMap[rid]) {
|
|
277
279
|
delete objMap[rid]; // TODO: Check if we need to do this
|
|
278
280
|
}
|
|
@@ -322,12 +324,12 @@ Segment.prototype.setClassification = function(fields) {
|
|
|
322
324
|
if(this._subSegLevel) {
|
|
323
325
|
return false; // non-root segment cannot be classified
|
|
324
326
|
}
|
|
325
|
-
|
|
327
|
+
let classifiers = null;
|
|
326
328
|
if(this._subSegDef) {
|
|
327
329
|
classifiers = this._subSegDef.classifiers;
|
|
328
330
|
}
|
|
329
331
|
|
|
330
|
-
|
|
332
|
+
let newClassifiers = null;
|
|
331
333
|
if(fields) {
|
|
332
334
|
if(typeof fields === "string") {
|
|
333
335
|
newClassifiers = [fields];
|
|
@@ -335,11 +337,11 @@ Segment.prototype.setClassification = function(fields) {
|
|
|
335
337
|
newClassifiers = fields;
|
|
336
338
|
}
|
|
337
339
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
+
let i;
|
|
341
|
+
let fieldCount = newClassifiers ? newClassifiers.length : 0;
|
|
340
342
|
|
|
341
343
|
if(fieldCount) {
|
|
342
|
-
|
|
344
|
+
let curCount = classifiers ? classifiers.length : 0;
|
|
343
345
|
if(curCount === fieldCount) { // Check duplication
|
|
344
346
|
for(i = 0; i < fieldCount; ++i) {
|
|
345
347
|
if(newClassifiers[i] !== classifiers[i]) {
|
|
@@ -375,11 +377,11 @@ Segment.prototype.setClassification = function(fields) {
|
|
|
375
377
|
* @return {boolean}
|
|
376
378
|
*/
|
|
377
379
|
Segment.prototype.classify = function(rows) {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
+
let classifiers = this._subSegDef ? this._subSegDef.classifiers : null;
|
|
381
|
+
let classifierCount = classifiers ? classifiers.length : 0;
|
|
380
382
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
+
let segmentNames = this._subSegNames;
|
|
384
|
+
let segmentCount = segmentNames ? segmentNames.length : 0;
|
|
383
385
|
|
|
384
386
|
if(!segmentCount) {
|
|
385
387
|
if(this._subSegLevel >= classifierCount) {
|
|
@@ -387,18 +389,18 @@ Segment.prototype.classify = function(rows) {
|
|
|
387
389
|
}
|
|
388
390
|
}
|
|
389
391
|
|
|
390
|
-
|
|
392
|
+
let sharedObj = this._shared;
|
|
391
393
|
if(this._collapsed) {
|
|
392
394
|
sharedObj.dirtyCollapsingState = true;
|
|
393
395
|
}
|
|
394
396
|
|
|
395
397
|
// Prepare existing sub segments for checking change in its members
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
398
|
+
let i;
|
|
399
|
+
let segmentName = "";
|
|
400
|
+
let nonExistenceGroups = {};
|
|
401
|
+
let removalCount = 0;
|
|
402
|
+
let segmentMap = this._subSegMap;
|
|
403
|
+
let segment = null;
|
|
402
404
|
if(segmentCount) {
|
|
403
405
|
removalCount = segmentCount;
|
|
404
406
|
for(i = 0; i < removalCount; ++i) {
|
|
@@ -417,21 +419,21 @@ Segment.prototype.classify = function(rows) {
|
|
|
417
419
|
}
|
|
418
420
|
|
|
419
421
|
// Loop through row children and assign them to their corresponding sub segment
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
422
|
+
let isRootSegment = !this._subSegLevel;
|
|
423
|
+
let rid;
|
|
424
|
+
let children = this._children;
|
|
423
425
|
if(this._subSegLevel < classifierCount && rows) {
|
|
424
426
|
if(!segmentMap) {
|
|
425
427
|
segmentMap = this._subSegMap = {};
|
|
426
428
|
segmentNames = this._subSegNames = [];
|
|
427
429
|
}
|
|
428
430
|
|
|
429
|
-
|
|
431
|
+
let classifier = classifiers[this._subSegLevel];
|
|
430
432
|
|
|
431
433
|
for(rid in children) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
434
|
+
let dataId = children[rid];
|
|
435
|
+
let record = rows[dataId];
|
|
436
|
+
let val = record ? record[classifier] : null; // WARNING: row could already be removed
|
|
435
437
|
|
|
436
438
|
sharedObj.childToSegment[rid] = this._rid; // Relocate child in case of it has been moved to a non existence group
|
|
437
439
|
|
|
@@ -480,7 +482,7 @@ Segment.prototype.classify = function(rows) {
|
|
|
480
482
|
segment = segmentMap[segmentName];
|
|
481
483
|
delete segmentMap[segmentName];
|
|
482
484
|
// TODO: Slow
|
|
483
|
-
|
|
485
|
+
let at = segmentNames.indexOf(segmentName);
|
|
484
486
|
if(at >= 0) {
|
|
485
487
|
segmentNames.splice(at, 1);
|
|
486
488
|
}
|
|
@@ -512,7 +514,7 @@ Segment.prototype.classify = function(rows) {
|
|
|
512
514
|
if(isRootSegment) { // If this is a root segment
|
|
513
515
|
if(this._subSegDef) {
|
|
514
516
|
if(segmentCount) {
|
|
515
|
-
|
|
517
|
+
let subSegments = this._subSegDef.subSegments = [];
|
|
516
518
|
this.getAllSubSegments(subSegments);
|
|
517
519
|
subSegments.forEach(Segment._assignSubSegmentOrder);
|
|
518
520
|
} else {
|
|
@@ -543,7 +545,7 @@ Segment.prototype.isSubSegment = function() {
|
|
|
543
545
|
*/
|
|
544
546
|
Segment.prototype.getFirstAncestor = function() {
|
|
545
547
|
if(this._subSegLevel && this._subSegDef) {
|
|
546
|
-
|
|
548
|
+
let ancestor = this._subSegDef.root;
|
|
547
549
|
return /** @type{Segment} */(ancestor) || null;
|
|
548
550
|
}
|
|
549
551
|
return null;
|
|
@@ -553,15 +555,15 @@ Segment.prototype.getFirstAncestor = function() {
|
|
|
553
555
|
* @return {Array.<Segment>}
|
|
554
556
|
*/
|
|
555
557
|
Segment.prototype.getAllSubSegments = function(out_ary) {
|
|
556
|
-
|
|
558
|
+
let segmentNames = this._subSegNames;
|
|
557
559
|
if(segmentNames) {
|
|
558
560
|
if(!out_ary) {
|
|
559
561
|
out_ary = [];
|
|
560
562
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
for(
|
|
564
|
-
|
|
563
|
+
let segmentMap = this._subSegMap;
|
|
564
|
+
let segmentCount = segmentNames.length;
|
|
565
|
+
for(let i = 0; i < segmentCount; ++i) {
|
|
566
|
+
let segment = segmentMap[segmentNames[i]];
|
|
565
567
|
out_ary.push(segment);
|
|
566
568
|
segment.getAllSubSegments(out_ary);
|
|
567
569
|
}
|
|
@@ -583,7 +585,7 @@ Segment.prototype.setRowData = function(rows, clsSource) {
|
|
|
583
585
|
if(!rows) {
|
|
584
586
|
return;
|
|
585
587
|
}
|
|
586
|
-
|
|
588
|
+
let row = rows[this._rid];
|
|
587
589
|
if(!row) {
|
|
588
590
|
row = rows[this._rid] = {};
|
|
589
591
|
}
|
|
@@ -596,7 +598,7 @@ Segment.prototype.setRowData = function(rows, clsSource) {
|
|
|
596
598
|
row = clsSource[this._rid] = {};
|
|
597
599
|
}
|
|
598
600
|
|
|
599
|
-
|
|
601
|
+
let segment = this;
|
|
600
602
|
while(segment && segment.isSubSegment()) {
|
|
601
603
|
segment.getSubSegmentName(row);
|
|
602
604
|
segment = segment._subSegParent;
|
|
@@ -608,8 +610,8 @@ Segment.prototype.setRowData = function(rows, clsSource) {
|
|
|
608
610
|
*/
|
|
609
611
|
Segment.prototype.getSubSegmentName = function(row) {
|
|
610
612
|
if(row && this._subSegLevel) {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
+
let classifiers = this.getClassification();
|
|
614
|
+
let field = classifiers[this._subSegLevel - 1];
|
|
613
615
|
if(field) {
|
|
614
616
|
row[field] = this._subSegName;
|
|
615
617
|
}
|
|
@@ -649,7 +651,7 @@ Segment.prototype.isCollapsed = function() {
|
|
|
649
651
|
* @return {boolean}
|
|
650
652
|
*/
|
|
651
653
|
Segment.prototype.getCollapsingStates = function(objMap, parentState) {
|
|
652
|
-
|
|
654
|
+
let segmentNames = this._subSegNames;
|
|
653
655
|
if(!this._subSegLevel) { // Only root segment
|
|
654
656
|
if(!segmentNames) { // No sub segment
|
|
655
657
|
if(!this._collapsed) {
|
|
@@ -661,7 +663,7 @@ Segment.prototype.getCollapsingStates = function(objMap, parentState) {
|
|
|
661
663
|
if(!objMap) {
|
|
662
664
|
objMap = {};
|
|
663
665
|
}
|
|
664
|
-
|
|
666
|
+
let dirty = false;
|
|
665
667
|
if(this._subSegLevel) { // Sub segments are also subjected to collapsing
|
|
666
668
|
if(parentState) {
|
|
667
669
|
objMap[this._rid] = true;
|
|
@@ -669,20 +671,20 @@ Segment.prototype.getCollapsingStates = function(objMap, parentState) {
|
|
|
669
671
|
}
|
|
670
672
|
}
|
|
671
673
|
if(this._childCount) {
|
|
672
|
-
|
|
674
|
+
let collapsed = parentState || this._collapsed;
|
|
673
675
|
if(segmentNames) {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
for(
|
|
677
|
-
|
|
676
|
+
let segmentMap = this._subSegMap;
|
|
677
|
+
let segmentCount = segmentNames.length;
|
|
678
|
+
for(let i = 0; i < segmentCount; ++i) {
|
|
679
|
+
let segment = segmentMap[segmentNames[i]];
|
|
678
680
|
objMap[segment.getId()] = !!parentState;
|
|
679
681
|
if(segment.getCollapsingStates(objMap, collapsed)) {
|
|
680
682
|
dirty = true;
|
|
681
683
|
}
|
|
682
684
|
}
|
|
683
685
|
} else if(collapsed) {
|
|
684
|
-
|
|
685
|
-
for(
|
|
686
|
+
let chdr = this._children;
|
|
687
|
+
for(let rid in chdr) {
|
|
686
688
|
objMap[rid] = collapsed;
|
|
687
689
|
}
|
|
688
690
|
dirty = true;
|
|
@@ -696,7 +698,7 @@ Segment.prototype.getCollapsingStates = function(objMap, parentState) {
|
|
|
696
698
|
*/
|
|
697
699
|
Segment.prototype.getOrder = function() {
|
|
698
700
|
if(this._subSegLevel) {
|
|
699
|
-
|
|
701
|
+
let ancestor = this.getFirstAncestor();
|
|
700
702
|
if(ancestor) {
|
|
701
703
|
// WARNING: this._order cannot be greater than 9999
|
|
702
704
|
return ancestor.getOrder() + this._order;
|
|
@@ -710,9 +712,9 @@ Segment.prototype.getOrder = function() {
|
|
|
710
712
|
*/
|
|
711
713
|
Segment.prototype.getLastOrder = function() {
|
|
712
714
|
if(this._subSegDef) {
|
|
713
|
-
|
|
715
|
+
let subSegments = this._subSegDef.subSegments;
|
|
714
716
|
if(subSegments) {
|
|
715
|
-
|
|
717
|
+
let lastSegment = subSegments[subSegments.length - 1];
|
|
716
718
|
if(lastSegment) {
|
|
717
719
|
return lastSegment.getOrder();
|
|
718
720
|
}
|
|
@@ -736,29 +738,29 @@ Segment._tabs = null;
|
|
|
736
738
|
* @return {Array.<string>} lines
|
|
737
739
|
*/
|
|
738
740
|
Segment.prototype.log = function(lines) {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
+
let i;
|
|
742
|
+
let tabs = Segment._tabs;
|
|
741
743
|
if(!tabs) {
|
|
742
744
|
tabs = Segment._tabs = [];
|
|
743
|
-
|
|
745
|
+
let tabCh = "";
|
|
744
746
|
for(i = 0; i < 11; ++i) {
|
|
745
747
|
tabs[i] = tabCh;
|
|
746
748
|
tabCh += " ";
|
|
747
749
|
}
|
|
748
750
|
}
|
|
749
|
-
|
|
751
|
+
let collapsedCh = this._collapsed ? "+ " : "- ";
|
|
750
752
|
lines.push(tabs[this._subSegLevel] + collapsedCh + this._rid);
|
|
751
753
|
|
|
752
|
-
|
|
754
|
+
let segmentNames = this._subSegNames;
|
|
753
755
|
if(segmentNames) {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
+
let segmentCount = segmentNames.length;
|
|
757
|
+
let segmentMap = this._subSegMap;
|
|
756
758
|
for(i = 0; i < segmentCount; ++i) {
|
|
757
759
|
segmentMap[segmentNames[i]].log(lines);
|
|
758
760
|
}
|
|
759
761
|
} else if(this._childCount) {
|
|
760
|
-
|
|
761
|
-
for(
|
|
762
|
+
let indent = tabs[this._subSegLevel + 1];
|
|
763
|
+
for(let rid in this._children) {
|
|
762
764
|
lines.push(indent + "- " + rid);
|
|
763
765
|
}
|
|
764
766
|
}
|
|
@@ -24,6 +24,8 @@ declare class SegmentCollection extends EventDispatcher {
|
|
|
24
24
|
|
|
25
25
|
public getSegment(rid: string): Segment|null;
|
|
26
26
|
|
|
27
|
+
public getSegmentParent(rid: string): Segment|null;
|
|
28
|
+
|
|
27
29
|
public getSegments(): { [key: string]: Segment }|null;
|
|
28
30
|
|
|
29
31
|
public getSegmentIds(): (string)[];
|