@refinitiv-ui/efx-grid 6.0.157 → 6.0.159
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-selection-dialog/lib/column-selection-dialog.d.ts +4 -1
- package/lib/column-selection-dialog/lib/column-selection-dialog.js +36 -25
- package/lib/core/dist/core.js +205 -195
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.js +31 -17
- package/lib/core/es6/data/DataView.js +1 -0
- package/lib/core/es6/data/Segment.d.ts +4 -4
- package/lib/core/es6/data/Segment.js +67 -95
- package/lib/core/es6/data/SegmentCollection.d.ts +5 -1
- package/lib/core/es6/data/SegmentCollection.js +65 -76
- package/lib/core/es6/grid/Core.js +4 -1
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +37 -6
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +205 -195
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/types/es6/Core/data/Segment.d.ts +4 -4
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +5 -1
- package/lib/versions.json +2 -2
- package/package.json +1 -1
@@ -9153,6 +9153,12 @@ let Segment = function(rid, sharedObj) {
|
|
9153
9153
|
};
|
9154
9154
|
es6_Ext.inherits(Segment, es6_EventDispatcher);
|
9155
9155
|
|
9156
|
+
/** @public
|
9157
|
+
* @type {string}
|
9158
|
+
* @constant
|
9159
|
+
*/
|
9160
|
+
const UNCATEGORY = "Uncategorized";
|
9161
|
+
|
9156
9162
|
/** @private
|
9157
9163
|
* @function
|
9158
9164
|
* @param {string} a
|
@@ -9160,10 +9166,10 @@ es6_Ext.inherits(Segment, es6_EventDispatcher);
|
|
9160
9166
|
* @return {number}
|
9161
9167
|
*/
|
9162
9168
|
Segment._subSegSortLogic = function(a, b) {
|
9163
|
-
if(a ===
|
9169
|
+
if(a === UNCATEGORY) {
|
9164
9170
|
return 1;
|
9165
9171
|
}
|
9166
|
-
if(b ===
|
9172
|
+
if(b === UNCATEGORY) {
|
9167
9173
|
return -1;
|
9168
9174
|
}
|
9169
9175
|
|
@@ -9640,7 +9646,7 @@ Segment.prototype.classify = function(rows) {
|
|
9640
9646
|
|
9641
9647
|
sharedObj.childToSegment[rid] = this._rid; // Relocate child in case of it has been moved to a non existence group
|
9642
9648
|
|
9643
|
-
segmentName =
|
9649
|
+
segmentName = UNCATEGORY;
|
9644
9650
|
if(val || val === 0 || val === false) { // Check for null, undefined, "", and NaN value
|
9645
9651
|
segmentName = val + "";
|
9646
9652
|
}
|
@@ -9716,13 +9722,6 @@ Segment.prototype.classify = function(rows) {
|
|
9716
9722
|
}
|
9717
9723
|
}
|
9718
9724
|
|
9719
|
-
// Collecting all subsegments including all descendants and reassigning segment order.
|
9720
|
-
if(rootSegment && this._subSegDef) {
|
9721
|
-
if(segmentCount) {
|
9722
|
-
this.calcSubSegmentOrder(0);
|
9723
|
-
}
|
9724
|
-
// this._subSegDef.classifierChanged = false;
|
9725
|
-
}
|
9726
9725
|
return true;
|
9727
9726
|
};
|
9728
9727
|
/** SubSegment implies being classified
|
@@ -9790,65 +9789,68 @@ Segment.prototype.getAllSubSegments = function(out_ary) {
|
|
9790
9789
|
/** This method sets order, last order, and depth to entire tree structure in the segment, including the segment itself
|
9791
9790
|
* @public
|
9792
9791
|
* @param {number} counter
|
9793
|
-
* @
|
9792
|
+
* @param {number} rootOrder
|
9793
|
+
* @param {Object} ridMap Row id map that stores row order of the entire tree
|
9794
|
+
* @return {number} Last order of the segment
|
9794
9795
|
*/
|
9795
|
-
Segment.prototype.updateTreeStructure = function(counter) {
|
9796
|
+
Segment.prototype.updateTreeStructure = function(counter, rootOrder, ridMap) {
|
9796
9797
|
if(!counter) {
|
9797
9798
|
counter = 0;
|
9798
9799
|
if(!this._subSegment) { // Subsegment's depth cannot be reset back to 0
|
9799
9800
|
this._depth = 0; // WARNING: this assumes counter at 0 is the root segment
|
9800
9801
|
}
|
9801
9802
|
}
|
9802
|
-
if(
|
9803
|
-
|
9803
|
+
if(!rootOrder) {
|
9804
|
+
rootOrder = 0;
|
9804
9805
|
}
|
9805
|
-
|
9806
|
-
|
9807
|
-
|
9808
|
-
|
9809
|
-
|
9810
|
-
|
9811
|
-
|
9812
|
-
|
9813
|
-
|
9814
|
-
|
9806
|
+
if(!ridMap) {
|
9807
|
+
ridMap = {};
|
9808
|
+
}
|
9809
|
+
|
9810
|
+
let i;
|
9811
|
+
let segmentNames = this._subSegNames;
|
9812
|
+
let subSegmentCount = segmentNames ? segmentNames.length : 0;
|
9813
|
+
if(subSegmentCount) { // Classified segment
|
9814
|
+
let segmentMap = this._subSegMap;
|
9815
|
+
for(i = 0; i < subSegmentCount; ++i) {
|
9816
|
+
let subSegment = segmentMap[segmentNames[i]];
|
9817
|
+
++counter;
|
9818
|
+
ridMap[subSegment.getId()] = rootOrder + counter;
|
9819
|
+
subSegment.setOrder(counter);
|
9820
|
+
counter = subSegment.updateTreeStructure(counter, rootOrder, ridMap);
|
9815
9821
|
}
|
9816
|
-
|
9817
|
-
|
9818
|
-
|
9819
|
-
|
9822
|
+
} else {
|
9823
|
+
let childIds = this._childIds;
|
9824
|
+
let childCount = childIds.length;
|
9825
|
+
let segmentSeparators = this._shared.segments;
|
9826
|
+
let prevSeg = "";
|
9827
|
+
for(i = 0; i < childCount; ++i) {
|
9828
|
+
let childId = childIds[i];
|
9829
|
+
let childSegment = segmentSeparators[childId];
|
9830
|
+
let segmentId = (childSegment) ? childSegment.getId() : UNCATEGORY;
|
9831
|
+
if(prevSeg !== segmentId) {
|
9832
|
+
++counter;
|
9833
|
+
prevSeg = segmentId;
|
9834
|
+
}
|
9835
|
+
ridMap[childId] = rootOrder + counter;
|
9836
|
+
if(childSegment) {
|
9837
|
+
childSegment._depth = this._depth + 1;
|
9838
|
+
childSegment.setOrder(counter);
|
9839
|
+
counter = childSegment.updateTreeStructure(counter, rootOrder, ridMap);
|
9840
|
+
}
|
9820
9841
|
}
|
9821
9842
|
}
|
9822
9843
|
|
9823
9844
|
return this.setLastOrder(counter);
|
9824
9845
|
};
|
9825
|
-
/**
|
9846
|
+
/** Deprecated.
|
9847
|
+
* @ignore
|
9848
|
+
* @public
|
9849
|
+
* @function
|
9826
9850
|
* @param {number} counter
|
9827
9851
|
* @return {number}
|
9828
9852
|
*/
|
9829
|
-
Segment.prototype.calcSubSegmentOrder =
|
9830
|
-
if(!this.hasSubSegments()) {
|
9831
|
-
return this.setLastOrder(counter);
|
9832
|
-
}
|
9833
|
-
|
9834
|
-
let segmentMap = this._subSegMap;
|
9835
|
-
let childCount = this._subSegNames.length;
|
9836
|
-
let prevSeg = null;
|
9837
|
-
for(let i = 0; i < childCount; ++i) {
|
9838
|
-
let segmentName = this._subSegNames[i];
|
9839
|
-
let segment = segmentMap[segmentName];
|
9840
|
-
let segmentId = (segment) ? segment.getId() : "Uncategorized";
|
9841
|
-
if(prevSeg !== segmentId) {
|
9842
|
-
++counter; // 0 become 1
|
9843
|
-
prevSeg = segmentId;
|
9844
|
-
}
|
9845
|
-
if(segment) {
|
9846
|
-
segment.setOrder(counter);
|
9847
|
-
counter = segment.calcSubSegmentOrder(counter);
|
9848
|
-
}
|
9849
|
-
}
|
9850
|
-
return this.setLastOrder(counter);
|
9851
|
-
};
|
9853
|
+
Segment.prototype.calcSubSegmentOrder = Segment.prototype.updateTreeStructure;
|
9852
9854
|
/** @public
|
9853
9855
|
* @return {number}
|
9854
9856
|
*/
|
@@ -9898,14 +9900,6 @@ Segment.prototype.getSubSegmentName = function(row) {
|
|
9898
9900
|
return this._subSegName;
|
9899
9901
|
};
|
9900
9902
|
/**
|
9901
|
-
* @private
|
9902
|
-
* @param {!Segment} segment
|
9903
|
-
* @returns {string}
|
9904
|
-
*/
|
9905
|
-
let _toSegmentId = function(segment) {
|
9906
|
-
return segment.getId();
|
9907
|
-
};
|
9908
|
-
/**
|
9909
9903
|
* @public
|
9910
9904
|
* @param {!Function} comparer
|
9911
9905
|
* @returns {boolean} Returns true if there is any change
|
@@ -9915,26 +9909,17 @@ Segment.prototype.sortSegments = function(comparer) {
|
|
9915
9909
|
return false;
|
9916
9910
|
}
|
9917
9911
|
|
9918
|
-
let segmentList = [];
|
9919
|
-
let rids = [];
|
9920
9912
|
let childIds = this._childIds;
|
9921
9913
|
let childCount = childIds.length;
|
9922
9914
|
let segments = this._shared.segments;
|
9923
9915
|
for(let i = 0; i < childCount; ++i) {
|
9924
|
-
|
9925
|
-
|
9926
|
-
|
9927
|
-
segmentList.push(childSegment);
|
9928
|
-
} else {
|
9929
|
-
rids.push(childId);
|
9916
|
+
if(segments[childIds[i]]) {
|
9917
|
+
this._childIds.sort(comparer); // Perform segment sorting only if children have at least one segment
|
9918
|
+
return true;
|
9930
9919
|
}
|
9931
9920
|
}
|
9932
|
-
|
9933
|
-
|
9934
|
-
}
|
9935
|
-
segmentList.sort(comparer);
|
9936
|
-
this._childIds = rids.concat(segmentList.map(_toSegmentId));
|
9937
|
-
return true;
|
9921
|
+
|
9922
|
+
return false;
|
9938
9923
|
};
|
9939
9924
|
/** Get segment id and ids of children, including nested segments, but excluding sub segments
|
9940
9925
|
* @public
|
@@ -10048,28 +10033,15 @@ Segment.prototype.getCollapsingStates = function(objMap, parentState) {
|
|
10048
10033
|
return dirty;
|
10049
10034
|
};
|
10050
10035
|
|
10051
|
-
/** @private
|
10052
|
-
* @return {number}
|
10053
|
-
*/
|
10054
|
-
Segment.prototype._getOrder = function() {
|
10055
|
-
return this._order * 10000;
|
10056
|
-
};
|
10057
|
-
/** @private
|
10058
|
-
* @return {number}
|
10059
|
-
*/
|
10060
|
-
Segment.prototype._getLastOrder = function() {
|
10061
|
-
return this._getOrder() + this._offsetOrder;
|
10062
|
-
};
|
10063
10036
|
/** @public
|
10064
10037
|
* @return {number}
|
10065
10038
|
*/
|
10066
10039
|
Segment.prototype.getOrder = function() {
|
10067
10040
|
let ancestor = this.getFirstAncestor();
|
10068
10041
|
if(ancestor) {
|
10069
|
-
|
10070
|
-
return ancestor._getOrder() + this._order;
|
10042
|
+
return ancestor._order + this._order;
|
10071
10043
|
}
|
10072
|
-
return this.
|
10044
|
+
return this._order; // This is root order
|
10073
10045
|
};
|
10074
10046
|
/** Get the last (highest) order from the entire tree regardless of the current position segment in the hierachy
|
10075
10047
|
* @public
|
@@ -10078,10 +10050,9 @@ Segment.prototype.getOrder = function() {
|
|
10078
10050
|
Segment.prototype.getLastOrder = function() {
|
10079
10051
|
let ancestor = this.getFirstAncestor();
|
10080
10052
|
if(ancestor) {
|
10081
|
-
|
10082
|
-
return ancestor._getLastOrder();
|
10053
|
+
return ancestor.getLastOrder();
|
10083
10054
|
}
|
10084
|
-
return this.
|
10055
|
+
return this._order + this._offsetOrder; // This is root last order
|
10085
10056
|
};
|
10086
10057
|
/** @public
|
10087
10058
|
* @param {number} val
|
@@ -10089,12 +10060,13 @@ Segment.prototype.getLastOrder = function() {
|
|
10089
10060
|
Segment.prototype.setOrder = function(val) {
|
10090
10061
|
this._order = val;
|
10091
10062
|
};
|
10092
|
-
/**
|
10063
|
+
/** WARNING: This actually sets offset from the starting order
|
10064
|
+
* @public
|
10093
10065
|
* @param {number} val
|
10094
10066
|
* @returns {number} Returns the number set
|
10095
10067
|
*/
|
10096
10068
|
Segment.prototype.setLastOrder = function(val) {
|
10097
|
-
return (this._offsetOrder = val);
|
10069
|
+
return (this._offsetOrder = val); // WARNING: this._offsetOrder cannot be greater than 9999
|
10098
10070
|
};
|
10099
10071
|
|
10100
10072
|
/** @private
|
@@ -10162,7 +10134,7 @@ Segment.prototype.log = function(lines, tabLevel) {
|
|
10162
10134
|
};
|
10163
10135
|
|
10164
10136
|
|
10165
|
-
/* harmony default export */ const data_Segment = (Segment);
|
10137
|
+
/* harmony default export */ const data_Segment = ((/* unused pure expression or super */ null && (Segment)));
|
10166
10138
|
|
10167
10139
|
|
10168
10140
|
;// CONCATENATED MODULE: ./node_modules/@grid/core/es6/data/SegmentCollection.js
|
@@ -10210,7 +10182,7 @@ SegmentCollection.prototype._shared;
|
|
10210
10182
|
/** @type {Array.<Segment>}
|
10211
10183
|
* @private
|
10212
10184
|
*/
|
10213
|
-
SegmentCollection.prototype._segmentList = null; // Array of main segments
|
10185
|
+
SegmentCollection.prototype._segmentList = null; // Array of main/root segments
|
10214
10186
|
/** @type {Array.<Segment>}
|
10215
10187
|
* @private
|
10216
10188
|
*/
|
@@ -10227,6 +10199,10 @@ SegmentCollection.prototype._classification = false;
|
|
10227
10199
|
* @private
|
10228
10200
|
*/
|
10229
10201
|
SegmentCollection.prototype._classifierChanged = false;
|
10202
|
+
/** @type {Object.<string, number>}
|
10203
|
+
* @private
|
10204
|
+
*/
|
10205
|
+
SegmentCollection.prototype._rowOrders = null;
|
10230
10206
|
|
10231
10207
|
/** @public
|
10232
10208
|
*/
|
@@ -10234,7 +10210,7 @@ SegmentCollection.prototype.dispose = function() {
|
|
10234
10210
|
this.removeAllSegments();
|
10235
10211
|
this.removeAllEventListeners();
|
10236
10212
|
this._collapsedRids = null;
|
10237
|
-
this._segmentList = this._insertionList = this._removalList = null;
|
10213
|
+
this._segmentList = this._rowOrders = this._insertionList = this._removalList = null;
|
10238
10214
|
};
|
10239
10215
|
/** @public
|
10240
10216
|
* @param {string} rid
|
@@ -10243,11 +10219,11 @@ SegmentCollection.prototype.dispose = function() {
|
|
10243
10219
|
*/
|
10244
10220
|
SegmentCollection.prototype.addSegment = function(rid, childRids) {
|
10245
10221
|
if(rid && !this._segments[rid]) {
|
10246
|
-
let segment = this._segments[rid] = new
|
10222
|
+
let segment = this._segments[rid] = new Segment(rid, this._shared);
|
10247
10223
|
segment.addEventListener("subSegmentAdded", this._onSubSegmentAdded);
|
10248
10224
|
segment.addEventListener("subSegmentRemoved", this._onSubSegmentRemoved);
|
10249
10225
|
++this._segmentCount;
|
10250
|
-
this.
|
10226
|
+
this.invalidateSegmentOrder(); // order could be changed
|
10251
10227
|
|
10252
10228
|
if(childRids && childRids.length) {
|
10253
10229
|
segment.addChildren(childRids);
|
@@ -10323,6 +10299,7 @@ SegmentCollection.prototype.removeSegment = function(rid) {
|
|
10323
10299
|
|
10324
10300
|
delete this._segments[rid]; // Slow
|
10325
10301
|
--this._segmentCount;
|
10302
|
+
this.invalidateSegmentOrder();
|
10326
10303
|
return true;
|
10327
10304
|
};
|
10328
10305
|
/** @public
|
@@ -10335,7 +10312,7 @@ SegmentCollection.prototype.removeAllSegments = function() {
|
|
10335
10312
|
}
|
10336
10313
|
this._segments = {};
|
10337
10314
|
this._segmentCount = 0;
|
10338
|
-
this._segmentList = null;
|
10315
|
+
this._segmentList = this._rowOrders = null;
|
10339
10316
|
this._shared.segments = this._segments;
|
10340
10317
|
this._shared.childToSegment = {};
|
10341
10318
|
|
@@ -10396,6 +10373,7 @@ SegmentCollection.prototype.sortSegments = function(comparer) {
|
|
10396
10373
|
}
|
10397
10374
|
}
|
10398
10375
|
rootSegments.sort(comparer);
|
10376
|
+
this.invalidateSegmentOrder();
|
10399
10377
|
return rootSegments;
|
10400
10378
|
};
|
10401
10379
|
|
@@ -10491,28 +10469,14 @@ SegmentCollection.prototype.getCollapsedRows = function() {
|
|
10491
10469
|
return this._collapsedRids;
|
10492
10470
|
};
|
10493
10471
|
|
10494
|
-
/** Invalidate segment order cache
|
10495
|
-
* @
|
10496
|
-
* @param {string|Array.<string>} segmentIds
|
10472
|
+
/** Invalidate segment order cache
|
10473
|
+
* @public
|
10497
10474
|
* @returns {boolean} Returns true if there is any change
|
10498
10475
|
*/
|
10499
|
-
SegmentCollection.prototype.
|
10476
|
+
SegmentCollection.prototype.invalidateSegmentOrder = function() {
|
10500
10477
|
if(this._segmentList) {
|
10501
|
-
|
10502
|
-
|
10503
|
-
this._segmentList = null;
|
10504
|
-
return true;
|
10505
|
-
}
|
10506
|
-
} else if(Array.isArray(segmentIds)) {
|
10507
|
-
let len = segmentIds.length;
|
10508
|
-
for(let i = 0; i < len; ++i) {
|
10509
|
-
let segmentId = segmentIds[i];
|
10510
|
-
if(this._segments[segmentId]) {
|
10511
|
-
this._segmentList = null;
|
10512
|
-
return true;
|
10513
|
-
}
|
10514
|
-
}
|
10515
|
-
}
|
10478
|
+
this._segmentList = this._rowOrders = null;
|
10479
|
+
return true;
|
10516
10480
|
}
|
10517
10481
|
return false;
|
10518
10482
|
};
|
@@ -10526,7 +10490,7 @@ SegmentCollection.prototype.addSegmentChild = function(segmentId, rid, dataId) {
|
|
10526
10490
|
let segment = this._segments[segmentId];
|
10527
10491
|
if(segment && !segment.isSubSegment()) {
|
10528
10492
|
// If a segment becomes a child of other segment, then the segment order needs to be recalculated
|
10529
|
-
this.
|
10493
|
+
this.invalidateSegmentOrder();
|
10530
10494
|
return segment.addChild(rid, dataId);
|
10531
10495
|
}
|
10532
10496
|
return false;
|
@@ -10541,7 +10505,7 @@ SegmentCollection.prototype.addSegmentChildren = function(segmentId, rids, dataI
|
|
10541
10505
|
let segment = this._segments[segmentId];
|
10542
10506
|
if(segment && !segment.isSubSegment()) {
|
10543
10507
|
// If a segment becomes a child of other segment, then the segment order needs to be recalculated
|
10544
|
-
this.
|
10508
|
+
this.invalidateSegmentOrder();
|
10545
10509
|
return segment.addChildren(rids, dataIds);
|
10546
10510
|
}
|
10547
10511
|
return false;
|
@@ -10567,7 +10531,7 @@ SegmentCollection.prototype.containsSegmentChild = function(segmentId, rid) {
|
|
10567
10531
|
SegmentCollection.prototype.removeSegmentChild = function(segmentId, rid) {
|
10568
10532
|
let segment = this._segments[segmentId];
|
10569
10533
|
if(segment) {
|
10570
|
-
this.
|
10534
|
+
this.invalidateSegmentOrder();
|
10571
10535
|
return segment.removeChild(rid);
|
10572
10536
|
}
|
10573
10537
|
return false;
|
@@ -10580,7 +10544,7 @@ SegmentCollection.prototype.removeSegmentChild = function(segmentId, rid) {
|
|
10580
10544
|
SegmentCollection.prototype.removeSegmentChildren = function(segmentId, rids) {
|
10581
10545
|
let segment = this._segments[segmentId];
|
10582
10546
|
if(segment) {
|
10583
|
-
this.
|
10547
|
+
this.invalidateSegmentOrder();
|
10584
10548
|
return segment.removeChildren(rids);
|
10585
10549
|
}
|
10586
10550
|
return false;
|
@@ -10600,7 +10564,7 @@ SegmentCollection.prototype.removeAllSegmentChildren = function() {
|
|
10600
10564
|
}
|
10601
10565
|
|
10602
10566
|
if(dirty) {
|
10603
|
-
this.
|
10567
|
+
this.invalidateSegmentOrder();
|
10604
10568
|
this.classify(null);
|
10605
10569
|
}
|
10606
10570
|
|
@@ -10630,6 +10594,7 @@ SegmentCollection.prototype.fillSegment = function(segmentId, rids) {
|
|
10630
10594
|
}
|
10631
10595
|
curSegment.addChild(rid);
|
10632
10596
|
}
|
10597
|
+
this.invalidateSegmentOrder();
|
10633
10598
|
}
|
10634
10599
|
}
|
10635
10600
|
};
|
@@ -10655,8 +10620,19 @@ SegmentCollection.prototype.fillSegments = function(rids) {
|
|
10655
10620
|
change = true;
|
10656
10621
|
}
|
10657
10622
|
}
|
10623
|
+
if(change) {
|
10624
|
+
this.invalidateSegmentOrder();
|
10625
|
+
}
|
10658
10626
|
return change;
|
10659
10627
|
};
|
10628
|
+
|
10629
|
+
/** The number represent maximum nested segments that can be created in a single segment
|
10630
|
+
* @private
|
10631
|
+
* @type {number}
|
10632
|
+
* @constant
|
10633
|
+
*/
|
10634
|
+
const SEGMENT_STEP = 10000;
|
10635
|
+
|
10660
10636
|
/** @public
|
10661
10637
|
* @param {Array.<string>} rids
|
10662
10638
|
* @param {boolean=} useCache=false If this is true, skip the calculation when there is already a cache for segment order
|
@@ -10672,21 +10648,29 @@ SegmentCollection.prototype.calcSegmentOrder = function(rids, useCache) {
|
|
10672
10648
|
segmentList = this._segmentList = [];
|
10673
10649
|
}
|
10674
10650
|
|
10675
|
-
|
10651
|
+
this._rowOrders = {};
|
10652
|
+
let rowOrders = this._rowOrders;
|
10676
10653
|
let segmentSeparators = this._segments;
|
10677
|
-
let
|
10654
|
+
let childToSegmentId = this._shared.childToSegment;
|
10655
|
+
let prevSeg = UNCATEGORY;
|
10656
|
+
let ridCount = rids ? rids.length : 0;
|
10678
10657
|
let order = 0;
|
10679
10658
|
for(let i = 0; i < ridCount; ++i) {
|
10680
10659
|
let rid = rids[i];
|
10681
|
-
|
10682
|
-
|
10683
|
-
|
10684
|
-
|
10685
|
-
|
10686
|
-
|
10660
|
+
if(!childToSegmentId[rid]) {
|
10661
|
+
let segment = segmentSeparators[rid];
|
10662
|
+
let segmentId = (segment) ? segment.getId() : UNCATEGORY;
|
10663
|
+
if(prevSeg !== segmentId) {
|
10664
|
+
++order; // WARNING: Segments and sub segments start with 1
|
10665
|
+
prevSeg = segmentId;
|
10687
10666
|
}
|
10688
|
-
|
10689
|
-
|
10667
|
+
|
10668
|
+
let rootOrder = order * SEGMENT_STEP;
|
10669
|
+
rowOrders[rid] = rootOrder;
|
10670
|
+
if(segment) {
|
10671
|
+
this._segmentList.push(segment);
|
10672
|
+
segment.setOrder(rootOrder);
|
10673
|
+
segment.updateTreeStructure(0, rootOrder, rowOrders);
|
10690
10674
|
}
|
10691
10675
|
}
|
10692
10676
|
}
|
@@ -10695,57 +10679,33 @@ SegmentCollection.prototype.calcSegmentOrder = function(rids, useCache) {
|
|
10695
10679
|
* @param {!Array.<string>} rids Array of row ids
|
10696
10680
|
* @param {boolean=} partial Indicating that the given ids are not the whole list
|
10697
10681
|
* @return {Array.<number>} Returns Array of segment values, if there are at least one segment, otherwise returns null
|
10698
|
-
*/
|
10682
|
+
*/
|
10699
10683
|
SegmentCollection.prototype.getSegmentValues = function(rids, partial) {
|
10700
10684
|
let rowCount = rids ? rids.length : 0;
|
10701
10685
|
if(!rowCount) {
|
10702
10686
|
return null;
|
10703
10687
|
}
|
10704
|
-
let
|
10705
|
-
|
10706
|
-
|
10707
|
-
|
10688
|
+
let rowOrders = this._rowOrders;
|
10689
|
+
if(!rowOrders) { // calcSegmentOrder has not been called (no cache detected)
|
10690
|
+
return null;
|
10691
|
+
}
|
10692
|
+
|
10708
10693
|
let segmentValues = new Array(rowCount);
|
10709
|
-
let segmentVal = 0;
|
10710
10694
|
let highestVal = 0;
|
10711
|
-
let offset = 0;
|
10712
10695
|
for(let r = 0; r < rowCount; ++r) {
|
10713
10696
|
let rid = rids[r];
|
10714
|
-
|
10715
|
-
if(
|
10716
|
-
|
10717
|
-
|
10718
|
-
if(curSegment.isRootSegment()) {
|
10719
|
-
if(prevSegment !== curSegment) {
|
10720
|
-
prevSegment = curSegment;
|
10721
|
-
highestVal = curSegment.getLastOrder() * 100;
|
10722
|
-
}
|
10697
|
+
let segmentVal = rowOrders[rid];
|
10698
|
+
if(segmentVal != null) {
|
10699
|
+
if(highestVal < segmentVal) {
|
10700
|
+
highestVal = segmentVal;
|
10723
10701
|
}
|
10724
10702
|
} else {
|
10725
|
-
|
10726
|
-
if(parentId) { // segment member
|
10727
|
-
curSegment = segmentSeparators[parentId];
|
10728
|
-
segmentVal = curSegment.getOrder() * 100;
|
10729
|
-
offset = 1;
|
10730
|
-
if(partial) { // This fixes the out of order sub segment
|
10731
|
-
highestVal = curSegment.getLastOrder() * 100;
|
10732
|
-
}
|
10733
|
-
} else { // row outside of segments
|
10734
|
-
if(highestVal) {
|
10735
|
-
if(segmentVal < highestVal) {
|
10736
|
-
segmentVal = highestVal;
|
10737
|
-
}
|
10738
|
-
offset = 10;
|
10739
|
-
} else {
|
10740
|
-
segmentVal = offset = 0;
|
10741
|
-
}
|
10742
|
-
}
|
10703
|
+
segmentVal = highestVal ? highestVal + SEGMENT_STEP : 0;
|
10743
10704
|
}
|
10744
|
-
|
10745
|
-
segmentValues[r] = segmentVal + offset;
|
10705
|
+
segmentValues[r] = segmentVal;
|
10746
10706
|
}
|
10747
10707
|
|
10748
|
-
return
|
10708
|
+
return highestVal ? segmentValues : null;
|
10749
10709
|
};
|
10750
10710
|
/** @public
|
10751
10711
|
* @return {string}
|
@@ -10834,6 +10794,7 @@ SegmentCollection.prototype.classify = function(rows) {
|
|
10834
10794
|
}
|
10835
10795
|
}
|
10836
10796
|
if(this._insertionList.length || this._removalList.length) {
|
10797
|
+
this.invalidateSegmentOrder();
|
10837
10798
|
this._dispatch("subSegmentChanged", {
|
10838
10799
|
"insertionList": this._insertionList,
|
10839
10800
|
"removalList": this._removalList
|
@@ -10990,7 +10951,6 @@ DataTable.prototype._classifyingTimer = 0;
|
|
10990
10951
|
*/
|
10991
10952
|
DataTable.prototype._segmentDefaultCollapsing = false;
|
10992
10953
|
|
10993
|
-
|
10994
10954
|
/** @typedef {Function} DataTable~SortLogic
|
10995
10955
|
* @description SortLogic function is used for comparison between two values during sorting. <br>
|
10996
10956
|
* The function should return:<br>
|
@@ -11100,6 +11060,7 @@ DataTable.prototype.getPreviousData = function(rid, cid) {
|
|
11100
11060
|
return null;
|
11101
11061
|
};
|
11102
11062
|
|
11063
|
+
|
11103
11064
|
/** Set data to individual cell
|
11104
11065
|
* @override
|
11105
11066
|
* @param {string} rid Row Id
|
@@ -11180,7 +11141,10 @@ DataTable.prototype.setRowData = function(rid, values, eventArg) { // Data chang
|
|
11180
11141
|
this._rids.push(rid);
|
11181
11142
|
} else {
|
11182
11143
|
this._rids.splice(rowIndex, 0, rid);
|
11183
|
-
|
11144
|
+
if(this._segments) { // for no sorting case
|
11145
|
+
this._segments.invalidateSegmentOrder();
|
11146
|
+
}
|
11147
|
+
segmentChanged = !this._isLastSegment(rowIndex); // This is slow. Check if this is required
|
11184
11148
|
}
|
11185
11149
|
} else {
|
11186
11150
|
this._rids.push(rid);
|
@@ -11625,7 +11589,7 @@ DataTable.prototype.moveRow = function(fromIndex, toIndex, suppressEvent) {
|
|
11625
11589
|
|
11626
11590
|
if(output) {
|
11627
11591
|
if(this._segments) {
|
11628
|
-
this._segments.
|
11592
|
+
this._segments.invalidateSegmentOrder();
|
11629
11593
|
this._sort(null); // Reorder segment members
|
11630
11594
|
}
|
11631
11595
|
this._dispatchPositionChange(suppressEvent);
|
@@ -11882,6 +11846,9 @@ DataTable.prototype.freeze = function(bool) {
|
|
11882
11846
|
let prevState = this._frozen;
|
11883
11847
|
if(prevState !== bool) {
|
11884
11848
|
this._frozen = bool;
|
11849
|
+
if(!bool && this._segments) { // for no sorting case
|
11850
|
+
this._segments.invalidateSegmentOrder();
|
11851
|
+
}
|
11885
11852
|
this._autoFillSegments();
|
11886
11853
|
this.dispatchGlobalChange();
|
11887
11854
|
}
|
@@ -11948,9 +11915,6 @@ DataTable.prototype.setSegmentSeparators = function(rids, enabled) {
|
|
11948
11915
|
}
|
11949
11916
|
}
|
11950
11917
|
}
|
11951
|
-
if (segmentAdded) {
|
11952
|
-
this._segments.calcSegmentOrder(this._rids);
|
11953
|
-
}
|
11954
11918
|
let changed = segmentAdded || segmentRemoved;
|
11955
11919
|
if(changed && this._needFiring()) {
|
11956
11920
|
this.dispatchGlobalChange();
|
@@ -11978,7 +11942,6 @@ DataTable.prototype.setSegmentSeparator = function(rid, options) {
|
|
11978
11942
|
}
|
11979
11943
|
let children = (options && options["children"]) ? options["children"] : null;
|
11980
11944
|
if(this._segments.addSegment(rid, children)) {
|
11981
|
-
this._segments.calcSegmentOrder(this._rids);
|
11982
11945
|
change = true;
|
11983
11946
|
}
|
11984
11947
|
} else if(this._segments) { // Remove the separator
|
@@ -12103,6 +12066,7 @@ DataTable.prototype.getSegmentParentRowId = function(rid) {
|
|
12103
12066
|
*/
|
12104
12067
|
DataTable.prototype.getSegmentValues = function(rids, partial) {
|
12105
12068
|
if(this._segments) {
|
12069
|
+
this._segments.calcSegmentOrder(this._rids, true); // use cache
|
12106
12070
|
return this._segments.getSegmentValues(rids || this._rids, partial);
|
12107
12071
|
}
|
12108
12072
|
return null;
|
@@ -12180,9 +12144,6 @@ DataTable.prototype.fillSegments = function() {
|
|
12180
12144
|
* @param {boolean=} adding This indicates that segment is changed by adding a new child
|
12181
12145
|
*/
|
12182
12146
|
DataTable.prototype._onSegmentChildChanged = function(adding) {
|
12183
|
-
if(this._segments) {
|
12184
|
-
this._segments.calcSegmentOrder(this._rids, true);
|
12185
|
-
}
|
12186
12147
|
if(adding !== false) {
|
12187
12148
|
this._sort(null);
|
12188
12149
|
}
|
@@ -12371,7 +12332,6 @@ DataTable.prototype.sortSegments = function (compare) {
|
|
12371
12332
|
return false;
|
12372
12333
|
}
|
12373
12334
|
if(typeof compare !== "function") {
|
12374
|
-
this._segments.calcSegmentOrder(this._rids);
|
12375
12335
|
return false;
|
12376
12336
|
}
|
12377
12337
|
|
@@ -12406,7 +12366,6 @@ DataTable.prototype.sortSegments = function (compare) {
|
|
12406
12366
|
}
|
12407
12367
|
|
12408
12368
|
if(dirty) {
|
12409
|
-
this._segments.calcSegmentOrder(rids);
|
12410
12369
|
this._sort(null);
|
12411
12370
|
this._dispatchPositionChange();
|
12412
12371
|
}
|
@@ -12414,18 +12373,34 @@ DataTable.prototype.sortSegments = function (compare) {
|
|
12414
12373
|
};
|
12415
12374
|
/** Sort all of existing segments by given compare function
|
12416
12375
|
* @private
|
12417
|
-
* @param {
|
12418
|
-
* @param {
|
12376
|
+
* @param {*} rowA
|
12377
|
+
* @param {*} rowB
|
12419
12378
|
* @return {number}
|
12420
12379
|
*/
|
12421
|
-
DataTable.prototype._bySegmentSeparator = function (
|
12380
|
+
DataTable.prototype._bySegmentSeparator = function (rowA, rowB) {
|
12422
12381
|
return /** @type{number} */(this._userSegmentComparer(
|
12423
|
-
this.
|
12424
|
-
this.
|
12382
|
+
this._getRowDataFromSegment(rowA),
|
12383
|
+
this._getRowDataFromSegment(rowB),
|
12425
12384
|
this._segmentSortOrder,
|
12426
12385
|
this._segmentSortContext
|
12427
12386
|
));
|
12428
12387
|
};
|
12388
|
+
/** Get row data from either Segment or row id
|
12389
|
+
* @private
|
12390
|
+
* @param {*} obj
|
12391
|
+
* @return {Object}
|
12392
|
+
*/
|
12393
|
+
DataTable.prototype._getRowDataFromSegment = function (obj) {
|
12394
|
+
var rowData = null;
|
12395
|
+
if(obj) {
|
12396
|
+
if(typeof obj == "string") {
|
12397
|
+
rowData = this.getRowData(obj);
|
12398
|
+
} else if(obj.getId) {
|
12399
|
+
rowData = this.getRowData(obj.getId());
|
12400
|
+
}
|
12401
|
+
}
|
12402
|
+
return rowData;
|
12403
|
+
};
|
12429
12404
|
|
12430
12405
|
/** A data source to be used with segment classification
|
12431
12406
|
* @public
|
@@ -29983,6 +29958,7 @@ DataView.prototype.getAllRowData = function() {
|
|
29983
29958
|
return this.getMultipleRowData(this.getAllRowIds(true));
|
29984
29959
|
};
|
29985
29960
|
|
29961
|
+
|
29986
29962
|
/** @public
|
29987
29963
|
* @param {string} rid
|
29988
29964
|
* @param {string} cid
|
@@ -36834,7 +36810,7 @@ Core.prototype._hasPendingRowChange = false;
|
|
36834
36810
|
* @return {string}
|
36835
36811
|
*/
|
36836
36812
|
Core.getVersion = function () {
|
36837
|
-
return "5.
|
36813
|
+
return "5.2.2";
|
36838
36814
|
};
|
36839
36815
|
/** {@link ElementWrapper#dispose}
|
36840
36816
|
* @override
|
@@ -40504,6 +40480,9 @@ Core.prototype.initSimpleTable = function (columns) {
|
|
40504
40480
|
colCount = columns.length;
|
40505
40481
|
this.setColumnCount(colCount);
|
40506
40482
|
this.setDataColumnMap(columns);
|
40483
|
+
for(let c = 0; c < colCount; ++c) {
|
40484
|
+
this.setColumnField(c, columns[c]);
|
40485
|
+
}
|
40507
40486
|
}
|
40508
40487
|
|
40509
40488
|
let titleSect = this.addSection("title");
|
@@ -43272,6 +43251,12 @@ RowDefSorter.prototype._multiColumnsSorter = function(rowDefA, rowDefB, primaryO
|
|
43272
43251
|
* @property {Array.<string>} sortedFields An array of sortedField
|
43273
43252
|
*/
|
43274
43253
|
|
43254
|
+
/** @private
|
43255
|
+
* @type {string}
|
43256
|
+
*@constant
|
43257
|
+
*/
|
43258
|
+
const SortableTitlePlugin_ROW_DEF = "ROW_DEF";
|
43259
|
+
|
43275
43260
|
/** @constructor
|
43276
43261
|
* @extends {EventDispatcher}
|
43277
43262
|
* @param {SortableTitlePlugin.Options=} options
|
@@ -43287,6 +43272,7 @@ let SortableTitlePlugin = function (options) { // TODO: Extract SortableTitlePlu
|
|
43287
43272
|
_t._onColumnRemoved = _t._onColumnRemoved.bind(_t);
|
43288
43273
|
_t._onItemSortingClicked = _t._onItemSortingClicked.bind(_t);
|
43289
43274
|
_t.refresh = _t.refresh.bind(_t);
|
43275
|
+
_t._rowDefSorter = _t._rowDefSorter.bind(_t);
|
43290
43276
|
|
43291
43277
|
_t._hosts = [];
|
43292
43278
|
_t._sortLogic = {};
|
@@ -43448,6 +43434,11 @@ SortableTitlePlugin.prototype._frozenIndicator = false;
|
|
43448
43434
|
* @type {boolean}
|
43449
43435
|
*/
|
43450
43436
|
SortableTitlePlugin.prototype._rowDefMode = false;
|
43437
|
+
/**
|
43438
|
+
* @private
|
43439
|
+
* @type {Function}
|
43440
|
+
*/
|
43441
|
+
SortableTitlePlugin.prototype._userComparer = null;
|
43451
43442
|
|
43452
43443
|
/** @private
|
43453
43444
|
* @type {!Object.<string, string>}
|
@@ -44624,6 +44615,21 @@ SortableTitlePlugin.prototype.setSortingSequence = function (sequence, colRef) {
|
|
44624
44615
|
SortableTitlePlugin.prototype.clearAllColumnSortingSequences = function () {
|
44625
44616
|
this._sortingSequenceMap = null;
|
44626
44617
|
};
|
44618
|
+
/** @private
|
44619
|
+
* @param {Object} rowA
|
44620
|
+
* @param {Object} rowB
|
44621
|
+
* @param {number} sortOrder
|
44622
|
+
* @param {*} context
|
44623
|
+
* @returns {number}
|
44624
|
+
*/
|
44625
|
+
SortableTitlePlugin.prototype._rowDefSorter = function (rowA, rowB, sortOrder, context) {
|
44626
|
+
return this._userComparer(
|
44627
|
+
rowA[SortableTitlePlugin_ROW_DEF].getRowData(),
|
44628
|
+
rowB[SortableTitlePlugin_ROW_DEF].getRowData(),
|
44629
|
+
sortOrder,
|
44630
|
+
context
|
44631
|
+
);
|
44632
|
+
};
|
44627
44633
|
/** @public
|
44628
44634
|
* @description Sorting all separators according to compare function. If compare function is not specified, separators will will be sort by current sorting states.
|
44629
44635
|
* @param {Function} comparer Compare function
|
@@ -44632,16 +44638,21 @@ SortableTitlePlugin.prototype.sortSeparators = function (comparer) {
|
|
44632
44638
|
let host = this._hosts[0];
|
44633
44639
|
let dv = host.getDataSource();
|
44634
44640
|
if(comparer){
|
44635
|
-
|
44641
|
+
if(this._rowDefMode) {
|
44642
|
+
this._userComparer = comparer;
|
44643
|
+
dv.sortSeparators(this._rowDefSorter);
|
44644
|
+
this._userComparer = null;
|
44645
|
+
} else {
|
44646
|
+
dv.sortSeparators(comparer);
|
44647
|
+
}
|
44636
44648
|
} else {
|
44637
44649
|
let sortLogics = dv.getSortingLogics();
|
44638
44650
|
let sortOrders = [];
|
44639
44651
|
let sortFields = [];
|
44640
44652
|
let sortStateCount = this._sortStates.length;
|
44641
|
-
let rowDefField = SortableTitlePlugin._toRowDefField();
|
44642
44653
|
for(let i = 0; i < sortStateCount; i++){
|
44643
44654
|
let sortState = this._sortStates[i];
|
44644
|
-
let field = this._rowDefMode ?
|
44655
|
+
let field = this._rowDefMode ? SortableTitlePlugin_ROW_DEF : sortState["field"];
|
44645
44656
|
sortOrders.push(sortState["sortOrder"]);
|
44646
44657
|
sortFields.push(field);
|
44647
44658
|
}
|
@@ -44891,11 +44902,10 @@ SortableTitlePlugin.prototype._onColumnRemoved = function (e) {
|
|
44891
44902
|
};
|
44892
44903
|
|
44893
44904
|
/** @private
|
44894
|
-
* @param {Object=} sortState
|
44895
44905
|
* @return {string}
|
44896
44906
|
*/
|
44897
|
-
SortableTitlePlugin._toRowDefField = function(
|
44898
|
-
return
|
44907
|
+
SortableTitlePlugin._toRowDefField = function() {
|
44908
|
+
return SortableTitlePlugin_ROW_DEF;
|
44899
44909
|
};
|
44900
44910
|
/** @private
|
44901
44911
|
* @param {Object=} opt_action Action that raised the sort. This is optional
|